Closed sdrogers closed 4 years ago
Should it be returning an empty list on line 383?
It shouldn't. It's an old unfinished code that Vinny and I forgot to complete.
What does it need for completion?
We need to test the block of codes below that return to see if they actually work.
I remember we were in a hurry doing something else at that time, so we just returned an empty kids
(line 383) as a hack to make this run -- instead of returning the kids
that are properly initialised (line 384-389).
What should they do? I know they should make a spectrum, but in what way? Pull an intact spectrum from the dataset?
I think we wanted to sample ms2 spectrum from the dataset and adjust the relative intensities of ms2 peaks in that spectrum, so it's proportional to the parent ms1 peak?
Add comments below, based on looking at the codes:
def _get_children_spectra(self, parent):
# this should hopefully sample an intact ms2 spectrum from the dataset?
spectra = self.peak_sampler.get_ms2_spectra()[0]
kids = []
# turn ms2 spectrum intensities into relative intensities
intensity_props = self._get_msn_proportions(None, None, spectra.intensities)
# randomly sample one `parent_mass_prop`
# this is the proportion of all fragment intensities in a spectra over the parent intensity
# returns number between 0 and 1
parent_mass_prop = self.peak_sampler.get_parent_intensity_proportion()
# create ms2 peaks having the right intensities??
for i in range(len(spectra.mzs)):
kid = MSN(spectra.mzs[i], spectra.ms_level, intensity_props[i], parent_mass_prop, None, parent)
kids.append(kid)
return kids
ok, so it:
It looks good to me, I'll try uncommenting and see what happens 👍
it would be good if we have another file to test the chemical generation process (it's getting quite complex now, and will be more complex in the future). Maybe can create one test_chemicals.py
next to test_controllers.py
?
yes, please do so - separate issue though
fragscan_dataset_spectra
produced empty MS2 scans. Chemical objects don't have any children. Problem is this method: https://github.com/sdrogers/vimms/blob/be48bd5c9f4db9f63cc7bd7f0b42bba7d1e339db/vimms/Chemicals.py#L378-L389 Should it be returning an empty list on line 383?At the moment, I've removed it from all tests.