Skip to main content

Topic: Normalise with median fold change (Read 4668 times) previous topic - next topic

  • hpbenton
  • [*][*][*]
Normalise with median fold change
Recently there was a paper published with suggested that median fold change was a suitable normalization method for urine and other samples that are effected by dilutions.

Code: [Select]
normalize.medFC <- function(mat) {
# Perform median fold change normalisation
#          X - data set [Variables & Samples]
medSam <- apply(mat, 1, median)
medSam[which(medSam==0)] <- 0.0001
mat <- apply(mat, 2, function(mat, medSam){
medFDiSmpl <- mat/medSam
vec<-mat/median(medFDiSmpl)
return(vec)
}, medSam)
return (mat)
}


On the faahKO dataset it would work something like the following:
Code: [Select]
cdfpath <- system.file("cdf", package = "faahKO")
cdffiles <- list.files(cdfpath, recursive = TRUE,full=T)
faahko <- xcmsSet(cdffiles)
faahko <- group(faahko)
faahko <- retcor(faahko)
faahko <- fillPeaks(faahko)

report <- cbind(groups(faahko), normalize.medFC(groupval(faahko, "medret", "into")) )
head(report)
write.csv(report, file="reportFile.csv")


(1)   Veselkov, K. A.; Vingara, L. K.; Masson, P.; Robinette, S. L.; Want, E.; Li, J. V.; Barton, R. H.; Boursier-Neyret, C.; Walther, B.; Ebbels, T. M. D.; Pelczer, I.; Holmes, E.; Lindon, J. C.; Nicholson, J. K. Anal. Chem. 2011, 83, 5864-5872.
~~
H. Paul Benton
Scripps Research Institute
If you have an error with XCMS Online please send me the JOBID and submit an error via the XCMS Online contact page