rformassspectrometry / Spectra

Low level infrastructure to handle MS spectra
https://rformassspectrometry.github.io/Spectra/
34 stars 24 forks source link

Adjust precursor m/z values for MS2 spectra from Waters instruments #315

Closed jorainer closed 3 months ago

jorainer commented 3 months ago

Originally mentioned by @mar-garcia (also please udate/fix if I don't describe the problem properly).

Waters instruments inject the calibrant every x scans. Independently of the whether the data is calibrated online (during acquisition) or offline (afterwards by Waters software or Proteowizard), m/z values within spectra are correctly calibrated, but the precursor m/z of MS2 spectra is not.

The suggestion from Mar how to correct this (for DDA data):

jorainer commented 3 months ago

Maybe as a cross-check (or if no MS1 data is available), could it make sense to also check the actual fragment spectrum and check if there are fragment peaks close to the reported precursor m/z value and use one with a high intensity? - assuming that we also can detect the precursor as a fragment...

mar-garcia commented 3 months ago

Yes, it can be an option in case no MS1 data is available, but in some cases (not sure if in most of cases, but I would say that in a relevant proportion of cases...) the "risk" of not having the precursor m/z in the fragment spectrum is quiet high I would say.... (I mean, the intstrument is "completly" fragmenting the precursor), also depening on the collision energy applied I would say....

jorainer commented 3 months ago

Hey @mar-garcia , can you please test if this function works for you? You can install the package with BiocManager::install("RforMassSpectrometry/Spectra", ref = "adjust_precursor_mz") - eventually you might also need to update ProtGenerics using BiocManager::install("RforMassSpectrometry/ProtGenerics").

Assuming s is a Spectra you can adjust/estimate the precursor m/z using pmz <- estimatePrecursorMz(s) - adapting eventually also parameters tolerance and ppm.

mar-garcia commented 3 months ago

Hi! Just checked and I think it's working well! Thanks a lot!!! :)

jorainer commented 3 months ago

Closing as functionality was now added.