glasgowcompbio / vimms

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

Cutoff parameterisation in Gaussian Chromatogram #192

Open sdrogers opened 4 years ago

sdrogers commented 4 years ago

We currently have this: https://github.com/sdrogers/vimms/blob/df473d640a0b02f547e0150ba234da62e438c665/vimms/Chromatograms.py#L136

When we make GaussianChromatograms here: https://github.com/sdrogers/vimms/blob/df473d640a0b02f547e0150ba234da62e438c665/vimms/ChemicalSamplers.py#L300 We pass 0 as the mean and sigma as the sd.

Our chemical RTs are the start of the chromatogram, right?

Anyway, the cutoff is defined as a function of the ppf of the normal. This doesn't quite make sense, as it should be defined as the point at which the chromatogram disappears beneath the sea of noise. For example, here is the start of a group of isotopes of the same chemical in @mcbrider5002 data:

Screenshot 2020-10-09 at 09 15 28

They all start at the same point as we'd expect from our code, but in reality we would see the most intense starting earliest. It also means that for really intense peaks we see steps as they start.

Would it be possible to make the cutoff a function of intensity? This wouldn't necessarily need to change in the FunctionalChrmoatogram because we pass the cutoff to that, and the GaussianChromatogramSampler has the intensity in its sample method:

https://github.com/sdrogers/vimms/blob/df473d640a0b02f547e0150ba234da62e438c665/vimms/ChemicalSamplers.py#L283-L300

Any thoughts on the best way to achieve this? I.e. we want a cutoff such that the peak is effectively narrower when it has lower intensity...

We actually just return the un-normalised part of the Gaussian: https://github.com/sdrogers/vimms/blob/df473d640a0b02f547e0150ba234da62e438c665/vimms/Chromatograms.py#L156

This is all made a bit trickier by us defining the RT as the start of the peak, and not the, for the Gaussian ones, as the mean. Don't know how easy that would be to change?

joewandy commented 2 years ago

Is it easy to do @vinnydavies? Can we close this?

vinnydavies commented 2 years ago

Should be pretty each to do. Need to do the following