I am a little puzzled by the two methods for
xcmsRaw classes to extract ion chromatograms, namely the
rawEIC and the
getEIC methods. I am most likely mistaken, but I was expecting the function to return comparable data (which they don't do, see code below). The difference is also not explained by the fact that
rawEIC returns the sum of all signals across the m/z range, and the
getEIC (likely) not (I checked for the max signal across the m/z range, but that does also not fit).
I appreciate any help or suggestion on this!
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) ## define the mz and rtrange mzrange <- xraw@mzrange rtrange <- range(xraw@scantim) ## now getting the raw EIC reic <- rawEIC(xraw, mzrange=mzrange, rtrange=rtrange) par(mfrow=c(1, 2)) plot(xraw@scantime[reic$scan], reic$intensity, type="l", main="TIC") ## now using the getEIC... mzrange.m <- matrix(mzrange, nrow=1) colnames(mzrange.m) <- c("mzmin", "mzmax") rtrange.m <- matrix(rtrange, nrow=1) geic <- getEIC(xraw, mzrange=mzrange.m, rtrange=rtrange.m) plot(geic)
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:  parallel stats graphics grDevices utils datasets methods  base other attached packages:  xcms_1.45.2 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 grid_3.2.0  lattice_0.20-31