From 317fbcca9a9e9dac7b06879e5c38b2346a2afc8d Mon Sep 17 00:00:00 2001 From: WassimG Date: Tue, 24 Sep 2024 09:43:04 +0000 Subject: [PATCH] Annotate only ptm nl peaks --- spectrum_fundamentals/constants.py | 2 ++ spectrum_fundamentals/fragments.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/spectrum_fundamentals/constants.py b/spectrum_fundamentals/constants.py index ded561c..68f1942 100644 --- a/spectrum_fundamentals/constants.py +++ b/spectrum_fundamentals/constants.py @@ -335,6 +335,8 @@ "H3O4P": (ATOM_MASSES["H"] * 3) + (ATOM_MASSES["O"] * 4) + ATOM_MASSES["P"], } +Unimod_Neutral_losses = {7: ["CHNO"], 21: ["H3O4P"]} + ####################################### # HELPERS FOR FRAGMENT MZ CALCULATION # ####################################### diff --git a/spectrum_fundamentals/fragments.py b/spectrum_fundamentals/fragments.py index 6af620f..accd118 100644 --- a/spectrum_fundamentals/fragments.py +++ b/spectrum_fundamentals/fragments.py @@ -175,24 +175,24 @@ def _get_neutral_losses(peptide_sequence, modifications): aa = peptide_sequence[i] if aa in c.AA_Neutral_losses: if i in modifications: - if aa == "M" and modifications[i] == 15.9949146: + """if aa == "M" and modifications[i] == 15.9949146: nl_b_ions = _add_nl(c.AA_Neutral_losses["M[UNIMOD:35]"], nl_b_ions, i, sequence_length - 1) nl_y_ions = _add_nl( c.AA_Neutral_losses["M[UNIMOD:35]"], nl_y_ions, sequence_length - i - 1, sequence_length - 1 - ) - elif aa == "R" and modifications[i] == 0.984016: + )""" + if aa == "R" and modifications[i] == 0.984016: nl_b_ions = _add_nl(c.Mod_Neutral_losses["R[UNIMOD:7]"], nl_b_ions, i, sequence_length - 1) nl_y_ions = _add_nl( c.Mod_Neutral_losses["R[UNIMOD:7]"], nl_y_ions, sequence_length - i - 1, sequence_length - 1 ) - elif (aa == "S" or aa == "T") and modifications[i] == 79.9663: - nl_b_ions = _add_nl(c.Mod_Neutral_losses["R[UNIMOD:7]"], nl_b_ions, i, sequence_length - 1) + elif (aa == "S" or aa == "T") and modifications[i] == 79.966331: + nl_b_ions = _add_nl(c.Mod_Neutral_losses["S[UNIMOD:21]"], nl_b_ions, i, sequence_length - 1) nl_y_ions = _add_nl( - c.Mod_Neutral_losses["R[UNIMOD:7]"], nl_y_ions, sequence_length - i - 1, sequence_length - 1 + c.Mod_Neutral_losses["S[UNIMOD:21]"], nl_y_ions, sequence_length - i - 1, sequence_length - 1 ) - else: + """else: nl_b_ions = _add_nl(c.AA_Neutral_losses[aa], nl_b_ions, i, sequence_length - 1) - nl_y_ions = _add_nl(c.AA_Neutral_losses[aa], nl_y_ions, sequence_length - i - 1, sequence_length - 1) + nl_y_ions = _add_nl(c.AA_Neutral_losses[aa], nl_y_ions, sequence_length - i - 1, sequence_length - 1)""" return nl_b_ions, nl_y_ions