Skip to main content
Topic: XCMS2: collect() doesn't work (Read 7224 times) previous topic - next topic

XCMS2: collect() doesn't work

I'm trying to use XCMS2 to search METLIN for MS/MS spectra, and I'm stuck at one of the first steps. When I try the collect() function, I get this error:
Code: [Select]
Error in function (classes, fdef, mtable)  : 
  unable to find an inherited method for function "collect", for signature "xcmsRaw"

Here is the code I'm using:
Code: [Select]
library(xcms)

Data.raw <- xcmsRaw(filename="20110724pooledplasma-MSMS-06.mzdata.xml", includeMSn=TRUE)
Data.raw

Data.coll <- collect(Data.raw, rt=30)

Any suggestions? Thanks in advance!

Laura

Re: XCMS2: collect() doesn't work

Reply #1
collect is suppose to take an xcmsFragments object as input.
So you need to use xcmsFragments first.
Blog: stanstrup.github.io

Re: XCMS2: collect() doesn't work

Reply #2
Thank you, Jan. The reason I was trying the xcmsRaw() function first was because I was following the steps in this video: http://www.youtube.com/watch?v=eNaKGyyfjT0
Is there another example somewhere that you would recommend? I still don't really understand how to begin, and I'm looking for an example to work from. I tried this:
Code: [Select]
Sample <- list.files(getwd(), pattern="mzdata.xml", full.names=TRUE, recursive=TRUE)

Data.set <- xcmsSet(Sample)

Data.fragments <- xcmsFragments(Data.set)

Data.coll <- collect(Data.set, rt=30)

but that gave me the same error as before when I got to the collect() step.

Laura

Re: XCMS2: collect() doesn't work

Reply #3
I am sorry but I can't be very helpful with these functions as I haven't used them myself. But I see the problem in your example.
You are still passing the xcmsSet object (Data.set) to collect instead of the xcmsFragments object (Data.fragments).

Data.fragments is just a new variables not connected to Data.set. "." doesn't have special meaning in R.
To understand better what is inside each variable it is always a good idea to use str(object) as in str(Data.set) or str(Data.fragments).


Hope this helps.
Blog: stanstrup.github.io

Re: XCMS2: collect() doesn't work

Reply #4
Oops! That was an oversight. Fixed the bit of the code so that now I'm using collect(Data.fragments). I still get an error, though:
Error in class(xs) : 'xs' is missing

Thanks, Jan.

Does anyone know of an example with the R code for using XCMS2?

Laura

Re: XCMS2: collect() doesn't work

Reply #5
I read the guide you referred to now.
It appears that the way collect works was changed (another person downgraded to another version to make it work it seems: viewtopic.php?f=8&t=287). It now seems to require doing some peak picking first though the help is very sparse so I am not much help.
However since you want to use the searchMetlin function the point seems moot at the moment as this was apparently removed from xcms: viewtopic.php?f=8&t=130. The function is no longer there if you check the list of xcms functions.

See also: https://groups.google.com/forum/?fromgr ... 6_dMrI8vQA
Blog: stanstrup.github.io

Re: XCMS2: collect() doesn't work

Reply #6
Oh, no! How disappointing! That's really too bad. I've been searching METLIN online, but I'm basically copying and pasting by hand, which is tedious, and I was also very excited about the similarity search feature mentioned in the paper describing XCMS2: Benton, H. P., D. M. Wong, S. A. Trauger and G. Siuzdak (2008). "XCMS2: processing tandem mass spectrometry data for metabolite identification and structural characterization." Analytical Chemistry 80(16): 6382-9.

Thank you, as usual, for being so helpful, Jan!

Laura