glasgowcompbio / vimms

A programmable and modular LC/MS simulator in Python
MIT License
19 stars 6 forks source link

Intensity at fragmentation [analysis code] #207

Closed sdrogers closed 3 years ago

sdrogers commented 3 years ago

Want to be able to find the intensity at which a particular signal was fragmented. We currently use this code to map picked peak boxes to ms2 scans: https://github.com/sdrogers/mass-spec-utils/blob/6dc3698876a98d0d66038c5096d37722c4959f06/mass_spec_utils/data_import/mzmine.py#L74-L98 This provides a pair of dictionaries: one for mapping boxes to scans, and one scans to boxes.

The scans come from a MZMLFile object, in which ms2 scans also store a reference to their previous and next ms1: https://github.com/sdrogers/mass-spec-utils/blob/6dc3698876a98d0d66038c5096d37722c4959f06/mass_spec_utils/data_import/mzml.py#L115-L181

The MZMLScan objects have a handy method for extracting the mz and intensity of a particular mz value in a scan: https://github.com/sdrogers/mass-spec-utils/blob/6dc3698876a98d0d66038c5096d37722c4959f06/mass_spec_utils/data_import/mzml.py#L66-L76

So, we need to:

  1. Run the code that matches scans to boxes as we are already in our analysis scripts.
  2. For each box, take the MS2 scan associated and use the method above to compute the precursor intensity in the previous ms1 scan. I.e. something like ms2_scan.previous_ms1.get_precursor(ms2_scan.precursor_mz) and store these for comparison between the methods.
  3. Analyse the precursor intensities to see if our new controllers give any kind of consistent drop / increase
  4. Given that the boxes are the same across the analysis (i.e. we compare all controller MS2 data with the same boxes), we could do paired tests on the boxes that say two controllers get?
  5. Taking the intensity in the previous ms1 scan is ok. We might want to do a linear interpolation between the previous and the intensity in the next, a reference to which is also scored. I suspect previous will be fine though, so suggest sticking to that.
sdrogers commented 3 years ago

We should also be careful: maybe one file just has a lower intensity than the other? Overcoming this might mean that we need to compute relative intensity at fragmentation (i.e. intensitity / max in that file) - more difficult, but do-able.

joewandy commented 3 years ago

Re. point (5), we could also pick the precursor from the nearest ms1 scan. Or maybe try all 3 above.

joewandy commented 3 years ago

Done, it's now part of the manuscript