Metabolomics Society Forum

Software => R => XCMS => Topic started by: cpudney on November 11, 2011, 07:11:16 AM

Title: How to run findPeaks.centWave on an individual chromatogram
Post by: cpudney on November 11, 2011, 07:11:16 AM
G'day,

I was experimenting earlier today with using findPeaks.centWave on a single chromatogram.

The chromatogram was stored in a CSV file (RT, I) and I passed it to findPeaks.centWave thus:

Code: [Select]
require(xcms)
data <- read.csv(file="chrom.csv", header=TRUE, sep=",")
numPoints <- length(data$I)
raw <- new("xcmsRaw")
raw@tic <- data$I
raw@scantime <- data$RT
raw@scanindex <- 1:numPoints
raw@env$mz <- rep(136.061, numPoints)
raw@env$intensity <- data$I
peaks <- findPeaks.centWave(raw, peakwidth=c(0,100))

Actually, it must have been something like the above because it worked - it detected a peak in precisely the right spot - but now that I try the above again it fails to find a single ROI and so bails out.

Is the above (or something similar) the correct approach for passing a single chromatogram to findPeaks.centWave?

I've attached chrom.csv.

Thanks,
Chris.
Title: Re: How to run findPeaks.centWave on an individual chromatog
Post by: cpudney on November 13, 2011, 10:40:48 PM
Here's the chromatogram data: [attachment=0:2sfz8o3s]chrom.zip[/attachment:2sfz8o3s]

[attachment deleted by admin]
Title: Re: How to run findPeaks.centWave on an individual chromatog
Post by: Ralf on November 14, 2011, 08:16:27 PM
You can either
Title: Re: How to run findPeaks.centWave on an individual chromatog
Post by: cpudney on November 15, 2011, 03:47:31 AM
G'day,

Thanks for your response Ralf.

Quote
build an xcmsRaw object using the data from your "chromatograms". But then you do need m/z values

Is that why the approach I used above failed - because I fudged the m/z values (all set to 136.061)?

Quote
bypass the ROI detection. Generate "featlist" (list of ROI's) using your chromatograms and feed that into centWave.

Could you provide an example of this please - I read the documentation and searched the forum but couldn't find information about passing a "featlist" to findPeaks.centWave.

Thanks,
Chris.
Title: Re: How to run findPeaks.centWave on an individual chromatog
Post by: Ralf on November 15, 2011, 01:40:20 PM
Quote
Is that why the approach I used above failed - because I fudged the m/z values (all set to 136.061)?
peakwidth=c(0,100) could be the problem. A minimum peak width of 0 does not make sense.
I would not recommend going below 10 or 20 for HPLC data, you risk picking up a lot of noise.

Quote
passing a "featlist" to findPeaks.centWave.
It is not supported by the current centWave implementation.

But instead of calling
Code: [Select]
 featlist <- findmzROI(object,scanrange=scanrange,dev=dev,minCentroids=minCentroids, prefilter=prefilter, noise=noise)
within findPeaks.centWave() you can call your own function that gives a list of ROI
or comment it out and pass featlist as a parameter to centWave.

featlist (the list of ROI's) is simply an R list, where each list element
defines {"mz", "mzmin", "mzmax", "scmin", "scmax", "length", "intensity"}
where "mzmin", "mzmax" are the boundaries in m/z
and "scmin", "scmax" are the boundaries in time (as scan number).
Title: Re: How to run findPeaks.centWave on an individual chromatog
Post by: cpudney on December 08, 2011, 11:54:18 PM
G'day,

I got this working - turns out all that was needed was to supply ppm=0 for the ROI detection to work :D

Setting mzdiff=0 also helps.

So, I'm now using

Code: [Select]
peaks <- findPeaks.centWave(raw, peakwidth=c(10,100), ppm=0, mzdiff=0)

Regards,
Chris.