Difference between methods getEIC and rawEIC for xcmsRaw classes
Entering edit mode
Johannes Rainer ★ 1.9k
Last seen 5 days ago

Dear all!

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!

thanks, jo

cdfpath <- system.file("cdf", package="faahKO")
cdffiles <- list.files(cdfpath, recursive=TRUE, full.names=TRUE)
xraw <- xcmsRaw(cdffiles[1], 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)

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)

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] xcms_1.45.2         ProtGenerics_1.0.0  mzR_2.2.0          
[4] Rcpp_0.11.5         ascii_2.1           RColorBrewer_1.1-2
[7] Biobase_2.28.0      BiocGenerics_0.14.0

loaded via a namespace (and not attached):
[1] compiler_3.2.0   tools_3.2.0      codetools_0.2-11 grid_3.2.0      
[5] lattice_0.20-31
xcms metabolomics • 1.5k views
Entering edit mode
Last seen 5.3 years ago
Copenhagen, Denmark

From the xcms documentation:

"(rawEIC) Generate extracted ion chromatogram for m/z values of interest. The raw data is used in contrast to getEIC which uses data from the profile matrix."

rawEIC ignores any binning done and reads the raw data, while getEIC is based on the binned data...

best Thomas

Entering edit mode

thanks! didn't read careful enough ;)

Unfortunately, that does however not explain the difference! I calculated the eic on the profile matrix too, but the results are different (using the code/objects from the original message):

## the EIC from the getEIC:
## and the EIC calculated from the profile matrix (same settings, i.e. step=0.1)
plot(xraw@scantime, apply(xraw@env$profile, MARGIN=2, max), type="l")

## that's not the same, the following however is!
plot(xraw@scantime, apply(xraw@env$profile[1:100, ], MARGIN=2, max), type="l")


Apparently (evaluating also the code in xcmsRaw.R) the function extracts only the first 100 bins (rows) in the profile matrix, so does not consider the full m/z range... I'll evaluate the code again but at present I'm afraid that's a bug :(


Entering edit mode
Johannes Rainer ★ 1.9k
Last seen 5 days ago


getEIC uses the profile matrix to calculate the chromatogram (returning the maximal signal within the specified m/z range for each RT).

However, after checking and evaluating the code, I come to the conclusion that the getEIC method was only intended to extract chromatograms for a restricted, small m/z range. If the m/z range is larger than 100 the method just returns the max signal across the first 100 bins in m/z range.

To me it would make more sense to keep the getEIC method more generic and to allow also extraction of the base peak chromatogram (i.e. most intense signal for each RT across all m/z). I've rewritten the method and submitted a pull request to the xcms github repository.

cheers, jo

UPDATE (2015-05-07)

It's now in the xcms development branch (version 1.45.3), however, at present only as an option. By setting

BioC <- getOption("BioC")
BioC$xcms$getEIC.method <- "getEICNew"

the new getEIC method will be used. In later releases of the package the new implementation might become default.

cheers, jo


Login before adding your answer.

Traffic: 492 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6