Skip to main content
Topic: Should findmzROI be sensitive to m/z values? (Read 6736 times) previous topic - next topic

Should findmzROI be sensitive to m/z values?

G'day,

We've been using findPeaks.centWave to process individual chromatograms, see this thread.  We use this script:

Code: [Select]
require(xcms)
xdata <- read.csv(file="chrom.csv", header=TRUE, sep=",")
rtSec <- xdata$RT
numPoints <- length(xdata$I)
xraw <- new("xcmsRaw")
xraw@tic <- xdata$I
xraw@scantime <- rtSec
xraw@scanindex <- 1:numPoints
xraw@env$mz <- rep(130.61, numPoints)
xraw@env$intensity <- xdata$I
xpeaks <- findPeaks.centWave(xraw, peakwidth=c(10,200), ppm=0, mzdiff=0, snthresh=0, integrate=1, prefilter=c(0,0), verbose=TRUE)
plot(xdata$RT, xdata$I, type='l')
for (i in 1:nrow(xpeaks)) {
 lines(xdata[findInterval(xpeaks[i,'rtmin'],rtSec):findInterval(xpeaks[i,'rtmax'],rtSec), c('RT','I')], col=rainbow(16)[i], type='h')
}
prmatrix(xpeaks)
When processing a single chromatogram, all points are given the same m/z value, in the example above it's 130.61.

However, I noticed that if you change this value you get different results.  This seems to arise from the ROI detection step, which can produce different numbers of ROI depending on the m/z value of the chromatogram.  For example, for the attached data and m/z of 136.01 it finds 12 ROIs.  If the m/z is changed to 13.061 then it finds 23 ROIs.

I don't understand why this should be; if all the m/z values of a chromatogram are identical then they should form the same set of ROIs regardless of the m/z value.

I've looked at the source code for findmzROI and I can't see any problem (but haven't the capacity to debug it).

Is the behaviour I'm observing correct?

Thanks,
Chris.

[attachment deleted by admin]

Re: Should findmzROI be sensitive to m/z values?

Reply #1
I am actually surprised that it works at all with ppm=0. It should work much better with ppm>0.
That is an unexpected result on this type of simulated data.

However I don't understand why you want to run the ROI detection again if you have an ROI or extracted ion chromatogram already.
Why not just skip it and run the chromatographic peak detection directly on that.

Re: Should findmzROI be sensitive to m/z values?

Reply #2
G'day,

Quote
However I don't understand why you want to run the ROI detection again if you have an ROI or extracted ion chromatogram already.
Why not just skip it and run the chromatographic peak detection directly on that.

That would be ideal but I gathered from a different thread that sort of usage "is not supported by the current centWave implementation".

Is that still the case?  If not, how can I skip the ROI detection and go straight to peak detection?

We want our software to use the "official" XCMS R package, rather than hacking our own version that allows us to pass a "featlist" to findPeaks.centWave.

Thanks,
Chris.

Re: Should findmzROI be sensitive to m/z values?

Reply #3
No, it is not supported by centWave.
You would have to either
- write a modified version of centWave that skips ROI detection and get rid of the main loop (that loops through ROIs)
- use the original version of centWave on the complete raw data, i.e. let the ROI detection do its job on the raw data,
  which will be much faster anyway than feeding it with individual chromatograms

Re: Should findmzROI be sensitive to m/z values?

Reply #4
G'day,

Quote from: "Ralf"
- write a modified version of centWave that skips ROI detection and get rid of the main loop (that loops through ROIs)

If I were to supply a patch that allowed centWave to be called with an optional featlist parameter could it be incorporated into the xcms package?

Thanks,
Chris.

 

Re: Should findmzROI be sensitive to m/z values?

Reply #5
Please submit your patch to the developer mailing list (xcms-devel).

Regards,
Ralf