glasgowcompbio / vimms

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

Noise in MS2 data #3

Closed sdrogers closed 4 years ago

sdrogers commented 4 years ago

Presently, no noise is added to MS2 peaks. Need to:

Check that intensity noise is added to the MS2

joewandy commented 4 years ago

The skeleton codes to add MS2 noise are already there, but we forgot to actually implement it. See https://github.com/sdrogers/vimms/blob/master/vimms/DataGenerator.py#L579-L585.

sdrogers commented 4 years ago

Thanks @joewandy -- to do comparisons between DIA and DDA I think we need to implement both (maybe; but no harm in doing it).

Can we add normal noise to both?

joewandy commented 4 years ago

Added the following commits:

Two noise classes have been added: NoPeakNoise and GaussianPeakNoise.

We can pass an instance of this noise class when initialising the Mass Spec:

        peak_noise = GaussianPeakNoise(0.1, 1000)
        mass_spec = IndependentMassSpectrometer(ionisation_mode, fragscan_dataset_peaks, fragscan_ps, peak_noise=peak_noise)

This class is then used to apply noise when generating the m/z and intensity values of a peak: https://github.com/sdrogers/vimms/blob/master/vimms/MassSpec.py#L592-L598

        noisy_mz_peaks = []
        for i in range(len(mz_peaks)):
            original_mz, original_intensity = mz_peaks[i]
            noisy_mz = self.peak_noise.get_mz(original_mz, query_rt, original_intensity, ms_level)
            noisy_intensity = self.peak_noise.get_intensity(original_mz, query_rt, original_intensity, ms_level)
            noisy_mz_peaks.append((noisy_mz, noisy_intensity))
        return noisy_mz_peaks

I think some student is supposed to improve the noise process? It can be done by improving the classes above, or making a new one.

joewandy commented 4 years ago

The noise class is further improved in issue #69.