File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2121
2222from psm_utils import __version__
2323from psm_utils .io ._base_classes import ReaderBase , WriterBase
24- from psm_utils .io .exceptions import PSMUtilsIOException
24+ from psm_utils .io .exceptions import PSMUtilsIOException , ModificationException
2525from psm_utils .peptidoform import Peptidoform
2626from psm_utils .psm import PSM
2727from psm_utils .psm_list import PSMList
@@ -210,7 +210,15 @@ def _parse_peptidoform(
210210
211211 # Add modification labels
212212 for mod in modification_list :
213- peptide [int (mod ["location" ])] += f"[{ mod ['name' ]} ]"
213+ name = mod .get ("name" )
214+ if name and name != "unknown modification" :
215+ tag = f"[{ mod ['name' ]} ]"
216+ elif "monoisotopicMassDelta" in mod :
217+ s = mod ["monoisotopicMassDelta" ]
218+ tag = f"[{ s :+.5f} ]"
219+ else :
220+ raise ModificationException (f"Not enough information about modification: { mod } " )
221+ peptide [int (mod ["location" ])] += tag
214222
215223 # Add dashes between residues and termini, and join sequence
216224 peptide [0 ] = peptide [0 ] + "-" if peptide [0 ] else ""
You can’t perform that action at this time.
0 commit comments