diff --git a/metatlas/plots/dill2plots.py b/metatlas/plots/dill2plots.py index f0c1e3b3..98c18d2d 100644 --- a/metatlas/plots/dill2plots.py +++ b/metatlas/plots/dill2plots.py @@ -251,6 +251,7 @@ class adjust_rt_for_selected_compound(object): def __init__(self, data, msms_sorting_method=None, + msms_radio_buttons=None, include_lcmsruns=None, exclude_lcmsruns=None, include_groups=None, @@ -308,6 +309,7 @@ def __init__(self, logger.debug("Initializing new instance of %s.", self.__class__.__name__) self.data = data self.msms_hits, _ = sp.sort_msms_hits(msms_hits, sorting_method=msms_sorting_method) + self.msms_radio_buttons = msms_radio_buttons self.color_me = or_default(color_me, [('black', '')]) self.compound_idx = compound_idx self.width = width @@ -509,24 +511,32 @@ def display_eic_data(self): picker=True, pickradius=5, color=color, label=label) def configure_flags(self): - default_peak = ['keep', - 'remove', - 'keep, unresolvable isomers', - 'keep, poor peak shape'] - default_msms = ['no selection', + if self.msms_radio_buttons is None or self.msms_radio_buttons == 'new': + default_peak = ['keep','remove','keep, unresolvable isomers','keep, poor peak shape'] - '-1.0, poor match, should remove', - '0.0, no match or no MSMS collected', - '0.5, partial or putative match of fragments', - '1.0, good match', - - '0.5, co-isolated precursor, partial match', - '1.0, co-isolated precursor, good match', + default_msms = ['no selection', + '-1.0, poor match, should remove', + '0.0, no match or no MSMS collected', + '0.5, partial or putative match of fragments', + '1.0, good match', + '0.5, co-isolated precursor, partial match', + '1.0, co-isolated precursor, good match', + '0.5, single ion match, no evidence', + '1.0, single ion match, ISTD/ref evidence'] + elif self.msms_radio_buttons == 'old': + default_peak = ['keep','remove','unresolvable isomers','poor peak shape'] - '0.5, single ion match, no evidence', - '1.0, single ion match, ISTD/ref evidence'] - + default_msms = ['no selection', + '-1, bad match - should remove compound', + '0, no ref match available or no MSMS collected', + '0.5, partial match of fragments', + '1, perfect match to internal reference library', + '1, perfect match to external reference library', + '1, co-isolated precursor but all reference ions are in sample spectrum'] + else: + logger.warning('Unknown value for msms_radio_buttons: %s. Must use "old" or "new" or remove.', self.msms_radio_buttons) + if self.peak_flags is None or self.peak_flags == '': self.peak_flags = default_peak if self.msms_flags is None or self.msms_flags == '': diff --git a/metatlas/targeted/process.py b/metatlas/targeted/process.py index 4a36f032..4de13157 100644 --- a/metatlas/targeted/process.py +++ b/metatlas/targeted/process.py @@ -76,6 +76,7 @@ def annotation_gui( peak_flags=None, msms_flags=None, msms_sorting_method: str = None, + msms_radio_buttons: str = None, ) -> Optional[dp.adjust_rt_for_selected_compound]: """ Opens the interactive GUI for setting RT bounds and annotating peaks @@ -96,6 +97,7 @@ def annotation_gui( return dp.adjust_rt_for_selected_compound( data, msms_sorting_method=msms_sorting_method, + msms_radio_buttons=msms_radio_buttons, msms_hits=data.hits, color_me=colors, compound_idx=compound_idx, diff --git a/metatlas/tools/config.py b/metatlas/tools/config.py index b74aeadc..1c4e032d 100644 --- a/metatlas/tools/config.py +++ b/metatlas/tools/config.py @@ -120,6 +120,7 @@ class AnalysisNotebookParameters(BaseNotebookParameters): slurm_execute: bool = False clear_cache: bool = False msms_sorting_method: Optional[str] = None + msms_radio_buttons: Optional[str] = None # these are populated from the workflow's RTAlignment if None google_folder: Optional[str] = None msms_refs: Optional[Path] = None diff --git a/notebooks/reference/Targeted.ipynb b/notebooks/reference/Targeted.ipynb index 86159317..03ced611 100644 --- a/notebooks/reference/Targeted.ipynb +++ b/notebooks/reference/Targeted.ipynb @@ -198,6 +198,11 @@ "# If True, then include MSMS fragment ions in the output documents\n", "export_msms_fragment_ions = None\n", "\n", + "# One of 'old', 'new', or None. If 'old', use the old version of the\n", + "# MSMS (and MS) radio button selections in the GUI. If 'new' or None, use the \n", + "# new version of the MSMS (and MS) radio button selections in the GUI.\n", + "msms_radio_buttons = None\n", + "\n", "# Setting this to True will remove the cache of MSMS hits\n", "# if you don't see MSMS data for any of your compounds in RT adjuster GUI,\n", "# then you might want to try settings this to True. However, it will\n", @@ -318,7 +323,11 @@ "metadata": {}, "outputs": [], "source": [ - "agui = annotation_gui(data=metatlas_dataset, compound_idx=0, width=15, height=3, colors=analysis.parameters.line_colors, msms_sorting_method=analysis.parameters.msms_sorting_method)" + "agui = annotation_gui(data=metatlas_dataset, \n", + " compound_idx=0, width=15, height=3, \n", + " colors=analysis.parameters.line_colors, \n", + " msms_sorting_method=analysis.parameters.msms_sorting_method, \n", + " msms_radio_buttons=analysis.parameters.msms_radio_buttons)" ] }, {