Skip to main content
Topic: Confusions about handling metabolomics data with XCMS (Read 6358 times) previous topic - next topic

Confusions about handling metabolomics data with XCMS

Dear all,

Recently, I have met some unexpected problems handling data with "xcms" package in R. Here are the details.
 
(1) Instrument: UFLC-IT-TOF-MS (SHIMADZU)
        (When analyzing samples, the ion trop was not used, so the data were not MS/MS or MSn)
    File type from vendor software (LCMSSolution, SHIMADZU): .lcd
 
 
(2) If I converted the .lcd files to .netCDF files by vendor software, (since the mass spectrometry switch between positive and negative models) the data were sorted by the scan time with one positive scan record followed by one negative scan record. XCMS failed to identify peaks with the method “centWave”.
 
Then I tried to converte the .lcd files to .mzXML (or .mzData) files, and each .lcd file would generate two .mzXML files containing positive and negative scan data respectively. With method  “centWave” (positive and negative data were processed separately), there were WARNINGS (see below).
 
xset <- xcmsSet(cdffiles,method='centWave',ppm=10,peakwidth=c(5,30),snthresh=5)
There were 28 warnings (use warnings() to see them)
> warnings()
warnings?
1: In readChar(filename, 1024) :
  can only read in bytes in a non-UTF-8 MBCS locale
2: In .local(object, ...) :
  It looks like this file is in profile mode. centWave can process only centroid mode data !
3: In readChar(filename, 1024) :
  can only read in bytes in a non-UTF-8 MBCS locale
4: In .local(object, ...) :
  It looks like this file is in profile mode. centWave can process only centroid mode data !

 
Then I checked the .mzXML files by OpenChrom, I found something strange. It seems that the mass data in .mzXML files were un-centroided or false centroided. Part of the data at one scan (sorted by mz values) were below.
m/z  abundance
230.21      0
230.225  8832
230.239  15360
230.254  13184
230.268  0
256.232  0
256.247  15360
256.262  19712
256.277  13184
256.293  0
 
It is very different with the .netCDF file.
m/z  abundance
230.24      124278
231.24      8832
256.26      37504
 
The vender software seemed to be wrong when converting the .lcd files to mzXML files (or mzData).
 
So I do really need a method to transform the .netCDF file to two separated .netCDF files with one containing the positive scan data and another containing the negative scan data. I have tried the R package “ncdf” to transform the files, but failed since I am not good at it.

Can xcms handling such kind of data? Or what else could I do?
 
Looking forward to your help and advises!
Thanks in advance.

(My English is so poor, and I am not able to write it clearly, for which please do excuse me)

 
Best Regards,
Jiaq Chen

Re: Confusions about handling metabolomics data with XCMS

Reply #1
If the polarity is set correctly for each scan in the file you should be able to use the polarity parameter in xcmsSet to only use positive/negative scans.

You can also re-convert the continuous mode data with msconvert from proteowizard and centroid (peakPicking filter in msconvert). Be sure to compare your files with what it shows in your vendor software to verify that the files were converted correctly.
Blog: stanstrup.github.io

Re: Confusions about handling metabolomics data with XCMS

Reply #2
Hi,

The netCDF will not have proper pos/neg annotated. If you KNOW
in which order they come, you can:

Code: [Select]

    library(xcms)
    library(faahKO)

    # Assume that's one of yours:
    file <- system.file('cdf/KO/ko15.CDF', package = "faahKO")
    xposneg <- xcmsRaw(file)

    # Vector of alternating pos/neg
    polarity = rep(c("positive", "negative"), length=length(xposneg@scantime))

    # Split into a list with two xcmsRaw objects:
    xrs <- split(xposneg, f=polarity)

    # Write out to new netCDF files
    write.cdf(xrs[["positive"]], filename="xrpos.cdf")
    write.cdf(xrs[["negative"]], filename="xrneg.cdf")


Repeat for all your files...

Yours,
Steffen
--
IPB Halle                          Mass spectrometry & Bioinformatics
Dr. Steffen Neumann         http://www.IPB-Halle.DE
Weinberg 3 06120 Halle     Tel. +49 (0) 345 5582 - 1470
sneumann(at)IPB-Halle.DE