Skip to main content
Topic: How to repeat the workflow of XCMS Online by XCMS manually?? (Read 7506 times) previous topic - next topic

How to repeat the workflow of XCMS Online by XCMS manually??

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:
    General parameters
      polarity     positive
          retention time format     minutes
    2. Feature detection
      method : centWave
          ppm     30
          snthr     6
          peakwidth     10 60
          mzdiff     0.01
          prefilter peaks     3
          prefilter intensity     100
          Feature detection results :
        wt15.CDF    [1_WT]     -->  3515  Features.
           wt16.CDF    [1_WT]     -->  3499  Features.
           wt18.CDF    [1_WT]     -->  3033  Features.
           wt19.CDF    [1_WT]     -->  3047  Features.
           wt21.CDF    [1_WT]     -->  2850  Features.
           wt22.CDF    [1_WT]     -->  3235  Features.
           ko15.CDF    [2_KO]     -->  3516  Features.
           ko16.CDF    [2_KO]     -->  3553  Features.
           ko18.CDF    [2_KO]     -->  3097  Features.
           ko19.CDF    [2_KO]     -->  3087  Features.
           ko21.CDF    [2_KO]     -->  3109  Features.
           ko22.CDF    [2_KO]     -->  3201  Features.
    3. Retention time correction
      method : obiwarp
          profStep     0.1
    4. Alignment
      method : peakgroups
          bw     5
          mzwid     0.025
          minfrac     0.5
          minsamp     1
    5. FillPeaks
    6. Diffreport
      class1     1_WT
          class2     2_KO
          statistics.threshold.pvalue     0.01
          statistics.diffReport.value     into
    7. Additional Plots & Statistics
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
    According to previous code, total number of peaks is 4721 generated by
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

Re: How to repeat the workflow of XCMS Online by XCMS manual

Reply #1
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
Best

Re: How to repeat the workflow of XCMS Online by XCMS manual

Reply #2
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
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:
    R version 2.13.1 (2011-07-08)
    Platform: i386-pc-mingw32/i386 (32-bit)
    OS: Windows 7

Best regards,
Hsiang

Re: How to repeat the workflow of XCMS Online by XCMS manual

Reply #3
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.
    1. Attribute of polarity should be removed.
    2. "snthr=10" should be modified as "snthresh=6"

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.

    xcmsSet(files = NULL, snames = NULL, sclass = NULL, phenoData = NULL,
            profmethod = "bin", profparam = list(),
            polarity = NULL, lockMassFreq=FALSE, start=0,
          mslevel=NULL, nSlaves=0, progressCallback=NULL,...)


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

Re: How to repeat the workflow of XCMS Online by XCMS manual

Reply #4
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.

 

Re: How to repeat the workflow of XCMS Online by XCMS manual

Reply #5
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