Skip to main content
Topic: Plot EICs (Read 6131 times) previous topic - next topic

Plot EICs

Multiple file EIC's
The following code allow EICs to be plotted without the need for the diffreport. You can also subset the matrix (gt) to plot only certain features.

Code: [Select]
library(xcms)
library(faahKO)
xs<- group(faahko)
xs<- fillPeaks(xs)
gt<-groups(xs)
eics <- getEIC(xs, mzrange=gt, rtrange = 200, groupidx = 1:nrow(gt))
                                                                         
pdf(file.path("tmp/%003d.pdf"), onefile = FALSE)
## you can also use png(file.path("tmp/%003d.png"), h=768, w=1024)
plot(eics, xs)
dev.off()


Single file EICs
If you have a certain file you want to plot EIC's from then it's probably best to load the file into the xcmsRaw object type.
The following code will plot a single EIC for a single file:

Code: [Select]
library(faahKO)
cdfpath <- system.file("cdf", package = "faahKO")
cdffiles <- list.files(cdfpath, recursive = TRUE,full=T)
xr <- xcmsRaw(cdffiles[1])
xr
plotEIC(xr, m=c(550,551), rt=c(3200, 3800))

You might also want to look at the rawEIC plot type:
Code: [Select]
par(mfrow=c(2,1))
plotEIC(xr, m=c(550,551), rt=c(3200, 3800))
raweic<-rawEIC(xr, m=c(550,551), rt=c(3200,3800))
plot(xr@scantime[raweic$scan], raweic$intensity, type="l", main="EIC", xlab="RT (secs)", ylab="Intensity")
~~
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