Skip to main content
Topic: Exclude masses (Read 5393 times) previous topic - next topic

Exclude masses

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


Re: Exclude masses

Reply #2
Thanks for your suggestion!! :D

Re: Exclude masses

Reply #3
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?? :?:

Re: Exclude masses

Reply #4
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
~~
H. Paul Benton
Scripps Research Institute
If you have an error with XCMS Online please send me the JOBID and submit an error via the XCMS Online contact page

Re: Exclude masses

Reply #5
Thanks for you suggestion!! Now the code is right.

Best