Metabolomics Society Forum

Software => XCMS => R => XCMS - FAQ => Topic started by: hpbenton on August 19, 2011, 12:56:09 PM

Title: My Peaks are not picked!
Post by: hpbenton on August 19, 2011, 12:56:09 PM
I can see my peaks, but centWave won't detect them.
To check why centWave does not detect "your" peak, you have to zoom into the raw data, and obtain some intermediate results. As seen in the following plot, the feature at m/z 507.3 seems to have "holes", i.e. the LC Peak is not detected by the FTICR in individual scans. In it's first stage the centWave peak picker determines regions-of-interest, i.e. mass traces with a low (<ppm threshhold) difference between consecutive scans. Hence, with these "holes" this (otherwise nice) LC peak is cut into a few ROIs, which subsequently are eliminated by second phase of centWave, the peak shape detection via wavelets:

[attachment=2:xytw8wi0]180px-PlotRawROIs.png[/attachment:xytw8wi0]
ROIs detected by centWave
Code: [Select]
library(xcms)
data.file="B08-08318_c.mzXML"
xraw <- xcmsRaw(data.file)
massrange=c(507,508)
timerange=c(3200,3250)
dev=50*1e-6
minCentroids=3
prefilter=c(3,10)

Manually extract ROIs
Code: [Select]
scanrange=range(which(xraw@scantime>timerange[1]
                  & xraw@scantime<timerange[2]))
featlist <- xcms:::findmzROI(xraw,scanrange=scanrange,
                            dev=dev,
                            minCentroids=minCentroids,
                            prefilter=prefilter)
means <- sapply(featlist,function(x) c(x$mzmin, x$mzmax,
                                      xraw@scantime[x$scmin],
                                      xraw@scantime[x$scmax]))
par(cex=2)
plotRaw(xraw,mzrange=massrange,rtrange=timerange, log=FALSE)
rect(means[3,],means[1,],means[4,], means[2,])
This can be verified looking at the corresponding EIC. Beware that plotChrom() uses the resampled profile Matrix for the values, and hence profMethod and profStep have an influence on the shape:

[attachment=1:xytw8wi0]180px-PlotChromBinLin.png[/attachment:xytw8wi0]
Filtered (intlin) EIC

[attachment=0:xytw8wi0]180px-PlotChromBin.png[/attachment:xytw8wi0]
Unfiltered (bin) EIC
It might be that matchedFilter is a bit better here, because it is using the smoothed (unless you use profMethod="bin") profile matrix.
Code: [Select]
## Check EIC
##
profStep(xraw) <- 0.05
## With smoothing
profMethod(xraw) <- "intlin"
plotChrom(xraw, massrange=c(507.25, 507.35), timerange=c(3100,3350))
## Without smoothing
profMethod(xraw) <- "bin"
plotChrom(xraw, massrange=c(507.25, 507.35), timerange=c(3100,3350))

[attachment deleted by admin]