sneumann / xcms

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

Aligning MS1 only with MS/MS chromatograms results in negative adjusted retention times #568

Closed wmoldham closed 3 years ago

wmoldham commented 3 years ago

I collected MS1 spectra on a Thermo Q Exactive in positive/negative polarity switching mode. I subsequently collected MS/MS (top 10 DDA) on the QC sample run separately in either positive or negative polarity mode. The spectra were centroided using ProteoWizard and saved as .mzML files. I used the following script to preprocess the chromatograms.

library(xcms)

files <- list.files(pattern = "*.mzML", full.names = TRUE)
raw <- readMSData(files = files, mode = "onDisk") |> filterRt(c(100, 300))
bpis <- chromatogram(raw, aggregationFun = "max")
plot(bpis, col = c("darkblue", "darkred"))

Dark blue is from the MS/MS run and dark red is the MS1 run:

base_peak

cwp <- CentWaveParam(ppm = 2.5, peakwidth = c(15, 500), prefilter = c(3, 4500), mzdiff = -0.02, noise = 1000)
peaks <- findChromPeaks(raw, cwp)
mnp <- MergeNeighboringPeaksParam(expandRt = 4, ppm = 2.5)
merged <- refineChromPeaks(peaks, mnp)
obi <- ObiwarpParam(centerSample = 2)
aligned <- adjustRtime(merged, obi)
plotAdjustedRtime(aligned, col = c("darkblue", "darkred"))

This yields the negative adjusted retention times as shown here.

negative_rtime

An alternate view:

raw_adjust

When I use the MS/MS file as the center sample, it yields this pattern.

obi_2 <- ObiwarpParam(centerSample = 1)
aligned_2 <- adjustRtime(merged, obi_2)
plotAdjustedRtime(aligned_2, col = c("darkblue", "darkred"))

positive_rtime

I included the filterRt() step above because (1) I am also filtering the raw data files based on retention time and (2) to keep the run time short. If I exclude this step, it doesn't seem to make a difference.

I noticed the issue as I was pulling MS2 spectra using the m/z from peaks-of-interest from the MS1 chromatograms and found that the retention times weren't matching up. I appreciate any advice on how to either remedy or work around the alignment issue. I'm also happy to provide the .mzML files themselves, but wasn't sure the best way to share them.

jorainer commented 3 years ago

Now this is really an unexpected behaviour - but to be honest I'm not a strong believer into the obiwarp method myself mostly because I find it difficult to adapt the settings properly. Have you tried to use the peak density method instead?

Another complication (maybe problematic to obiwarp) could be that I assume you will have less scans in the MS/MS file compared to the MS1 file alone (i.e. the MS1 file will have more data points/retention times). Also, you did separate the MS1 data into an mzML for positive and one for negative mode?

wmoldham commented 3 years ago

Thank you for that suggestion. Apologies that I did not think of it myself. I just looked at this:

pdp <- PeakDensityParam(sampleGroups = c(1, 1), bw = 30, minFraction = 1, minSamples = 1)
grouped <- groupChromPeaks(merged, pdp)
fgp <- PeakGroupsParam()
aligned_3 <- adjustRtime(grouped, fgp)
plotAdjustedRtime(aligned_3, col = c("darkblue", "darkred"))

peak-density

And that seems to work better than the obiwarp approach.

Surprisingly, there seem to be more MS1 spectra in the MS/MS file (628) than the MS1 file (169) over this time range. I suspect that the dynamic exclusion settings are limiting the number of MS2 spectra (only 169) such that the duty cycle is not as long as anticipated? I confirm that the MS1 data from polarity switching mode were centroided into separate mzML files. Thank you, again, for this suggestion which resolves my issue and more generally for your responsiveness and tireless work on these fantastic tools.

jorainer commented 3 years ago

thanks for the feedback!