Skip to content

fix(parquet IO): FeatureMap MetaValue + ProteinIdentification identifier parity with XML lane - #9400

Merged
timosachsenberg merged 3 commits into
OpenMS:developfrom
jonasscheid:feature/idparquet-schema-fixes
May 24, 2026
Merged

timosachsenberg merged 3 commits into
OpenMS:developfrom
jonasscheid:feature/idparquet-schema-fixes

Conversation

@jonasscheid

@jonasscheid jonasscheid commented May 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes two parquet-IO-layer gaps that prevented the mhcquant QUANT chain from producing a deliverable mzTab + tsv equivalent to the legacy XML lane (gaps surfaced by the feature/idparquet-quant-tools validation work). Both gaps are single-defense implementations where the legacy XML lane has dual defenses; this PR brings strict behavioral parity.

Fix #1 — FeatureMap-level MetaValue round-trip in parquet IO

FeatureMapArrowIO::exportToParquet previously preserved only document_id / loaded_file_path / loaded_file_type / data_processing; every other FeatureMap-level MetaValue was silently dropped on store. Most visibly: FeatureMap::setPrimaryMSRunPath (FeatureMap.cpp:415) writes its argument as a spectra_data meta-value on the FeatureMap itself, so the source-mzML paths were lost — propagating filename = "UNKNOWN" to FLUKD → ConsensusMap::ColumnHeader.filename → TextExporter MAP 0 UNKNOWN rows → MzTabExporter exit code 8 (~87% of mzTab rows dropped).

Now mirrors ConsensusMapArrowIO's existing cmap_metavalues handling: a new fmap_metavalues key in file-level Parquet metadata carries every FeatureMap-level MetaValue.

Fix #2 — ProteinIdentification identifier handling parity (load + store)

The legacy XML lane defends against duplicate run-identifier collisions with two complementary mechanisms, both previously absent from parquet:

Defense XML lane parquet lane (before) parquet lane (after)
Load-side synthesis (searchEngine + date + UniqueIdGenerator::getUniqueId()) ✅ IdXMLFile.cpp:530 ❌ ✅ synthesizeRunIdentifiers
Store-side fatal check on duplicates ✅ XMLHandler::checkUniqueIdentifiers_ ❌ ✅ checkUniqueIdentifiers (throws Exception::InvalidValue with the same message text)

Wired into the 3 parquet load entry points (PSMArrowIO::importFromParquet, FeatureMapArrowIO::importFromParquet, ConsensusMapArrowIO::importFromParquet) and the 3 corresponding store entry points. Each load entry point re-stamps every PeptideIdentification collection it owns (per-feature + unassigned for the map types; the single PSM list for .idparquet) via the new applyRunIdentifierRename helper, so pep_id ↔ prot_id linkage stays consistent after synthesis.

Test Plan

  • Class tests pass — ProteinIdentificationArrowIO_test, FeatureMapArrowIO_test, ConsensusMapArrowIO_test, PSMArrowIO_test, FileHandler_test. New sections: meta-value round-trip per map type, synthesis happy-path / edge-cases (empty search engine, invalid date, duplicate stored identifiers), and store-side checkUniqueIdentifiers throw assertion. Updated existing identifier-preservation assertions to assert the new synthesis contract (pep_id identifier equals the synthesized ProtID identifier after load).
  • New TOPP test IDRipper_4 proves Fix #2a end-to-end: a single merged .idparquet fixture whose stored run_identifier is the same TopPerc_test value across both ProtIDs (the post-Percolator merged shape from the validation memory) is ripped by IDRipper into two per-file .idparquet outputs, then remerged via IDMerger and converted to .idXML. The assertion counts <IdentificationRun> elements — must equal 2. Without Fix #2a, both loaded ProtIDs would share the same stored identifier in memory and IDMerger would collapse them to 1. Fixture regenerated via IDRipper_4_input_generate.py (pyarrow-only, no OpenMS build needed).
  • Existing TOPP_IDRipper_idparquet / TOPP_IDMerger_idparquet / TOPP_FileConverter_3[2-6] all still pass — the FuzzyDiff -whitelist "IdentificationRun date" already skips the identifier-bearing line, so the new synthesis suffix doesn't break byte-DIFF tests.
  • Backward-looking slip-pattern grep (per spec §Audits): empty output — this PR doesn't touch any store* call sites in TOPP tools.
  • Forward-looking wiring audit: synthesizeRunIdentifiers + applyRunIdentifierRename + checkUniqueIdentifiers each present in all 3 source files (PSMArrowIO, FeatureMapArrowIO, ConsensusMapArrowIO).

