Metabolomics Society Forum

Software => R => XCMS => Topic started by: Ricca on July 22, 2011, 08:59:29 AM

Title: Exclude masses
Post by: Ricca on July 22, 2011, 08:59:29 AM
Hi to everybody, I'm starting to work with xcms with a lot of satisfaction but I still have some doubt. In particular I haven't still discovered a parameter that allow me to exclude some masses from my analysis. Do you have any suggestion??

Best
Riccardo
Title: Re: Exclude masses
Post by: Ralf on July 22, 2011, 11:08:35 AM
There is no such option.
You can simply ignore these features in the result table,
or filter them out in Excel or R
http://groups.google.com/group/xcms/bro ... 1332dba3b0 (http://groups.google.com/group/xcms/browse_thread/thread/eca9f2e7d29e2cd6/efcbab1332dba3b0?lnk=gst&q=filter#efcbab1332dba3b0)
Title: Re: Exclude masses
Post by: Ricca on July 23, 2011, 06:37:46 AM
Thanks for your suggestion!! :D
Title: Re: Exclude masses
Post by: Ricca on July 27, 2011, 08:49:13 AM
I tryed the example of the link you suggested:
Code: [Select]
(xset1 <- xset[which(xset@peaks[,"mz"]<600 & xset@peaks[,"mz"]>100),] )
but the R consol give this error:
Code: [Select]
Errore in xset[which(xset@peaks[, "mz"] < 600 & xset@peaks[, "mz"] > 100),  : object of type 'S4' is not subsettable

Do you have any further suggestion?? :?:
Title: Re: Exclude masses
Post by: hpbenton on August 07, 2011, 10:01:28 AM
Should work..
Code: [Select]
> idx<-which(xs@peaks[,"mz"] > 200 & xs@peaks[,"mz"] < 400)
> head(idx)
##[1]  9 17 24 33 34 35
## and then something like:
xs@peaks<-xs@peaks[idx,]


Note that you used the object and not the slot. Here I access the slot peaks to make the index and then replace the slot with the indexed slot. It maybe easier to not do it in one line.

Paul
Title: Re: Exclude masses
Post by: Ricca on August 19, 2011, 02:28:33 AM
Thanks for you suggestion!! Now the code is right.

Best