Repository navigation
[FORMAT] Handle mzIdentML modifications without the optional 'location' attribute (#5443) - #9761
Conversation
…n' attribute (#5443) The 'location' attribute of a <Modification> is optional in the mzIdentML schema. Some search engines (e.g. Philosopher) drop it for terminal modifications such as N-terminal acetylation. MzIdentMLDOMHandler kept the uninitialized sentinel index (-2) in that case and passed it on to AASequence::setModification()/getResidue(), which crashed the reader (and therefore IDFileConverter/FileHandler) with an IndexOverflow exception. parsePeptideSiblings_() now treats a missing, unreadable or out-of-range 'location' as "unknown position" and calls the new helper inferModificationLocation_() to recover the intended terminus from the modification's terminal specificity in the ModificationsDB: - modifications that support an N-terminus are placed there (the common dropped-location case, e.g. Acetyl); - exclusively C-terminal modifications (e.g. Amidated) are placed at the C-terminus; - modifications that may also occur internally (e.g. Oxidation) have a genuinely unknown position and are skipped with a warning instead of being crashed on or misplaced. Adds MzIdentMLFile_missing_mod_location.mzid and a MzIdentMLFile regression test covering the N-terminal, C-terminal, skipped and normal cases. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_013vqBNxmoQ3ATvZdqXrGF9K
…ete residue (#5443) Validation against real HUPO-PSI Mascot mzIdentML (Mascot_MSMS_example, 55merge_mascot_full) showed that "prefer N-terminus" alone would misplace real internal modifications onto the N-terminus if their location were ever dropped (397/954), whereas all real terminal modifications carry no 'residues' attribute and all real internal ones carry residues="<AA>". inferModificationLocation_ now returns -1 (skip) when the <Modification> names a concrete 'residues' amino acid (anything other than absent/empty/"."): such a modification is residue-specific and its exact position is unknown without 'location', so it must not be forced onto a terminus. Terminal modifications (residues="." or absent) still go through terminal-specificity inference. On the real files this keeps all 27 genuine N-terminal modifications correctly placed while turning the 397 potential misplacements into safe skips (0 wrong placements). Adds a regression peptide (Acetyl, no location, residues="K") that must be skipped rather than placed N-terminal. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_013vqBNxmoQ3ATvZdqXrGF9K
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-07-19 12:44:02.729503580 +0000
+++ AUTHORS.new 2026-07-19 12:44:08.698174753 +0000
@@ -27,6 +27,7 @@
- Chris Bielow
- Christian Ehrlich
- Christie Mathews
+ - Claude
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe mzIdentML reader now handles modifications without ChangesmzIdentML modification location handling
Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tests/class_tests/openms/source/MzIdentMLFile_test.cpp`:
- Around line 133-158: Replace boolean TEST_EQUAL assertions in the affected
sequence checks with TEST_TRUE or TEST_FALSE as appropriate, including
hasNTerminalModification(), hasCTerminalModification(), and isModified()
assertions. Keep string and other non-boolean TEST_EQUAL assertions unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2e7f988b-a5aa-4210-aa64-a1681b867c9c
📒 Files selected for processing (5)
CHANGELOGsrc/openms/include/OpenMS/FORMAT/HANDLERS/MzIdentMLDOMHandler.hsrc/openms/source/FORMAT/HANDLERS/MzIdentMLDOMHandler.cppsrc/tests/class_tests/openms/data/MzIdentMLFile_missing_mod_location.mzidsrc/tests/class_tests/openms/source/MzIdentMLFile_test.cpp
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
The 'location' attribute of a is optional in the mzIdentML
schema. Some search engines (e.g. Philosopher) drop it for terminal
modifications such as N-terminal acetylation. MzIdentMLDOMHandler kept the
uninitialized sentinel index (-2) in that case and passed it on to
AASequence::setModification()/getResidue(), which crashed the reader (and
therefore IDFileConverter/FileHandler) with an IndexOverflow exception.
parsePeptideSiblings_() now treats a missing, unreadable or out-of-range
'location' as "unknown position" and calls the new helper
inferModificationLocation_() to recover the intended terminus from the
modification's terminal specificity in the ModificationsDB:
dropped-location case, e.g. Acetyl);
C-terminus;
genuinely unknown position and are skipped with a warning instead of
being crashed on or misplaced.
Adds MzIdentMLFile_missing_mod_location.mzid and a MzIdentMLFile regression
test covering the N-terminal, C-terminal, skipped and normal cases.
Co-Authored-By: Claude Opus 4.8 [email protected]
Claude-Session: https://claude.ai/code/session_013vqBNxmoQ3ATvZdqXrGF9K
Summary by CodeRabbit
<Modification>entries omit the optionallocation.location), the reader skips that modification and logs a warning.