Skip to content

Show unknown modifications as delta mass in peptidoform #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions psm_utils/io/mzid.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from psm_utils import __version__
from psm_utils.io._base_classes import ReaderBase, WriterBase
from psm_utils.io.exceptions import PSMUtilsIOException
from psm_utils.io.exceptions import PSMUtilsIOException, ModificationException
from psm_utils.peptidoform import Peptidoform
from psm_utils.psm import PSM
from psm_utils.psm_list import PSMList
Expand Down Expand Up @@ -189,7 +189,15 @@ def _parse_peptidoform(seq: str, modification_list: list[dict], charge: Union[in

# Add modification labels
for mod in modification_list:
peptide[int(mod["location"])] += f"[{mod['name']}]"
name = mod.get("name")
if name and name != "unknown modification":
tag = f"[{mod['name']}]"
elif "monoisotopicMassDelta" in mod:
s = mod["monoisotopicMassDelta"]
tag = f"[{s:+.5f}]"
else:
raise ModificationException(f"Not enough information about modification: {mod}")
peptide[int(mod["location"])] += tag

# Add dashes between residues and termini, and join sequence
peptide[0] = peptide[0] + "-" if peptide[0] else ""
Expand Down
Loading