xcms icon indicating copy to clipboard operation
xcms copied to clipboard

findChromPeaksIsolationWindow delete MS1 detection

Open ghost opened this issue 5 years ago • 4 comments

I'm working on water data (MS1/MSe) After the detection of my peaks in MS1 I apply the findChromPeaksIsolationWindow function to detect my MS2

cwp <- CentWaveParam() xdata <- findChromPeaks(raw_data, param = cwp)

xdata <- findChromPeaksIsolationWindow(raw_data, param = cwp)

This function adds the detection of my MS2 and deletes my MS1. I tried to work around the problem but without success Thank you Yohann

ghost avatar Apr 09 '20 08:04 ghost

Please note that for MSe data there is another solution: https://github.com/sneumann/xcms/issues/451 You can do first classical detection in MS1 and then run a second round of peak detection on MS2 with findChromPeaks(..., msLevel = 2, add = TRUE). The add = TRUE ensures that newly identified peaks will be added to the already identified MS1 peaks.

jorainer avatar Apr 10 '20 05:04 jorainer

Thanks

ghost avatar Apr 10 '20 20:04 ghost

Thanks, everything works. on the other hand, when I try to transform my data into a .mgf format, for GNPS, it is unable to reconstruct spectra.

filteredMs2Spectra <- featureSpectra(processed_Data, return.type = "Spectra") filteredMs2Spectra <- clean(filteredMs2Spectra, all = TRUE) filteredMs2Spectra <- formatSpectraForGNPS(ms2spectra)

I use the ChromPeakSpectra command to verify and here is the output: Spectra with 0 spectra and 1 metadata column(s):

While it correctly identifies my MSe spectra when I export them...

Thanks

ghost avatar Apr 10 '20 21:04 ghost

The problem is that featureSpectra will not work because, AFAIK, you don't have a precursor m/z for the MS2 spectra in MSe. featureSpectra was developed for DDA and will return MS2 spectra that have their precursor m/z within the m/z range of the feature and have a retention time within the rt range of the feature.

For DIA you should use (as you correctly did) the findChromPeaks, findChromPeaksIsolationWindow and reconstructChromPeakSpectra functions.

So, firstly you will have to call xdata <- findChromPeaks(raw_data, param = cwp) to identify chromatographic peaks in MS1. Then you want to identify chromatographic peaks in MS2. SCIEX instruments in SWATH mode measure MS2 spectra within isolation windows. To support that we have implemented the findChromPeaksIsolationWindow function. I'm however not sure if your MSe data has isolation windows defined. You can check that by calling isolationWindowTargetMz(xdata). If that returns some meaningful numbers (i.e. NA for MS1 spectra but number(s) for MS2 spectra) you are fine and you can use xdata <- findChromPeaksIsolationWindow(xdata, param = cwp) (note that you called that on raw_data instead on xdata and thus did not get any MS1 spectra). Otherwise you would have to define the isolation windows yourself (i.e. assign spectra to a certain isolation window). AFAIK MSe does not use isolation windows but measures MS2 in the full m/z range. Thus you could call:

iwindow <- rep(NA, length(xdata))
iwindow[msLevel(xdata) == 2] <- 1
xdata <- findChromPeaksIsolationWindow(xdata, param = cwp, isolationWindow = iwindow)

In the last step you reconstruct the MS2 spectra based on the MS2 chromatographic peaks that have a high enough peak shape correlation with each MS1 chromatographic peak: ms2 <- reconstructChromPeakSpectra(xdata). Have also a look at the help page for this function to tune/adapt your settings as you like.

Hope this helps.

jorainer avatar Apr 14 '20 05:04 jorainer