I want to calculate the global median normalization on 4 arrays using Cy5 background subtracted from Cy5 foreground values.
for(i in 1:4) {
name <- paste("sample", i, sep = ".")
bg <- maRb(dat[,i]) fg <- maRf(dat[,i])
diff <- fg - bg
}
assign(name, log2(diff))
data.prenorm <- cbind(sample.1, sample.2, sample.3, sample.4)
data.median <- apply(data.prenorm, 2, median, na.rm = T)
data.norm <- sweep(data.prenorm, 2, data.median)
colnames(data.norm) <- c("Array 1", "Array 2", "Array 3", "Array 4")
median(data.norm[ , 1], na.rm = T) median(data.norm[ , 2], na.rm = T)
median(data.norm[ , 3], na.rm = T) median(data.norm[ , 4], na.rm = T)
My code produces a warning message in R:
In assign(name, log2(diff)) : NaNs produced
What Mensur Dlakic said + I would encourage you to use a dedicated package for normalization of data. Most likely there are several out there, arrays are really not new technology and extensive methodology for analysis has been developed already.