Repository navigation
Remove PeptideIdentification base_name; use ProteinIdentification MS run path - #9660
Conversation
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-25 07:03:52.533734610 +0000
+++ AUTHORS.new 2026-06-25 07:03:57.944465098 +0000
@@ -25,6 +25,7 @@
- Chris Bielow
- Christian Ehrlich
- Christie Mathews
+ - Claude
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR removes ChangesPeptide run provenance migration
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/openms/source/METADATA/PeptideIdentification.cpp (1)
35-45: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winLegacy
base_namestill affects logical identity.Line 37 still delegates to
MetaInfoInterface::operator==(rhs), so peptide IDs loaded from legacy files keep comparing differently when they carry the deprecatedbase_namemeta value. That means old and new representations of the same identification will still compare/hash differently unlessConstants::UserParam::BASE_NAMEis normalized out of bothoperator==andstd::hash<PeptideIdentification>together. Based on PR objectives, legacybase_nameis supposed to remain a compatibility fallback, not part ofPeptideIdentificationidentity.🤖 Prompt for 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. In `@src/openms/source/METADATA/PeptideIdentification.cpp` around lines 35 - 45, `PeptideIdentification::operator==` still treats legacy `base_name` meta values as part of identity through `MetaInfoInterface::operator==`. Update `PeptideIdentification::operator==` to ignore or normalize `Constants::UserParam::BASE_NAME` before comparing, and make the matching `std::hash<PeptideIdentification>` logic consistent so legacy and modern objects compare/hash the same. Use the `PeptideIdentification` equality and hash implementations as the place to remove this deprecated compatibility-only field from identity.
🤖 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/topp/TextExporter.cpp`:
- Around line 797-805: The current USI setup in TextExporter uses a partially
built IdentifierMSRunMapper when IdentifierMSRunMapper::create() throws on
duplicate MS-run paths, which leaves identifier_to_msrunpath_ half-populated and
makes later getPrimaryMSRunPath() lookups unreliable. Update the add_usi path in
TextExporter so mapper construction is either completed without the reverse-map
uniqueness failure or the mapper is discarded/USI resolution is disabled on
InvalidValue; make the same fix in the other USI export locations that use the
mapper so they do not continue with a partially initialized
IdentifierMSRunMapper.
---
Outside diff comments:
In `@src/openms/source/METADATA/PeptideIdentification.cpp`:
- Around line 35-45: `PeptideIdentification::operator==` still treats legacy
`base_name` meta values as part of identity through
`MetaInfoInterface::operator==`. Update `PeptideIdentification::operator==` to
ignore or normalize `Constants::UserParam::BASE_NAME` before comparing, and make
the matching `std::hash<PeptideIdentification>` logic consistent so legacy and
modern objects compare/hash the same. Use the `PeptideIdentification` equality
and hash implementations as the place to remove this deprecated
compatibility-only field from identity.
🪄 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: d95ca42b-f9dc-45b3-a8c3-bd0536ab2ab4
📒 Files selected for processing (14)
src/openms/include/OpenMS/METADATA/PeptideIdentification.hsrc/openms/source/FORMAT/PepXMLFile.cppsrc/openms/source/METADATA/ID/IdentificationDataConverter.cppsrc/openms/source/METADATA/IdentifierMSRunMapper.cppsrc/openms/source/METADATA/PeptideIdentification.cppsrc/pyOpenMS/bindings/bind_kernel.cppsrc/tests/class_tests/openms/source/IdentifierMSRunMapper_test.cppsrc/tests/class_tests/openms/source/PeptideIdentification_test.cppsrc/tests/topp/IDFileConverter_10_output.idXMLsrc/tests/topp/IDFileConverter_16_output.idXMLsrc/tests/topp/IDFileConverter_24_output.idXMLsrc/tests/topp/IDFileConverter_2_output.idXMLsrc/tests/topp/IDFileConverter_6_output.idXMLsrc/topp/TextExporter.cpp
💤 Files with no reviewable changes (2)
- src/pyOpenMS/bindings/bind_kernel.cpp
- src/tests/class_tests/openms/source/PeptideIdentification_test.cpp
… rejecting duplicate paths Build the (unambiguous) identifier->ms-run-path forward map fully before the reverse-map duplicate-path check. Previously create() populated both maps in a single pass and threw mid-loop on the first duplicate, leaving the forward map missing every run listed after the duplicate. Callers that catch the InvalidValue and continue (TextExporter's USI export) then resolved run names from a half-populated map, so USI run names were order-dependent and could be silently dropped for later runs. Splitting into two passes makes the forward map (all that getPrimaryMSRunPath() needs) complete and order-independent even when the duplicate check throws. The success-path behavior and the thrown exception are unchanged. Adds a regression test that resolves a run listed after the duplicate. Addresses CodeRabbit review feedback on PR #9660. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_015HamPwQj6bSZbb4abqeqca
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openms/source/METADATA/IdentifierMSRunMapper.cpp (1)
44-50: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueOptional: reuse the forward map in the second pass.
The second pass re-calls
getPrimaryMSRunPath()(a copy-out) for eachprot_id, duplicating the work already done in pass one. You can iterate the just-built forward map instead, while preserving input order via the original vector if needed.♻️ Reuse forward-map entries
// Second pass: build the reverse map (ms-run-paths -> identifier), rejecting ambiguous // input where different identifiers map to the same paths. for (const auto& prot_id : prot_ids) { - StringList ms_run_paths; - prot_id.getPrimaryMSRunPath(ms_run_paths); - const std::string& identifier = prot_id.getIdentifier(); + const std::string& identifier = prot_id.getIdentifier(); + const StringList& ms_run_paths = identifier_to_msrunpath_[identifier];🤖 Prompt for 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. In `@src/openms/source/METADATA/IdentifierMSRunMapper.cpp` around lines 44 - 50, The second pass in IdentifierMSRunMapper::createMapping is recomputing ms-run paths by calling getPrimaryMSRunPath() again on each prot_id, duplicating work already done in the forward map. Rework the reverse-map build to iterate the forward-map entries produced in the first pass (or the original prot_id order if you must preserve ordering), and use those stored ms-run paths directly while keeping the ambiguity check and identifier lookup behavior unchanged.
🤖 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.
Nitpick comments:
In `@src/openms/source/METADATA/IdentifierMSRunMapper.cpp`:
- Around line 44-50: The second pass in IdentifierMSRunMapper::createMapping is
recomputing ms-run paths by calling getPrimaryMSRunPath() again on each prot_id,
duplicating work already done in the forward map. Rework the reverse-map build
to iterate the forward-map entries produced in the first pass (or the original
prot_id order if you must preserve ordering), and use those stored ms-run paths
directly while keeping the ambiguity check and identifier lookup behavior
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4d349633-7237-4fe7-93da-28e706107121
📒 Files selected for processing (2)
src/openms/source/METADATA/IdentifierMSRunMapper.cppsrc/tests/class_tests/openms/source/IdentifierMSRunMapper_test.cpp
… rejecting duplicate paths Build the (unambiguous) identifier->ms-run-path forward map fully before the reverse-map duplicate-path check. Previously create() populated both maps in a single pass and threw mid-loop on the first duplicate, leaving the forward map missing every run listed after the duplicate. Callers that catch the InvalidValue and continue (TextExporter's USI export) then resolved run names from a half-populated map, so USI run names were order-dependent and could be silently dropped for later runs. Splitting into two passes makes the forward map (all that getPrimaryMSRunPath() needs) complete and order-independent even when the duplicate check throws. The success-path behavior and the thrown exception are unchanged. Adds a regression test that resolves a run listed after the duplicate. Addresses CodeRabbit review feedback on PR #9660. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_015HamPwQj6bSZbb4abqeqca
777ca68 to
36df19e
Compare
…run path The per-PeptideIdentification "base_name" annotation (and its get/setBaseName accessors) duplicated, at the spectrum level, the source-file information that the run-level mechanism already models: ProteinIdentification's primary MS run path (spectra_data) + the shared identifier + id_merge_index, resolved via IdentifierMSRunMapper. This removes base_name and routes everything through the run-level mechanism. Changes: - PeptideIdentification: remove get/setBaseName() and the redundant base_name comparison in operator== (still covered by MetaInfoInterface) and empty(). - PepXMLFile reader: record the source run on the ProteinIdentification via setPrimaryMSRunPath(base_name) in search_summary, instead of stamping base_name on every PeptideIdentification. Also drops dead code in msms_run_summary that set the primary MS run path on a local copy (a latent bug: the path never reached the stored ProteinIdentification). - IdentifierMSRunMapper::getPrimaryMSRunPath(): add a backward-compatibility fallback that honors a legacy "base_name" meta value when the mapping cannot resolve a path (older idXML/parquet files). - IdentificationDataConverter: keep preferring a legacy base_name meta value (read directly) before falling back to input_file_refs/id_merge_index. - TextExporter: resolve USI run names via IdentifierMSRunMapper instead of PeptideIdentification::getBaseName() (USI output unchanged). - pyOpenMS: drop the get/setBaseName bindings. - Tests: drop the get/setBaseName sections, add an IdentifierMSRunMapper legacy fallback test, and update the 5 IDFileConverter golden idXML outputs (base_name on peptides -> spectra_data on the run). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_013bKgkE6UgStKaw5cLQ2ERP
… rejecting duplicate paths Build the (unambiguous) identifier->ms-run-path forward map fully before the reverse-map duplicate-path check. Previously create() populated both maps in a single pass and threw mid-loop on the first duplicate, leaving the forward map missing every run listed after the duplicate. Callers that catch the InvalidValue and continue (TextExporter's USI export) then resolved run names from a half-populated map, so USI run names were order-dependent and could be silently dropped for later runs. Splitting into two passes makes the forward map (all that getPrimaryMSRunPath() needs) complete and order-independent even when the duplicate check throws. The success-path behavior and the thrown exception are unchanged. Adds a regression test that resolves a run listed after the duplicate. Addresses CodeRabbit review feedback on PR #9660. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_015HamPwQj6bSZbb4abqeqca
PepXMLFile no longer stamps the per-spectrum "base_name" meta value on
PeptideIdentifications (it records the source run on the ProteinIdentification's
primary MS run path instead). CometAdapter reads Comet's results exclusively via
PepXMLFile (the only loader in its flow; the subsequent reindex / IM / FAIMS /
native-id steps never add base_name), so the explicit removeMetaValue("base_name")
loop no longer removes anything - it is a no-op. Drop it.
Output is unchanged: the CometAdapter golden idXML references carry zero
base_name UserParams (this loop used to strip the value the reader added), so
the THIRDPARTY CometAdapter tests remain byte-identical.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_015HamPwQj6bSZbb4abqeqca
36df19e to
6ac0b94
Compare
|
I think it's a step in the right direction. I think ideally there is still room for improvement. I guess by restructuring the relationship between peptides and proteins and runs but that would of course be a larger change. |
|
Yeah for now I just wanted to reduce the many ways of referencing the source files |
The reader recorded the <search_summary> base_name as the ProteinIdentification's primary MS run path. That value is sometimes the identification result file (e.g. a .pep.xml), not the spectra - so spectra_data could end up holding a non-spectra path. Compose the run path from the <msms_run_summary> base_name + raw_data extension (the actual mzML/mzXML) instead, and fall back to the search_summary base_name only when the run summary has none (e.g. Mascot exports, where msms_run_summary base_name is empty). Regenerates the 4 affected IDFileConverter golden idXMLs (2, 10, 16, 24); IDFileConverter_6 is unchanged (empty msms_run_summary base_name -> fallback). Adapters that read pepXML (CometAdapter, MSFraggerAdapter) overwrite spectra_data with their real mzML input, so their outputs are unaffected. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_013bKgkE6UgStKaw5cLQ2ERP
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/openms/source/FORMAT/PepXMLFile.cpp`:
- Around line 1132-1140: The fallback ProteinIdentification created in the
PepXML parsing path currently does not retain the run-level spectra provenance
when search_summary is missing. Update the fallback branch in PepXMLFile::load
so the newly created ProteinIdentification also gets the PrimaryMSRunPath
assigned from the current run/file context before pushing it into proteins_, and
keep the existing search_summary handling as an override when present.
🪄 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: 9525bfd1-0d12-46f6-bd78-eeff2b4b5be3
📒 Files selected for processing (16)
src/openms/include/OpenMS/FORMAT/PepXMLFile.hsrc/openms/include/OpenMS/METADATA/PeptideIdentification.hsrc/openms/source/FORMAT/PepXMLFile.cppsrc/openms/source/METADATA/ID/IdentificationDataConverter.cppsrc/openms/source/METADATA/IdentifierMSRunMapper.cppsrc/openms/source/METADATA/PeptideIdentification.cppsrc/pyOpenMS/bindings/bind_kernel.cppsrc/tests/class_tests/openms/source/IdentifierMSRunMapper_test.cppsrc/tests/class_tests/openms/source/PeptideIdentification_test.cppsrc/tests/topp/IDFileConverter_10_output.idXMLsrc/tests/topp/IDFileConverter_16_output.idXMLsrc/tests/topp/IDFileConverter_24_output.idXMLsrc/tests/topp/IDFileConverter_2_output.idXMLsrc/tests/topp/IDFileConverter_6_output.idXMLsrc/topp/CometAdapter.cppsrc/topp/TextExporter.cpp
💤 Files with no reviewable changes (3)
- src/topp/CometAdapter.cpp
- src/pyOpenMS/bindings/bind_kernel.cpp
- src/tests/class_tests/openms/source/PeptideIdentification_test.cpp
🚧 Files skipped from review as they are similar to previous changes (10)
- src/topp/TextExporter.cpp
- src/tests/topp/IDFileConverter_6_output.idXML
- src/tests/topp/IDFileConverter_16_output.idXML
- src/openms/include/OpenMS/METADATA/PeptideIdentification.h
- src/openms/source/METADATA/ID/IdentificationDataConverter.cpp
- src/tests/class_tests/openms/source/IdentifierMSRunMapper_test.cpp
- src/tests/topp/IDFileConverter_10_output.idXML
- src/tests/topp/IDFileConverter_24_output.idXML
- src/openms/source/METADATA/IdentifierMSRunMapper.cpp
- src/openms/source/METADATA/PeptideIdentification.cpp
The previous commit assigned the ProteinIdentification's primary MS run path only in the "search_summary" handler. pepXML files without a "search_summary" (the reader explicitly creates a fallback ProteinIdentification for that case) would therefore lose run-level spectra provenance. Set the primary MS run path on the fallback ProteinIdentification in "msms_run_summary" (from base_name + raw_data); "search_summary" still fills it in when msms_run_summary had none (Mascot). Golden outputs are unchanged: all IDFileConverter pepXML fixtures contain a search_summary, so the run path is already set before search_summary runs and its existing-value guard skips re-assignment. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_013bKgkE6UgStKaw5cLQ2ERP
Three recently merged PRs landed on develop without changelog coverage: the PeptideIdentification::base_name removal (breaking API change routed through the run-level primary MS run path) and the two QPX Parquet streaming-export performance fixes (PSM export in #9697, feature export in #9698) that bound peak memory for large isobaric-labeling runs. Claude-Session: https://claude.ai/code/session_0167xb6udbdqvWLcUsNeZf4r Co-authored-by: Claude <[email protected]>
Motivation
PeptideIdentification::getBaseName()/setBaseName()stored the source-fileannotation per spectrum as a
base_namemeta value. This duplicated, at thespectrum level, what the run-level mechanism already models authoritatively:
ProteinIdentification's primary MS run path (spectra_data) + the sharedidentifier +
id_merge_index, resolved throughIdentifierMSRunMapper.This PR removes
base_nameand the accessors, and routes everything through therun-level mechanism.
Changes
PeptideIdentification: removeget/setBaseName(). The redundantgetBaseName()term is dropped fromoperator==(still compared viaMetaInfoInterface, so equality/hash semantics are unchanged) and fromempty().PepXMLFilereader: record the source run on theProteinIdentificationvia
setPrimaryMSRunPath(<search_summary base_name>)instead of stampingbase_nameon everyPeptideIdentification. This also removes dead code inmsms_run_summarythat set the primary MS run path on a local copy — alatent bug where the path never reached the stored
ProteinIdentification(so pepXML conversions never actually populated
spectra_data).IdentifierMSRunMapper::getPrimaryMSRunPath(): add a single,centralized backward-compatibility fallback — when the mapping cannot resolve
a path, honor a legacy
base_namemeta value if present. This keeps oldidXML/parquet files (which carry
base_nameas a genericUserParam)resolving to a source run.
IdentificationDataConverter: unchanged behavior — keep preferring alegacy
base_namemeta value (now read directly) before falling back toinput_file_refs/id_merge_index.TextExporter: resolve USI run names viaIdentifierMSRunMapperratherthan
getBaseName(). Output is unchanged (USI::extractBasenameyields thesame run name from the resolved path as it did from
base_name).get/setBaseNamebindings.Backward compatibility
base_namevalue is preserved on disk for existing files (it remainsa generic
UserParam); only the typed accessors and the per-spectrumproduction of it go away. Old files still resolve their source run through
the fallback above.
Constants::UserParam::BASE_NAMEis intentionally retained (used by thefallbacks).
Breaking change
PeptideIdentification::get/setBaseName()and thecorresponding pyOpenMS methods are removed.
Tests
get/setBaseNamesections inPeptideIdentification_test.IdentifierMSRunMappertest for the legacybase_namefallback.IDFileConverter_*_output.idXMLgolden files:base_nameonpeptides →
spectra_dataon the run (values verified per run against thereader's
search_summarybase_name and the idXML writer's stringList format).🤖 Generated with Claude Code
https://claude.ai/code/session_013bKgkE6UgStKaw5cLQ2ERP
Generated by Claude Code
Summary by CodeRabbit
BASE_NAMEonly when primary mapping is unavailable.base_nameaccessors from the public API and Python bindings;experimentLabelis used instead.