I was trying various things with metabolomics data in
xcms. In particular, I wanted to look at the total ion count (TIC), which, following http://www.ncbi.nlm.nih.gov/pubmed/25078324 is the "sum of all signals across all m/z" for a given retention time RT. A TIC can be generated using the
plotTIC function in
xcms, but, in order to get a feeling of the data, I wanted to generate the plot on the data myself. So I extracted the raw data matrix, summed up the intensity values per time point but to my surprise the plots look different, with the
plotTIC resulting in higher intensities.
The code to generate the plots was:
> library(xcms) > cdfpath <- system.file("cdf", package="faahKO") > cdffiles <- list.files(cdfpath, recursive=TRUE, full.names=TRUE) > xraw <- xcmsRaw(cdffiles, profmethod="bin", profstep=0.1) > ## get the raw matrix and sum up the intensities per time point > rawmat <- rawMat(xraw) > aggr <- aggregate(rawmat, by=list(rawmat[, 1]), FUN=sum) > ## plot the TIC > plotTIC(xraw) > points(aggr[, 1], aggr[, 4], col="red", type="l")
I can to some extend understand that
plotChrom generate different plots, as
plotTIC bases on the raw data and
plotChrom on the profile data, but it puzzles me why there is a difference between the
plotTIC and the sum of of intensities as I calculated them.
I think I am missing here something...
any help is very much appreciated
my session info:
> sessionInfo() R version 3.2.0 (2015-04-16) Platform: x86_64-apple-darwin14.3.0/x86_64 (64-bit) Running under: OS X 10.10.3 (Yosemite) locale:  en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages:  grid parallel stats graphics grDevices utils datasets  methods base other attached packages:  lattice_0.20-31 xcms_1.45.0 ProtGenerics_1.0.0  mzR_2.2.0 Rcpp_0.11.5 ascii_2.1  RColorBrewer_1.1-2 Biobase_2.28.0 BiocGenerics_0.14.0 loaded via a namespace (and not attached):  compiler_3.2.0 tools_3.2.0 codetools_0.2-11