Skip to content

[FORMAT] Handle mzIdentML modifications without the optional 'location' attribute (#5443) - #9761

Merged
timosachsenberg merged 4 commits into
developfrom
claude/openms-issue-5443-scm0l4
Jul 19, 2026
Merged

timosachsenberg merged 4 commits into
developfrom
claude/openms-issue-5443-scm0l4

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • 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

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a crash when parsing mzIdentML where <Modification> entries omit the optional location.
    • When the modification is terminal-eligible, the reader infers N- or C-terminal placement from terminal specificity.
    • If placement can’t be uniquely determined (including residue-specific modifications lacking location), the reader skips that modification and logs a warning.
  • Tests
    • Added a new mzIdentML fixture and an end-to-end test covering inferred, skipped, and explicitly located modifications.

claude added 2 commits July 19, 2026 11:44
…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
@github-actions

Copy link
Copy Markdown
Contributor

@timosachsenberg The following names might be missing from the AUTHORS file:

  • Claude

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

@coderabbitai

coderabbitai Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f4909929-0798-4c6f-a671-73f8dddca10b

📥 Commits

Reviewing files that changed from the base of the PR and between 6f174ba and 82a78a4.

📒 Files selected for processing (1)
  • CHANGELOG

📝 Walkthrough

Walkthrough

The mzIdentML reader now handles modifications without location by inferring supported terminal positions or skipping unresolved cases. A fixture and regression test cover terminal inference, ambiguous modifications, residue-specific modifications, explicit locations, and successful parsing.

Changes

mzIdentML modification location handling

Layer / File(s) Summary
Parser inference and safe modification handling
src/openms/include/OpenMS/FORMAT/HANDLERS/MzIdentMLDOMHandler.h, src/openms/source/FORMAT/HANDLERS/MzIdentMLDOMHandler.cpp, CHANGELOG
Adds terminal-location inference through ModificationsDB, validates missing or invalid locations, and skips modifications when no unique position can be determined.
Missing-location regression coverage
src/tests/class_tests/openms/data/MzIdentMLFile_missing_mod_location.mzid, src/tests/class_tests/openms/source/MzIdentMLFile_test.cpp
Adds mzIdentML cases and assertions for inferred terminal modifications, skipped ambiguous or residue-specific modifications, explicit locations, and successful loading.

Possibly related issues

Poem

I’m a rabbit with peptides to spare,
Termini now land with careful care.
Missing spots no longer crash the show,
Unclear mods politely say “no.”
Tests hop bright through every case—
Carrots and parsing share this place!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: handling mzIdentML modifications when the optional location attribute is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/openms-issue-5443-scm0l4

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3c2d585 and 65ca605.

📒 Files selected for processing (5)
  • CHANGELOG
  • src/openms/include/OpenMS/FORMAT/HANDLERS/MzIdentMLDOMHandler.h
  • src/openms/source/FORMAT/HANDLERS/MzIdentMLDOMHandler.cpp
  • src/tests/class_tests/openms/data/MzIdentMLFile_missing_mod_location.mzid
  • src/tests/class_tests/openms/source/MzIdentMLFile_test.cpp

timosachsenberg and others added 2 commits July 19, 2026 16:21
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@timosachsenberg
timosachsenberg merged commit 65a639f into develop Jul 19, 2026
7 checks passed
@timosachsenberg
timosachsenberg deleted the claude/openms-issue-5443-scm0l4 branch July 19, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants