sneumann / xcms

This is the git repository matching the Bioconductor package xcms: LC/MS and GC/MS Data Analysis
Other
183 stars 80 forks source link

SWATH: reconstructChromPeakSpectra: rtime is always NA #485

Closed RiyaDhar closed 4 years ago

RiyaDhar commented 4 years ago

Hi, I have been trying to use data from reconstructChromPeakSpectra from two different files and compare the results based on retention time and precursor Mz. However, I have observed that the retention time is always NA after reconstructChromPeakSpectra operation, even though MS1 and MS2 data have rt values present.

Is there any workaround to this loss of data? Any advice or help is much appreciated.

Thank you in advance!

sneumann commented 4 years ago

Hi, thanks for the question. @korseby what was your experience here ? Yours, Steffen

jorainer commented 4 years ago

Indeed, that is a bug. I will add also the retention time. I will use the median rt of all identified MS2 chromatographic peaks from which the Spectrum2 is created.

jorainer commented 4 years ago

@RiyaDhar , version 3.11.3 of xcms fixes this problem, i.e. reconstructChromPeakSpectra returns Spectra with rtime set. To install this version use devtools::install_github("sneumann/xcms").

korseby commented 4 years ago

I'm still using an older version of XCMS (install_github("sneumann/xcms", ref="02e4aaf80a6e8c5737d8c41d8e83e09d94fd2bef")) with R 3.6.

When I do something like

fData(swath_data_fresh_pos)[, c("fileIdx", "originalPeaksCount", "totIonCurrent", "retentionTime", "basePeakMZ", "precursorMZ", "precursorIntensity")]

I will get something like:

           fileIdx originalPeaksCount totIonCurrent retentionTime basePeakMZ precursorMZ precursorIntensity
F01.S02500       1                580        486311        60.040  186.21878          NA                 NA
F01.S02501       1                  7          3516        60.094   86.09705        77.5                  0
F01.S02502       1                  4          2385        60.116  114.08881       102.0                  0
F01.S02503       1                 25         13867        60.138  136.06193       127.0                  0
F01.S02504       1                 19          9961        60.160   97.06750       152.0                  0

Indeed, when I look at a specific spectrum I get:

> str(swath_spectrum_of_interest@listData[[i]])
Formal class 'Spectrum2' [package "MSnbase"] with 19 slots
  ..@ merged            : num 1
  ..@ precScanNum       : int(0) 
  ..@ precursorMz       : Named num 244
  .. ..- attr(*, "names")= chr "mz"
  ..@ precursorIntensity: num(0) 
  ..@ precursorCharge   : int(0) 
  ..@ collisionEnergy   : num(0) 
  ..@ msLevel           : int 2
  ..@ peaksCount        : int 2
  ..@ rt                : num(0) 
  ..@ acquisitionNum    : int(0) 
  ..@ scanIndex         : int(0) 
  ..@ tic               : num 5889
  ..@ mz                : Named num [1:2] 225 259
  .. ..- attr(*, "names")= chr [1:2] "CP128872" "CP128871"
  ..@ intensity         : Named num [1:2] 5732 157
  .. ..- attr(*, "names")= chr [1:2] "CP128872" "CP128871"
  ..@ fromFile          : int 17
  ..@ centroided        : logi TRUE
  ..@ smoothed          : logi NA
  ..@ polarity          : int NA
  ..@ .__classVersion__ :Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. ..@ .Data:List of 2
  .. .. .. ..$ : int [1:3] 0 4 0
  .. .. .. ..$ : int [1:3] 0 2 0

I think that some other fields like precursorIntensity, precursorCharge, polarity should be filled too. Not sure about the other and whether they could be filled. Would be nice to have.

jorainer commented 4 years ago

I'm not sure which info to put into precursorIntensity and precursorCharge. Do you have any suggestion?

michaelwitting commented 4 years ago

Good question. Should be the intensity of the MS1 peak. Charge is tricky, can be only determined after grouping of isotopes etc.

RiyaDhar commented 4 years ago

@jorainer Thank you for your immediate resolution of my issue

jorainer commented 4 years ago

@michaelwitting what should we use as default? I'd got for "maxo", what do you think?

michaelwitting commented 4 years ago

Agreed!

korseby commented 4 years ago

Fine with me.

jorainer commented 4 years ago

OK, all fixes are now in the current master branch. @RiyaDhar please feel free to close the issue.