End-to-end re-validation: PBMC009 QUANT chain

Re-ran scripts/run_quant_chain.sh PBMC009 parquet end-to-end against a feature/idparquet-quant-tools build merged with this PR, then re-executed idparquet_quant_chain_comparison.ipynb. Pre-fix baseline (per idparquet-quant-chain memory): 4 PASS / 4 FAIL outright + 1 partial. Post-fix:

Tool Verdict Note
MapAlignerIdentification PASS trafoXML byte-identical
MapRTTransformer PASS max mzML size delta: 2 bytes
FeatureFinderIdentification PASS 2/2 raws core-equivalent
FeatureLinkerUnlabeledKD PASS 5301 vs 5301 consensus features
IDConflictResolver PASS 5301 vs 5301 consensus features
IDFilter (QUANT) PASS 5301 vs 5301 consensus features
MzTabExporter PASS parquet/legacy size 104% (was 13% pre-fix — Fix #1's spectra_data cascade fix promotes MzTabExporter from exit 8 to exit 0)
TextExporter PASS 15352 vs 15352 lines
FileConverter PASS 12/12 sub-tests of TOPP_FileConverter_32..36

9 / 9 PASS.

Open question — please sanity-check

Run identifiers differ as a suffix between lanes — each lane's UniqueIdGenerator::getUniqueId() produces distinct UIDs, but the prefix (<search_engine>_<date>_) and the in-lane pep_id ↔ prot_id linkage are consistent.

I am not 100% sure this is the right behavioral choice. My read of the design: parity-with-XML beats theoretical-correctness (deterministic identifiers across lanes would diverge parquet's load semantics from XML's, and would require touching both lanes together). The legacy XML lane has had this UniqueIdGenerator non-determinism since forever, and every tool downstream of IdXMLFile::load already pays for it. Matching that contract minimizes surprise. The long-term cleanup — making both formats deterministic — feels like a separate, larger PR.

The end-to-end QUANT chain re-validation above checks for basically identical content (counts, sums, sequences, accessions, per-feature data within numerical tolerance; the deliverable mzTab + tsv match exactly), specifically masking these UID suffixes so they don't gate the verdict. So in practice the suffix difference is invisible to downstream consumers. But it would be good to have a second pair of eyes on the design choice before this merges. Tagging @timosachsenberg for review.

Files changed

File Change
src/openms/source/FORMAT/FeatureMapArrowIO.cpp Fix #1: serializeMetaValues_ / deserializeMetaValues_ + fmap_metavalues integration. Fix #2: checkUniqueIdentifiers on store; synthesizeRunIdentifiers + applyRunIdentifierRename on load (per-feature + unassigned pep_id collections).
src/openms/source/FORMAT/ConsensusMapArrowIO.cpp Fix #2 symmetric (Fix #1 was already done in this file as cmap_metavalues — pre-existing).
src/openms/source/FORMAT/PSMArrowIO.cpp Fix #2 wired into the .idparquet top-level store and load.
src/openms/include/OpenMS/FORMAT/ProteinIdentificationArrowIO.h / .cpp Fix #2 helper definitions.
src/tests/class_tests/openms/source/{ProteinIdentificationArrowIO,FeatureMapArrowIO,ConsensusMapArrowIO,PSMArrowIO,FileHandler}_test.cpp New sections + updated identifier-preservation assertions.
src/tests/topp/CMakeLists.txt + IDRipper_4_input.idparquet/ + IDRipper_4_input_README.md + IDRipper_4_input_generate.py New TOPP test for Fix #2a end-to-end.
CHANGELOG Entries for both fixes under OpenMS 3.6.0 → General (referencing #9232 and #9242 as origin PRs).

Compatibility

  • Existing .featureparquet / .consensusparquet / .idparquet files load unchanged. Missing fmap_metavalues key (pre-fix files) → no map-level meta-values restored, matching current behavior. Stored on-disk identifiers become informational only after Fix #2a.
  • Pre-fix-generated artifacts that carry duplicate stored ProtID identifiers on disk (e.g., the validation outputs under work/quant_validation/PBMC009/parquet/ from feature/idparquet-quant-tools runs) load with an OPENMS_LOG_WARN and a documented data-loss path (one ProtID is orphaned by the rename-map collapse). Regenerating from source data clears it; Fix #2b prevents new files from entering this state.

Deferred

  • TOPP_FileConverter_37 / _38 — featureparquet / consensusparquet spectra_data round-trip TOPP-level tests. Defer until feature/idparquet-quant-tools merges (FileConverter parquet support is needed). The class tests for Fix support chromatograms [1] #1 already cover the same code path through the C++ API.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • FeatureMap metadata values are now preserved during parquet file export and import operations
    • Protein identification identifiers are now consistently regenerated during parquet import, improving data integrity
  • New Features

    • Added validation to detect and prevent duplicate protein identification identifiers before parquet export

Review Change Stack

jonasscheid and others added 3 commits May 23, 2026 22:13
…_metavalues key) so setPrimaryMSRunPath/spectra_data survives parquet store+load, mirroring ConsensusMapArrowIO's existing cmap_metavalues handling.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
…entifier handling — synthesize fresh identifier per IdXMLFile.cpp:530 on every parquet load and re-stamp owned pep_id collections (3 entry points), plus mirror XMLHandler::checkUniqueIdentifiers_ as a fatal pre-store check (3 entry points).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
…ipped .idparquet files (shared stored run_identifier) as distinct IdentificationRuns after IDMerger remerge + IDFileConverter to .idXML; plus CHANGELOG entries for both fixes.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

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

  • Jonas Scheid

Please consider applying the following patch:

--- AUTHORS	2026-05-24 07:08:20.509877596 +0000
+++ AUTHORS.new	2026-05-24 07:08:24.673477780 +0000
@@ -59,6 +59,7 @@
  - Johannes Veit
  - Johannes von Kleist
  - Johan Teleman
+ - Jonas Scheid
  - Joshua Charkow
  - Juliane Schmachtenberg
  - Julianus Pfeuffer

@timosachsenberg

Copy link
Copy Markdown
Contributor

Cool, thanks!

@timosachsenberg

Copy link
Copy Markdown
Contributor

At some point we might need to improve the uid and run identifier handling. I opened an issue as this is not part of this PR

@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR adds parquet round-trip fidelity for FeatureMap metadata and ProteinIdentification run identifiers. It introduces three new identifier-handling helpers in ProteinIdentificationArrowIO, integrates them across all parquet import/export paths to synthesize fresh identifiers on load (matching IdXML behavior) and validate uniqueness before export, adds FeatureMap MetaValue serialization via Parquet schema metadata, and updates tests to accept synthesized identifiers while validating identifier synchronization and metadata preservation.

Changes

Run Identifier Synthesis and MetaValue Preservation

Layer / File(s) Summary
ProteinIdentificationArrowIO run identifier helpers
src/openms/include/OpenMS/FORMAT/ProteinIdentificationArrowIO.h, src/openms/source/FORMAT/ProteinIdentificationArrowIO.cpp
Introduces synthesizeRunIdentifiers() to generate fresh per-ProteinIdentification identifiers (using search engine/date/UniqueIdGenerator), applyRunIdentifierRename() to propagate renames into PeptideIdentificationLists, and checkUniqueIdentifiers() to validate no duplicates exist before export.
FeatureMap MetaValue serialization
src/openms/source/FORMAT/FeatureMapArrowIO.cpp
Adds internal JSON helpers (serializeMetaValues_, deserializeMetaValues_) to round-trip FeatureMap-level meta-values including typed lists. Export writes fmap_metavalues to Parquet schema metadata; import restores those values, preserving runtime-set metadata like primary MS run path.
Parquet import/export integration
src/openms/source/FORMAT/PSMArrowIO.cpp, src/openms/source/FORMAT/FeatureMapArrowIO.cpp, src/openms/source/FORMAT/ConsensusMapArrowIO.cpp
Validates ProteinIdentification uniqueness upfront in export functions to prevent partial outputs on collision. Synthesizes fresh identifiers after import and applies renames to all peptide identification collections (per-feature/per-consensus and unassigned), replacing stored identifiers with generated ones.
Test updates for synthesized identifiers and MetaValue persistence
src/tests/class_tests/openms/source/FileHandler_test.cpp, src/tests/class_tests/openms/source/PSMArrowIO_test.cpp, src/tests/class_tests/openms/source/FeatureMapArrowIO_test.cpp, src/tests/class_tests/openms/source/ConsensusMapArrowIO_test.cpp, src/tests/class_tests/openms/source/ProteinIdentificationArrowIO_test.cpp
Replaces hard-coded stored identifier checks with assertions on synthesized (non-empty, non-stored) identifiers and verifies peptide/protein identifier synchronization. Adds new test sections for ProteinIdentificationArrowIO helpers (edge cases: empty engine, invalid datetime, duplicates) and FeatureMap MetaValue round-tripping (scalar and list types including setPrimaryMSRunPath).
IDRipper/IDMerger end-to-end test and documentation
CHANGELOG, src/tests/topp/CMakeLists.txt, src/tests/topp/IDRipper_4_input_README.md, src/tests/topp/IDRipper_4_input_generate.py
Documents MetaValue and run identifier fixes in CHANGELOG. Adds IDRipper_4 TOPP test chain (split → remerge parquet → convert to XML) with pytest-based fixture generator to validate identifier synthesis prevents stored-identifier collapse across merged parquet lanes. Includes README explaining test purpose and assertions.

Sequence Diagram(s)

The changes introduce a clear sequential flow for identifier synthesis during parquet import that benefits from visualization:

sequenceDiagram
  participant ParquetFile as Parquet File<br/>(stored identifiers)
  participant Loader as Import Function
  participant SynthHelper as synthesizeRunIdentifiers
  participant RenameHelper as applyRunIdentifierRename
  participant Memory as In-Memory Data
  ParquetFile->>Loader: Read ProteinIdentifications +<br/>PeptideIdentifications
  Loader->>SynthHelper: Pass loaded ProteinIdentification vector
  SynthHelper->>SynthHelper: For each ProtID:<br/>Generate unique ID<br/>(engine_date_uid)
  SynthHelper->>Memory: Update ProtID identifiers in-place
  SynthHelper->>RenameHelper: Return map<br/>(stored→synthesized)
  RenameHelper->>Memory: Apply rename to matching<br/>PeptideIdentifications
  RenameHelper->>Memory: Leave orphan IDs unchanged
  Memory->>Loader: Return synthesized data
  Loader->>Loader: Return to caller
Loading

Possibly related PRs

  • OpenMS/OpenMS#8774: Introduces ConsensusMapArrowIO Arrow/Parquet implementation that is directly extended by this PR to use the new ProteinIdentificationArrowIO identifier helpers for run-id uniqueness checking and synthesis.
  • OpenMS/OpenMS#8768: Adds FeatureMapArrowIO Parquet export/import API that this PR extends with MetaValue preservation and run identifier synthesis/validation.

Suggested reviewers

  • timosachsenberg
  • jpfeuffer

Poem

🐰 Hop through the IDs with newfound cheer,
MetaValues now persist, crystal clear!
Synthesized fresh on every load—
No duplicates lurk down Parquet's road. 🌲

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% 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 precisely summarizes the two main fixes: FeatureMap MetaValue preservation and ProteinIdentification identifier parity with the XML lane during Parquet I/O operations.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

@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: 2

🤖 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/FeatureMapArrowIO.cpp`:
- Around line 1843-1849: The loop only renames peptide IDs on top-level
features, but subordinate features (added by importPSMsFromArrow and after
synthesizeRunIdentifiers) retain stale run identifiers; update the code in
FeatureMapArrowIO.cpp to walk each feature's subordinate tree and call
ProteinIdentificationArrowIO::applyRunIdentifierRename(rename, ...) for every
subordinate's PeptideIdentification list as well as the top-level feature.
Implement this by adding a recursive helper or lambda (e.g.,
renamePeptideIdsRecursively) that takes a Feature reference, calls
ProteinIdentificationArrowIO::applyRunIdentifierRename(rename,
feature.getPeptideIdentifications()), then iterates feature.getSubordinates()
and recurses; invoke it for each feature in feature_map and keep the existing
call for feature_map.getUnassignedPeptideIdentifications().

In `@src/tests/class_tests/openms/source/PSMArrowIO_test.cpp`:
- Around line 84-90: The test indexes pep_ids_in[0] before verifying the
collection is non-empty; add a guard assertion for pep_ids_in (e.g.,
TEST_NOT_EQUAL or TEST_EQUAL size check) before any indexing so failures produce
a clear assertion instead of a crash—locate the block that uses pep_ids_in and
prot_ids_in (symbols: pep_ids_in, prot_ids_in, getIdentifier()) and insert a
size check for pep_ids_in immediately before
TEST_STRING_EQUAL(pep_ids_in[0].getIdentifier(), ...).
🪄 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: a1c16433-ce9f-4e69-bd7b-3256d0febed5

📥 Commits

Reviewing files that changed from the base of the PR and between 71226f9 and c12b2ca.

⛔ Files ignored due to path filters (4)
  • src/tests/topp/IDRipper_4_input.idparquet/protein_groups.parquet is excluded by !**/*.parquet
  • src/tests/topp/IDRipper_4_input.idparquet/proteins.parquet is excluded by !**/*.parquet
  • src/tests/topp/IDRipper_4_input.idparquet/psms.parquet is excluded by !**/*.parquet
  • src/tests/topp/IDRipper_4_input.idparquet/search_params.parquet is excluded by !**/*.parquet
📒 Files selected for processing (14)
  • CHANGELOG
  • src/openms/include/OpenMS/FORMAT/ProteinIdentificationArrowIO.h
  • src/openms/source/FORMAT/ConsensusMapArrowIO.cpp
  • src/openms/source/FORMAT/FeatureMapArrowIO.cpp
  • src/openms/source/FORMAT/PSMArrowIO.cpp
  • src/openms/source/FORMAT/ProteinIdentificationArrowIO.cpp
  • src/tests/class_tests/openms/source/ConsensusMapArrowIO_test.cpp
  • src/tests/class_tests/openms/source/FeatureMapArrowIO_test.cpp
  • src/tests/class_tests/openms/source/FileHandler_test.cpp
  • src/tests/class_tests/openms/source/PSMArrowIO_test.cpp
  • src/tests/class_tests/openms/source/ProteinIdentificationArrowIO_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/tests/topp/IDRipper_4_input_README.md
  • src/tests/topp/IDRipper_4_input_generate.py

Comment on lines +1843 to +1849
for (auto& feature : feature_map)
{
ProteinIdentificationArrowIO::applyRunIdentifierRename(
rename, feature.getPeptideIdentifications());
}
ProteinIdentificationArrowIO::applyRunIdentifierRename(
rename, feature_map.getUnassignedPeptideIdentifications());

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Rename subordinate-feature peptide IDs too.

Line 1843 only walks top-level features. importPSMsFromArrow() attaches peptide IDs to subordinate features recursively, so those nested PeptideIdentifications keep the stale stored run identifier after synthesizeRunIdentifiers() and no longer match the renamed ProteinIdentifications.

🔧 Suggested fix
-    for (auto& feature : feature_map)
-    {
-      ProteinIdentificationArrowIO::applyRunIdentifierRename(
-          rename, feature.getPeptideIdentifications());
-    }
+    std::function<void(Feature&)> rename_peptide_ids = [&](Feature& feature)
+    {
+      ProteinIdentificationArrowIO::applyRunIdentifierRename(
+        rename, feature.getPeptideIdentifications());
+      for (auto& subordinate : feature.getSubordinates())
+      {
+        rename_peptide_ids(subordinate);
+      }
+    };
+    for (auto& feature : feature_map)
+    {
+      rename_peptide_ids(feature);
+    }
     ProteinIdentificationArrowIO::applyRunIdentifierRename(
         rename, feature_map.getUnassignedPeptideIdentifications());
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for (auto& feature : feature_map)
{
ProteinIdentificationArrowIO::applyRunIdentifierRename(
rename, feature.getPeptideIdentifications());
}
ProteinIdentificationArrowIO::applyRunIdentifierRename(
rename, feature_map.getUnassignedPeptideIdentifications());
std::function<void(Feature&)> rename_peptide_ids = [&](Feature& feature)
{
ProteinIdentificationArrowIO::applyRunIdentifierRename(
rename, feature.getPeptideIdentifications());
for (auto& subordinate : feature.getSubordinates())
{
rename_peptide_ids(subordinate);
}
};
for (auto& feature : feature_map)
{
rename_peptide_ids(feature);
}
ProteinIdentificationArrowIO::applyRunIdentifierRename(
rename, feature_map.getUnassignedPeptideIdentifications());
🤖 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/FORMAT/FeatureMapArrowIO.cpp` around lines 1843 - 1849, The
loop only renames peptide IDs on top-level features, but subordinate features
(added by importPSMsFromArrow and after synthesizeRunIdentifiers) retain stale
run identifiers; update the code in FeatureMapArrowIO.cpp to walk each feature's
subordinate tree and call
ProteinIdentificationArrowIO::applyRunIdentifierRename(rename, ...) for every
subordinate's PeptideIdentification list as well as the top-level feature.
Implement this by adding a recursive helper or lambda (e.g.,
renamePeptideIdsRecursively) that takes a Feature reference, calls
ProteinIdentificationArrowIO::applyRunIdentifierRename(rename,
feature.getPeptideIdentifications()), then iterates feature.getSubordinates()
and recurses; invoke it for each feature in feature_map and keep the existing
call for feature_map.getUnassignedPeptideIdentifications().

Comment on lines +84 to 90
// Identifier is synthesized on load per IdXMLFile.cpp:530 parity — the stored
// "run_1" is replaced with `<search_engine>_<date>_<UniqueIdGenerator>`. The
// pep_id collection is re-stamped in lock-step so both sides agree.
TEST_NOT_EQUAL(prot_ids_in[0].getIdentifier(), "");
TEST_NOT_EQUAL(prot_ids_in[0].getIdentifier(), "run_1");
TEST_STRING_EQUAL(pep_ids_in[0].getIdentifier(), prot_ids_in[0].getIdentifier());
TEST_STRING_EQUAL(prot_ids_in[0].getSearchParameters().digestion_enzyme.getName(), "Trypsin");

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Guard pep_ids_in before indexing.

Line 89 indexes pep_ids_in[0] before asserting pep_ids_in.size(), so a regression could crash the test instead of failing with a clear assertion.

Suggested fix
   TEST_EQUAL(prot_ids_in.size(), 1);
+  TEST_EQUAL(pep_ids_in.size(), 1);
   // Identifier is synthesized on load per IdXMLFile.cpp:530 parity — the stored
   // "run_1" is replaced with `<search_engine>_<date>_<UniqueIdGenerator>`. The
   // pep_id collection is re-stamped in lock-step so both sides agree.
   TEST_NOT_EQUAL(prot_ids_in[0].getIdentifier(), "");
   TEST_NOT_EQUAL(prot_ids_in[0].getIdentifier(), "run_1");
   TEST_STRING_EQUAL(pep_ids_in[0].getIdentifier(), prot_ids_in[0].getIdentifier());
@@
-  TEST_EQUAL(pep_ids_in.size(), 1);
   TEST_EQUAL(pep_ids_in[0].getHits().size(), 1);
🤖 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/tests/class_tests/openms/source/PSMArrowIO_test.cpp` around lines 84 -
90, The test indexes pep_ids_in[0] before verifying the collection is non-empty;
add a guard assertion for pep_ids_in (e.g., TEST_NOT_EQUAL or TEST_EQUAL size
check) before any indexing so failures produce a clear assertion instead of a
crash—locate the block that uses pep_ids_in and prot_ids_in (symbols:
pep_ids_in, prot_ids_in, getIdentifier()) and insert a size check for pep_ids_in
immediately before TEST_STRING_EQUAL(pep_ids_in[0].getIdentifier(), ...).

@timosachsenberg
timosachsenberg merged commit 49d558c into OpenMS:develop May 24, 2026
40 checks passed
@github-actions github-actions Bot mentioned this pull request May 25, 2026
@github-actions github-actions Bot mentioned this pull request May 28, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jun 8, 2026
timosachsenberg pushed a commit that referenced this pull request Jun 12, 2026
FeatureMapArrowIO_test and ConsensusMapArrowIO_test assert that
exportToParquet throws Exception::InvalidValue on duplicate
ProteinIdentification run identifiers (#9400 Fix #2b), but the PSM lane
guard (PSMArrowIO.cpp) was not directly unit-tested. Add an [EXTRA]
section mirroring the sibling tests: a second ProteinIdentification
colliding on the same run identifier must be rejected before any
parquet is written.

Implements the §3 PSM-lane duplicate-id item from the OpenMS 3.6
release-testing plan (#9460).

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC
timosachsenberg added a commit that referenced this pull request Jun 14, 2026
…tion (#9500)

* test(ProForma): pin QPX/Parquet peptidoform round-trip fidelity

Add a ProFormaParser_test [EXTRA] section asserting that the exact
write/read chain QPXFile and FeatureMapArrowIO use for the peptidoform
column --
  write: ProForma::toString(fromAASequence(seq), WriteMode::CANONICAL)
  read:  ProForma::toAASequence(parse(str), ConversionPolicy::BEST_EFFORT)
-- preserves modifications across a round-trip for common UNIMOD mods
(Oxidation, Phospho, Carbamidomethyl) plus an unmodified backbone.

Mirrors the existing round-trip sections: it asserts backbone, length,
and per-position isModified() rather than exact toString (notation may
normalize), so a silently dropped modification in the Parquet/QPX lane
-- which feeds the new quant outputs -- fails at the unit level.

Implements the "ProForma fidelity through the Parquet/QPX lane" item
from the OpenMS 3.6 release-testing plan (#9460).

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC

* test(SpectrumNativeIDParser): cover Bruker TDF frame= / MS:1002818

The method-level sections only exercised scan=/MS:1000776; the parser
supports the Bruker timsTOF .d (TDF) native-ID format "frame=<F> scan=<S>"
(with optional trailing precursor=/windowGroup=/merged= tokens emitted by
the DDA/DIA-PASEF reader) but no test pinned it. Add an [EXTRA] section
asserting isNativeID() recognizes the frame= prefix, getRegExFromNativeID()
targets the scan= token, and extractScanNumber(..., "MS:1002818") returns
the scan= integer (last scan= for merged PASEF spectra).

Implements the §6 "SpectrumNativeIDParser MS:1002818/frame=" item from the
OpenMS 3.6 release-testing plan (#9460).

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC

* test(PSMArrowIO): pin store-side duplicate-identifier rejection

FeatureMapArrowIO_test and ConsensusMapArrowIO_test assert that
exportToParquet throws Exception::InvalidValue on duplicate
ProteinIdentification run identifiers (#9400 Fix #2b), but the PSM lane
guard (PSMArrowIO.cpp) was not directly unit-tested. Add an [EXTRA]
section mirroring the sibling tests: a second ProteinIdentification
colliding on the same run identifier must be rejected before any
parquet is written.

Implements the §3 PSM-lane duplicate-id item from the OpenMS 3.6
release-testing plan (#9460).

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC

* test(PSMArrowIO): clean up temp dir in duplicate-id section

Addresses a CodeRabbit review nitpick: the new duplicate-identifier
section was the only one not removing its NEW_TMP_FILE directory. Add the
same conditional File::removeDirRecursively cleanup the other sections
use, so a regression that let the export run (instead of throwing) does
not leave an .idparquet artifact behind.

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC

* test(ProForma): assert monoisotopic mass in QPX/Parquet round-trip

Per review of #9500: the per-position isModified() check confirms a
modification is still present but not its identity/mass. Add a
TEST_REAL_SIMILAR on AASequence::getMonoWeight() so a modification
silently changed to a different mass (not just dropped) also fails the
round-trip test, without depending on canonical-notation equality.

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC

---------

Co-authored-by: Claude <[email protected]>
timosachsenberg added a commit that referenced this pull request Jul 3, 2026
…le round-trip (#9460) (#9604)

* [TEST] Parquet (§3): parquet->parquet idempotency + FeatureLinker bundle round-trip (#9460)

Close the remaining §3 (native Parquet I/O) [AUTO] gaps of the OpenMS 3.6.0 pre-release testing
plan (#9460). Tests only.

- L137: FeatureMapArrowIO_test -- a parquet->parquet content-idempotency section. The existing
  sections cover memory->parquet->memory; this re-exports an imported bundle and re-imports it,
  asserting the two imported maps are field-identical (features, hulls, subordinates, metavalues,
  PSMs, protein hits/groups). The run identifier is re-synthesized on every load, so identifier
  consistency is asserted *within* each map, not the volatile run-id string across maps.

- L144: TOPP_FeatureLinkerUnlabeled_parquet -- FeatureLinker reads .featureparquet bundles and
  writes a .consensusparquet bundle (FileHandler directory dispatch beyond FileConverter). Inputs
  are converted from clean (X-free) featureXML fixtures at test time; the output is converted back
  to consensusXML and diffed against a committed reference (289 consensus features; deterministic
  under -test, transient provenance paths whitelisted).

Findings while scoping L144 (the issue's own note that the dispatch is "aspirational" is partly
correct):
- MapAligner* tools are NOT parquet-wired (valid -in/-out formats are featureXML/mzML only), so a
  MapAligner parquet cell is not yet possible.
- IDFilter reads/writes .idparquet bundle->bundle, but the idXML->idparquet write path is rejected
  ("idparquet is not allowed for storing identifications"), so an IDFilter idXML<->idparquet diff
  cell is not yet possible.
- The PSM-lane store-side duplicate-identifier assert (L142) already landed on develop (#9400),
  PSMArrowIO_test.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* [TEST] Strengthen parquet idempotency comparisons

* [TEST] FeatureMapArrowIO_test: drop cross-map run-identifier comparisons

The run identifier is re-synthesized on every importFromParquet via UniqueIdGenerator::getUniqueId() (XML-lane parity with IdXMLFile), so it is intentionally non-deterministic across independent imports. Comparing fm1 vs fm2 identifiers contradicts the test's own stated intent (assert identifier consistency *within* each map). The intra-map pep-id == prot-id checks (and all content assertions) remain.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Jul 28, 2026
8 of 11 tasks
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.

Add tool description to --write_ini output [2] support chromatograms [1]

2 participants