Metabolomics Society Forum

Software => R => XCMS => Topic started by: hsiang on January 04, 2012, 02:39:22 AM

Title: How to repeat the workflow of XCMS Online by XCMS manually??
Post by: hsiang on January 04, 2012, 02:39:22 AM
I am beginner of studying how to manipulate and process the LC-MS data.
I am curious how can I manually apply XCMS to access LC-MS data in processing of feature detection, retention time correction, peak alignment (grouping), peak filling just like workflow as XCMS Online. To learn the manipulation and processing of the LC-MS data, I apply the data from Saghatelian et al. which consists of 6 knock-out and 6 wild-type samples. I upload and process these data through XCMS Online. The corresponding log shows as below:
I try to use XCMS instruction xcmsSet to prepare analyte data from these LC-MS data jsut like as following.
Code: [Select]
library(xcms)
PATH <- "ms_netcdf/"
files <- list.files(PATH, pattern="*.CDF", recursive=TRUE, full.names=TRUE)
xset <- xcmsSet(files)
The problem is
xcmsSet constructor which is not consist with the result shown in previous log file. I guess that XCMS automatically construct the xcmsSet object. The procedure maybe contain several individual steps such as xcmsRaw, retcor, group. How can I reproduce the same results provided by XCMS Online?[/list]
I had also tried to detect feature by using the following instructions
Code: [Select]
wt15 <- xcmsRaw("ms_netcdf/WT/wt15.CDF");
wt15.cw.peakList <- wt15.wt.peakList <- findPeaks.centWave(wt15, ppm=30, snthresh=6, peakwidth=c(10, 60), mzdiff=0.01, prefilter=c(3, 100))
The number of peaks detected is also 3515 which is consist with XCMS Online log file. So I repeat the previous code for data loading and peak detecting of each sample. The following problem is how to do retention time correction? According to help of XCMS document, I found instruction of retcor.obiwarp. However, this instruction belongs to xcmsSet-class method. How can I perform the following retention time correction? This really confused me. Please give me your advising.
Thanks for all.

Best regards,
Hsiang
Title: Re: How to repeat the workflow of XCMS Online by XCMS manual
Post by: Ricca on January 04, 2012, 03:46:27 PM
Hope this help:

Code: [Select]
files <- list.files(path=myPath, pattern="xml", full.names = TRUE, recursive = TRUE)
xset <- xcmsSet(files, method="centWave", polarity="positive", prefilter=c(3,100), ppm=30, peakwidth=c(10,60), snthr=10)
xsetR <- retcor(xset, method="obiwarp", profStep=0.1, plottype="deviation")
xsetR <- group(xsetR, bw=5, mzwid=0.025, minfrac=0.5, minsamp=1)
xset.finale <- fillPeaks(xsetR)

I aloso suggest to read THIS (http://http://www.bioconductor.org/packages/2.9/bioc/vignettes/xcms/inst/doc/xcmsPreprocess.pdf)
Best
Title: Re: How to repeat the workflow of XCMS Online by XCMS manual
Post by: hsiang on January 04, 2012, 08:04:20 PM
Quote from: "Ricca"
Hope this help:

Code: [Select]
files <- list.files(path=myPath, pattern="xml", full.names = TRUE, recursive = TRUE)
xset <- xcmsSet(files, method="centWave", polarity="positive", prefilter=c(3,100), ppm=30, peakwidth=c(10,60), snthr=10)
xsetR <- retcor(xset, method="obiwarp", profStep=0.1, plottype="deviation")
xsetR <- group(xsetR, bw=5, mzwid=0.025, minfrac=0.5, minsamp=1)
xset.finale <- fillPeaks(xsetR)

I aloso suggest to read THIS (http://http://www.bioconductor.org/packages/2.9/bioc/vignettes/xcms/inst/doc/xcmsPreprocess.pdf)
Best

Dear Recca,
Thanks for your suggestion. I had tried above codes line by line. However, while running the second instruction, there was an error message.
Quote
ko15: error function (classes, fdef, mtable) :
unable to find an inherited method for function "findPeaks", for signature "NULL"
Is there any configuration modified? Or I neglect something else?
The version and platform of my R:

Best regards,
Hsiang
Title: Re: How to repeat the workflow of XCMS Online by XCMS manual
Post by: hsiang on January 09, 2012, 12:50:45 AM
Here I will report some of my examination.

The following R code is now successfully running.
Code: [Select]
files <- list.files(FILEPATH, full.names=TRUE, recursive=TRUE)
xset <- xcmsSet(files, method="centWave", prefilter=c(3,100), ppm=30, peakwidth=c(10,60), snthresh=6)

Comparing with Ricca's code, some parameters was modified in my solution.

Now, the step of xcmsSet had been worked.  :)

However, I found that the detected number of features (peaks) for each sample is inconsistent with, i.e. a little more than, that produced by XCMS Online. I guess that the number of detected features in the log file provided by XCMS Online had been trimmed due to the retention time correction and peak alignment. But I am not sure.

Besides, while adding attribute of polarity to xcmsSet, the error message I mentioned before - error function (classes, fdef, mtable): unable to find an inherited method for function "findPeaks", for signature "NULL", will be shown. Actually, the polarity is an argument of xcmsSet, not of findPeaks.centWave. Therefore, I reasonably guess that was caused by  inheritance problem of R package.



As previous guess, I still can not confirm my thoughts, because I am not really familiar with R language. If someone could solve my questions, I really appreciate your response.

Best regards,
Hsiang
Title: Re: How to repeat the workflow of XCMS Online by XCMS manual
Post by: Carsten on January 11, 2012, 06:32:19 AM
Quote from: "hsiang"
Besides, while adding attribute of polarity to xcmsSet, the error message I mentioned before - error function (classes, fdef, mtable): unable to find an inherited method for function "findPeaks", for signature "NULL", will be shown. Actually, the polarity is an argument of xcmsSet, not of findPeaks.centWave. Therefore, I reasonably guess that was caused by  inheritance problem of R package.
It's a bug and reproducible with the latest xcms version. Will be fixed in the next release.
Title: Re: How to repeat the workflow of XCMS Online by XCMS manual
Post by: zeleniy on November 13, 2012, 10:50:44 AM
I still see this error:
Code: [Select]
Loading required package: methods
ecoli1_600_pos_1: Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function "findPeaks", for signature "NULL"
Calls: xcmsSet -> findPeaks -> <Anonymous>
Execution halted
for code:
Code: [Select]
xSet = xcmsSet(inputFile, NULL, NULL, NULL, "bin", list(), "positive", 1);

Is it normal ? :)

P.S. Info:
Code: [Select]
> sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-pc-linux-gnu

locale:
 [1] LC_CTYPE=en_US.UTF-8      LC_NUMERIC=C             
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8   
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8 
 [7] LC_PAPER=en_US.UTF-8      LC_NAME=C               
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C     

attached base packages:
[1] stats    graphics  grDevices utils    datasets  methods  base   

other attached packages:
[1] CAMERA_1.4.2 xcms_1.22.1

loaded via a namespace (and not attached):
[1] graph_1.26.0 RBGL_1.24.0  tools_2.11.1