xcms centwave roiList error
1
0
Entering edit mode
roxana ▴ 10
@roxana-21486
Last seen 5.4 years ago

Hello,

I'm using find xcms::findChromPeaks with centwave algorithm to extract XICs for which I need to input a roilist, I was testing using just one ROI or m/z Trypto<-data.frame("mz"=216.1341,"rtmin"= 50, "rtmax"= 900,"mz"=216.1341,"scmin"=51,"scmax"=800,"mzmin"=216.1321,"mzmax"=216.1361,"length"=20,"intensity"=1000)

but I keep getting the following error...Error in validObject(.Object) : invalid class “CentWaveParam” object: 'roiList' does not provide all required fields!

I don't know what I am missing! please help

roiList xcms centwave XIC • 1.8k views
ADD COMMENT
0
Entering edit mode
Johannes Rainer ★ 2.1k
@johannes-rainer-6987
Last seen 8 weeks ago
Italy

The roiList parameter should be a list. So what you should do is to provide the ROI as:

Trypto <- list(c(scmin = 51, scmax = 800, mzmin = 216.1321, mzmax = 216.1361, length = 20, intensity = 1000))
cwp <- CentWaveParam(roiList = Trypto)

Note however that it would be much easier to extract the ion chromatogram for your compound of interest in the following manner (assuming that data is your data object, i.e. the data you read with readMSData):

trypto <- chromatogram(data, rt = c(50, 900), mz = c(216.1321, 216.1361))

Parameters rt and mz allow to define the retention time and m/z range from which you want to extract the data. The data is then returned as a Chromatograms object. You can simply call plot on that object to plot the data, or you could also run findChromPeaks on that object to perform a chromatographic peak detection on that extracted chromatogram.

hope this helps

cheers, jo

ADD COMMENT
0
Entering edit mode

ADD REPLY
0
Entering edit mode

Thank you Johannes. The ROIlist error is gone after using a list as you suggested! but for some reason is not finding the ROIs (which are definitely in there)...I have also tried using chromatogram to extract the ion of interest, but I decided to go with findChrompeaks/centwave so that I could run multiple files "onDisk" and also be able to plot multiple XICs or extract multiple m/z s in one chromatogram window, which it seems is not possible using the chromatogram function...do you know if it is possible to extract multiple XICs in one window using Chromatogram? Any suggestions are appreciated !

ADD REPLY
0
Entering edit mode

The findChromPeaks function is really only intended to identify chromatographic peaks - not to extract ion chromatograms. To extract ion chromatograms you have to use the chromatogram function on the on disk data. It will extract the chromatogram for each file in your data. If you call plot on the object returned by chromatogram (which in fact is a Chromatograms object), it will plot the ion chromatogram of every file into the same plot (one line for each file). Have a look at xcms vignette for an example how to use it.

ADD REPLY
1
Entering edit mode

Right, I'm trying to do something similar to what this vignette shows : https://bioconductor.org/packages/release/bioc/vignettes/xcms/inst/doc/xcms.html , something like this below, which was working OK, but I figured I needed to use the ROIlist to make "targeted peak detection" , perhaps I need to make a ROIlist from the chromatogram object?

chrraw <- chromatogram(rawdata, mz = mzr, rt = rtr)

xchr <- findChromPeaks(chr_raw, param = CentWaveParam(snthresh = 2))

plot(xchr, col = samplecolors, peakBg = samplecolors[chromPeaks(xchr)[, "column"]])

Thanks!

ADD REPLY
1
Entering edit mode

Note that you can also provide a matrix with arguments mz and rt (two columns with lower and upper boundary, each row defining the region in wich you expect the data from one ion). With that you could extract multiple XIC at once and you could also run the findChromPeaks on all of them. That might be an alternative to the ROIlist.

ADD REPLY

Login before adding your answer.

Traffic: 560 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6