Skip to content

fix: filter subsumable (prob=0) proteins in ProtXMLFile parser - #8960

Merged
timosachsenberg merged 11 commits into
developfrom
fix/protxml-subsumable-protein-filtering
Jul 15, 2026
Merged

timosachsenberg merged 11 commits into
developfrom
fix/protxml-subsumable-protein-filtering

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix ProtXMLFile parser to skip probability=0 ("unneeded"/subsumable) proteins during protXML parsing, preventing them from creating spurious indistinguishable groups
  • Previously, these proteins caused ProteinQuantifier to discard shared peptides (since it only uses peptides unique to a single indistinguishable group), leading to most proteins being quantified in only one TMT plex
  • Truly indistinguishable proteins (via <indistinguishable_protein> XML elements) are unaffected

Background

ProteinProphet assigns probability=0 to proteins whose peptides are fully explained by higher-probability proteins in the same <protein_group>. These are subsumable (subset) proteins — distinct from truly indistinguishable (same-set) proteins. The old parser treated both the same way, creating separate indistinguishable groups for each <protein> element. This broke ProteinQuantifier's peptide-to-leader mapping (getAccession_() returned empty / "LEADERS EMPTY"), discarding shared peptides from quantification.

This matches how other tools handle subsumable proteins:

  • FragPipe/Philosopher: filters them out; only same-set proteins appear as "Indistinguishable Proteins"
  • MaxQuant: collapses subset proteins into parent groups

Changes

  • ProtXMLFile.h: Added skip_protein_ flag + class doxygen documenting protXML parsing semantics
  • ProtXMLFile.cpp: Skip <protein> elements with probability=0 and all their children (peptides, modifications, indistinguishable_protein)
  • New test data (ProtXMLFile_input_3.protXML) with 3 test cases: leader+subsumable, indistinguishable pair, single protein
  • New test verifying correct filtering: group counts, hit counts, peptide counts

Fixes #6038
Supersedes #8416

Test plan

  • ProtXMLFile_test passes (existing + new test section)
  • CI passes on all platforms
  • Verify with real ProteinProphet protXML that subsumable proteins are skipped and ProteinQuantifier produces correct multi-plex quantification

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed ProtXML parsing for ProteinProphet-style subsumable proteins with probability=0 so they no longer generate protein hits, indistinguishable protein entries, or associated peptide evidence, preventing empty or spurious groups.
  • Documentation
    • Clarified the expected behavior for zero-probability subsumable proteins versus truly indistinguishable proteins.
  • Tests
    • Added a new ProtXML fixture and expanded assertions to validate correct filtering and expected protein group contents across multiple scenarios.

ProteinProphet assigns probability=0 to "unneeded" proteins whose peptides
are fully explained by higher-probability proteins in the same protein_group.
Previously these were parsed as separate indistinguishable groups, causing
ProteinQuantifier to discard shared peptides between the leader and these
subsumable proteins (since it only uses peptides unique to a single
indistinguishable group). This led to most proteins being quantified in
only one TMT plex instead of all plexes.

Now probability=0 <protein> elements and all their children (peptides,
indistinguishable_protein, modifications) are skipped during parsing.
This matches how FragPipe/Philosopher and MaxQuant handle subsumable
proteins. Truly indistinguishable proteins (via <indistinguishable_protein>
XML elements) are unaffected.

Fixes #6038
Supersedes #8416

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 742b4087-ae0f-403b-89e7-4a7e65dc1d99

📥 Commits

Reviewing files that changed from the base of the PR and between efc336c and 9331375.

📒 Files selected for processing (3)
  • CHANGELOG
  • src/openms/include/OpenMS/FORMAT/ProtXMLFile.h
  • src/openms/source/FORMAT/ProtXMLFile.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/openms/include/OpenMS/FORMAT/ProtXMLFile.h
  • src/openms/source/FORMAT/ProtXMLFile.cpp

📝 Walkthrough

Walkthrough

The changes filter ProteinProphet proteins with probability=0 during ProtXML parsing. Their protein hits, group entries, peptide evidence, and modifications are skipped, while valid proteins and truly indistinguishable proteins remain represented.

Changes

ProtXML zero-probability filtering

Layer / File(s) Summary
Parser state and filtering contract
src/openms/include/OpenMS/FORMAT/ProtXMLFile.h, src/openms/source/FORMAT/ProtXMLFile.cpp
Documents zero-probability protein handling, tracks parser state, skips nested content, and prevents empty protein groups.
Fixture and parser verification
src/tests/class_tests/openms/data/ProtXMLFile_input_3.protXML, src/tests/class_tests/openms/source/ProtXMLFile_test.cpp
Covers filtered proteins, preserved indistinguishable proteins, group reset behavior, protein hits, peptides, and peptide evidence.
Changelog entry
CHANGELOG
Records the ProtXML parsing fix for ProteinProphet unneeded proteins and spurious singleton groups.

Suggested reviewers: jpfeuffer

Poem

A rabbit hops through XML bright,
Zero-probability fades from sight.
True protein siblings stay in line,
Peptides sparkle, groups align,
Clean data dances beneath moonlight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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: filtering zero-probability subsumable proteins in ProtXMLFile parsing.
Linked Issues check ✅ Passed The parser now skips probability-0 proteins and their children, matching the issue's goal to prevent spurious groups and shared-peptide loss.
Out of Scope Changes check ✅ Passed The documentation, fixture, test, and changelog changes all support the ProtXML filtering fix and do not appear unrelated.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/protxml-subsumable-protein-filtering

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.

Copy link
Copy Markdown
Contributor Author

Adversarial review result: no blocking parser issue found in static review for the probability-zero ProtXML filtering.

Cleanup required before merge: the added source/test comments explicitly mention GitHub issue #6038. Please remove tracker-style issue references from comments while keeping the technical rationale. I did not build/run tests locally.

timosachsenberg and others added 6 commits June 18, 2026 14:58
Follow-up to the subsumable-protein filter:

- Guard insertProteinGroup() against accession-less groups: a protein_group
  whose <protein> elements were all probability=0 (and thus skipped) would
  otherwise be inserted empty, breaking downstream consumers that assume
  group.accessions[0] exists (e.g. TextExporter).
- Document that probability==0 covers BOTH subset and subsumable ("unneeded")
  proteins and why it is preferred over the optional, subsumable-only
  'subsuming_protein_entry' attribute.
- Downgrade the per-protein skip log from INFO to DEBUG.
- Extend the regression test: subsumable-protein-first-then-valid group (mid-
  group skip reset + indistinguishable-child guard), an all-prob=0 group (no
  empty group emitted), and a schema-valid modification_info wrapper.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Keep the full technical rationale for filtering probability=0
(subset/subsumable) proteins, but remove the GitHub issue-number
references from the header doxygen, source comment, and test comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…todo

Resolve the "document which metavalues of Protein/PeptideHit are filled"
@todo by listing exactly what the reader populates on ProteinHit
(accession, score, coverage; no meta values), PeptideHit (sequence,
score, charge, PeptideEvidence, is_unique, is_contributing meta values),
and the identification score type. Also correct the stale claim that
indistinguishable siblings get "score of -1": the reader transfers the
group leader's score to them.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@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 `@CHANGELOG`:
- Line 545: Update the CHANGELOG entry to replace the unsupported “most
proteins” impact claim with the supported wording that many proteins were
quantified in only one TMT plex; leave the filtering behavior and issue
references 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: 2bdf62c3-7ba3-48ca-8b2f-e0676cc0722b

📥 Commits

Reviewing files that changed from the base of the PR and between d7a7a5c and 2823f04.

📒 Files selected for processing (1)
  • CHANGELOG

Comment thread CHANGELOG Resolved
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Adversarial review result: no blocking parser issue found in static review for the probability-zero ProtXML filtering.

Cleanup required before merge: the added source/test comments explicitly mention...

Done — issue-tracker references were removed from comments in commit 2ee2482 (drop issue-tracker references from comments). Only the technical rationale is retained.

@copilot resolve the merge conflicts in this pull request

Merge conflicts with develop were resolved in commit 4e7764b. The branch is now up to date and the working tree is clean.

timosachsenberg and others added 2 commits July 14, 2026 15:55
…, faithful fixture

Address low-severity review findings:
- Assert surviving peptide sequences and their PeptideEvidence accessions, not
  just the count, so a regression that substitutes a skipped peptide or leaves
  stale evidence from a filtered protein can no longer pass at count 5.
- Fix the indistinguishable-group comment: without filtering the fixture yields
  8 groups (one per <protein>), not 6.
- Doxygen: indistinguishable siblings do carry a protein_name; say they have no
  probability or coverage of their own rather than "no attributes".
- Make the fixture's subsumption relationships faithful: SUB_FIRST's peptide is
  now a subset of its sibling VALID_AFTER (subsuming_protein_entry references the
  sibling id), and the all-zero group carries no subsuming_protein_entry, showing
  probability=0 alone drives filtering.

ProtXMLFile_test passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…able-protein-filtering

# Conflicts:
#	CHANGELOG
@timosachsenberg
timosachsenberg merged commit deb5d63 into develop Jul 15, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the fix/protxml-subsumable-protein-filtering branch July 15, 2026 04:16
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.

ProteinQuantifier and protein group probability

2 participants