Skip to content

feat(FileHandler): add FEATUREPARQUET and CONSENSUSPARQUET file types - #9242

Merged
timosachsenberg merged 4 commits into
OpenMS:developfrom
timosachsenberg:feat/featureparquet-consensusparquet-filehandler
Apr 29, 2026
Merged

timosachsenberg merged 4 commits into
OpenMS:developfrom
timosachsenberg:feat/featureparquet-consensusparquet-filehandler

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Register two new directory-shaped file types — FEATUREPARQUET (.featureparquet) and CONSENSUSPARQUET (.consensusparquet) — alongside the existing IDPARQUET, with PROVIDES_FEATURES / PROVIDES_CONSENSUSFEATURES (+ PROVIDES_IDENTIFICATIONS, READABLE, WRITEABLE) properties.
  • Wire FileHandler::loadFeatures / storeFeatures and loadConsensusFeatures / storeConsensusFeatures to dispatch the new types to the existing FeatureMapArrowIO::importFromParquet / exportToParquet and ConsensusMapArrowIO::importFromParquet / exportToParquet (same pattern as IDPARQUET → PSMArrowIO: ParseError on read failure, UnableToCreateFile on write failure).
  • Tools that already go through FileHandler (FileInfo, FileConverter, ProteomicsLFQ, etc.) now accept and emit feature/consensus parquet bundles based on the directory suffix; the on-disk bundle layout itself is unchanged.

The directory's outer extension is the FileType discriminator. Bundle contents stay as-is: features.parquet/consensus_features.parquet plus the four ID-side parquet files (psms, proteins, protein_groups, search_params).

Test plan

  • FileTypes_test — name↔type round-trip and isDirectoryType for both new types; updated hardcoded type counts in typesWithProperties (45→47, 68→70).
  • FileHandler_test — added two round-trip sections that storeFeatures/loadFeatures against *.featureparquet and storeConsensusFeatures/loadConsensusFeatures against *.consensusparquet, verifying RT/MZ/intensity/charge/quality survive the trip.
  • cmake --build OpenMS-build --target OpenMS clean.
  • ctest -R '^FileTypes_test\$|^FileHandler_test\$' — 2/2 pass.
  • CI

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added two Parquet-backed directory file formats for feature and consensus data and enabled their read/write support.
  • Tests
    • Added comprehensive round-trip tests for Parquet feature and consensus persistence (real and synthetic), validating numeric fields, identifiers, sidecar links, and metadata consistency.

Wires FeatureMapArrowIO and ConsensusMapArrowIO into FileTypes /
FileHandler so feature/consensus parquet directory bundles are
discoverable via extension and round-trip through the standard
load/store entry points (parallel to the existing IDPARQUET handling).

- FileTypes: register FEATUREPARQUET (.featureparquet) and
  CONSENSUSPARQUET (.consensusparquet) as directory-shaped types with
  PROVIDES_FEATURES / PROVIDES_CONSENSUSFEATURES (+ PROVIDES_IDENTIFICATIONS,
  READABLE, WRITEABLE); extend isDirectoryType() accordingly.
- FileHandler::loadFeatures / storeFeatures and
  loadConsensusFeatures / storeConsensusFeatures dispatch the new types
  to *ArrowIO::importFromParquet / exportToParquet, mirroring the
  IDPARQUET pattern (ParseError on read failure, UnableToCreateFile on
  write failure).
- Tests: extend FileTypes_test for name<->type and isDirectoryType
  checks; add FileHandler_test round-trip sections for both new types.
@coderabbitai

coderabbitai Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

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: 6c7a01ce-ae0b-4375-9783-1b9811c89d45

📥 Commits

Reviewing files that changed from the base of the PR and between c40813c and 4574a1b.

📒 Files selected for processing (2)
  • src/tests/class_tests/openms/source/FileHandler_test.cpp
  • src/tests/class_tests/openms/source/FileTypes_test.cpp
✅ Files skipped from review due to trivial changes (1)
  • src/tests/class_tests/openms/source/FileHandler_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tests/class_tests/openms/source/FileTypes_test.cpp

📝 Walkthrough

Walkthrough

Adds two Parquet-bundle file types (FEATUREPARQUET, CONSENSUSPARQUET), treats them as directory-backed in FileTypes, routes feature/consensus load/store in FileHandler to Arrow/Parquet import/export functions, and adds round-trip tests for both formats.

Changes

Cohort / File(s) Summary
File Type Definitions
src/openms/include/OpenMS/FORMAT/FileTypes.h, src/openms/source/FORMAT/FileTypes.cpp
Add FEATUREPARQUET and CONSENSUSPARQUET enum entries, name/extension mappings, descriptions, and mark them as directory-backed in isDirectoryType.
FileHandler Integration
src/openms/source/FORMAT/FileHandler.cpp
Handle FEATUREPARQUET/CONSENSUSPARQUET in feature/consensus load/store switch-cases; delegate to FeatureMapArrowIO::{importFromParquet,exportToParquet} and ConsensusMapArrowIO::{importFromParquet,exportToParquet} with exceptions on parse/create failures.
Tests
src/tests/class_tests/openms/source/FileHandler_test.cpp, src/tests/class_tests/openms/source/FileTypes_test.cpp
Add parquet round-trip tests for FeatureMap and ConsensusMap; extend FileTypes tests for new enum entries, name↔type mappings, directory-type assertions, and update expected type counts.

Sequence Diagram(s)

sequenceDiagram
    participant Client as User/Test
    participant FH as FileHandler
    participant FMA as FeatureMapArrowIO
    participant CMA as ConsensusMapArrowIO
    participant FS as Filesystem

    Client->>FH: storeFeatures(FeatureMap, path, FEATUREPARQUET)
    FH->>FMA: exportToParquet(FeatureMap, path)
    FMA->>FS: write parquet bundle (features, metadata, peaks...)
    FS-->>FMA: success / error
    FMA-->>FH: success / throw ParseError
    FH-->>Client: success / error

    Client->>FH: loadConsensusFeatures(path, CONSENSUSPARQUET)
    FH->>CMA: importFromParquet(path)
    CMA->>FS: read parquet bundle (consensus, members, PSMs...)
    FS-->>CMA: data / error
    CMA-->>FH: ConsensusMap / throw ParseError
    FH-->>Client: ConsensusMap / error
Loading

Possibly related PRs

Suggested reviewers

  • poshul

Poem

🐰 Parquet bundles snug and light,
Features leap and maps take flight,
Arrow paths hum soft and keen,
Tests confirm what's stored and seen,
A rabbit cheers this tidy sight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 'feat(FileHandler): add FEATUREPARQUET and CONSENSUSPARQUET file types' directly and specifically describes the main change: adding two new file type enum variants with corresponding FileHandler support.
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

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
Review rate limit: 6/8 reviews remaining, refill in 10 minutes and 48 seconds.

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.

🧹 Nitpick comments (2)
src/tests/class_tests/openms/source/FileTypes_test.cpp (1)

158-160: Avoid duplicating full-type-count assertions with a hard-coded literal.

Line 158 hard-codes 70 while Line 160 already validates against FileTypes::Type::SIZE_OF_TYPE. Keeping only the symbolic check reduces churn on future type additions.

♻️ Suggested simplification
-    TEST_EQUAL(FileTypeList::typesWithProperties({}).size(), 70);
+    TEST_EQUAL(FileTypeList::typesWithProperties({}).size(), static_cast<size_t>(FileTypes::Type::SIZE_OF_TYPE));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tests/class_tests/openms/source/FileTypes_test.cpp` around lines 158 -
160, Remove the duplicated hard-coded assertion and keep the symbolic
comparison: delete the TEST_EQUAL that checks
FileTypeList::typesWithProperties({}).size() == 70 and rely only on the existing
assertion comparing FileTypeList::typesWithProperties({}).size() with
static_cast<size_t>(FileTypes::Type::SIZE_OF_TYPE); this eliminates the brittle
literal while preserving the intent of verifying the full list matches
FileTypes::Type::SIZE_OF_TYPE.
src/tests/class_tests/openms/source/FileHandler_test.cpp (1)

373-437: Add one ID-sidecar assertion per parquet round-trip test.

Both new bundle types are modeled to carry identifications; the tests currently validate only feature/consensus scalar fields. Add a minimal protein/peptide ID in setup and assert it round-trips to guard the full bundle contract.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tests/class_tests/openms/source/FileHandler_test.cpp` around lines 373 -
437, The tests storeFeatures_loadFeatures_featureparquet_round_trip and
storeConsensusFeatures_loadConsensusFeatures_consensusparquet_round_trip
currently only check scalar fields; add a minimal ID sidecar to each setup (e.g.
create a ProteinIdentification and a PeptideIdentification/PeptideHit, attach
the peptide ID to Feature f (f.getPeptideIdentifications().push_back(...))
and/or to FeatureMap fm (fm.getProteinIdentifications().push_back(...)), and
similarly attach to ConsensusFeature cf / ConsensusMap cmap), then after
FileHandler::loadFeatures/loadConsensusFeatures assert that the loaded map
contains the same ID (check fm_in.getProteinIdentifications() or
fm_in[0].getPeptideIdentifications() and cmap_in equivalents have size 1 and
expected identifier/sequence). Ensure you use the existing symbols Feature f,
FeatureMap fm, ConsensusFeature cf, ConsensusMap cmap and the FileHandler
store/load calls so the new assertions validate the ID sidecar round-trip.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/tests/class_tests/openms/source/FileHandler_test.cpp`:
- Around line 373-437: The tests
storeFeatures_loadFeatures_featureparquet_round_trip and
storeConsensusFeatures_loadConsensusFeatures_consensusparquet_round_trip
currently only check scalar fields; add a minimal ID sidecar to each setup (e.g.
create a ProteinIdentification and a PeptideIdentification/PeptideHit, attach
the peptide ID to Feature f (f.getPeptideIdentifications().push_back(...))
and/or to FeatureMap fm (fm.getProteinIdentifications().push_back(...)), and
similarly attach to ConsensusFeature cf / ConsensusMap cmap), then after
FileHandler::loadFeatures/loadConsensusFeatures assert that the loaded map
contains the same ID (check fm_in.getProteinIdentifications() or
fm_in[0].getPeptideIdentifications() and cmap_in equivalents have size 1 and
expected identifier/sequence). Ensure you use the existing symbols Feature f,
FeatureMap fm, ConsensusFeature cf, ConsensusMap cmap and the FileHandler
store/load calls so the new assertions validate the ID sidecar round-trip.

In `@src/tests/class_tests/openms/source/FileTypes_test.cpp`:
- Around line 158-160: Remove the duplicated hard-coded assertion and keep the
symbolic comparison: delete the TEST_EQUAL that checks
FileTypeList::typesWithProperties({}).size() == 70 and rely only on the existing
assertion comparing FileTypeList::typesWithProperties({}).size() with
static_cast<size_t>(FileTypes::Type::SIZE_OF_TYPE); this eliminates the brittle
literal while preserving the intent of verifying the full list matches
FileTypes::Type::SIZE_OF_TYPE.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 947b5c84-9d3f-4676-9a23-a1a80e9e036f

📥 Commits

Reviewing files that changed from the base of the PR and between 60a2111 and d679974.

📒 Files selected for processing (5)
  • src/openms/include/OpenMS/FORMAT/FileTypes.h
  • src/openms/source/FORMAT/FileHandler.cpp
  • src/openms/source/FORMAT/FileTypes.cpp
  • src/tests/class_tests/openms/source/FileHandler_test.cpp
  • src/tests/class_tests/openms/source/FileTypes_test.cpp

… .consensusparquet

The previous CONSENSUSPARQUET round-trip section only exercised a
minimal single-feature ConsensusMap. Add a section that loads a real
ProteomicsLFQ output (ExperimentalDesign_ProteomicsLFQ_1_subset_out.consensusXML)
via FileHandler::loadConsensusFeatures, stores it as a .consensusparquet
bundle, reads it back, and verifies that the structural counts that
matter for downstream tools survive: 39 ConsensusFeatures, 60
FeatureHandles, 5 column headers, 1 ProteinIdentification, 39 attached
+ 65 unassigned PeptideIdentifications, plus first-feature RT/MZ/
intensity/charge numeric fidelity.

@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.

🧹 Nitpick comments (2)
src/tests/class_tests/openms/source/FileHandler_test.cpp (2)

373-404: Exercise the identification sidecars too.

FEATUREPARQUET is a bundle format, but this fixture only round-trips a bare feature. Add at least one identification payload so regressions in the sidecar parquet files are caught here as well.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tests/class_tests/openms/source/FileHandler_test.cpp` around lines 373 -
404, The test currently only writes a bare FeatureMap and misses identification
sidecars for the FEATUREPARQUET bundle; attach a PeptideIdentification (with at
least one PeptideHit / score and an identifier) to the Feature before calling
FileHandler().storeFeatures and then after FileHandler().loadFeatures assert
that fm_in[0].getPeptideIdentifications() contains the same identification
(size, identifier and a hit score or sequence) so the sidecar parquet is
exercised; update the test to create and push a PeptideIdentification into
Feature (use Feature::getPeptideIdentifications()/setPeptideIdentifications),
and add corresponding TEST_EQUAL/TEST_REAL_SIMILAR checks after loading to
validate the sidecar round-trip.

406-459: Strengthen the real-data consensus assertions.

This section still only checks counts for the ID containers. A serializer bug that preserves sizes but drops identifier/score metadata would slip through, so please assert one or two representative payload fields as well.

Possible follow-up assertions
   TEST_EQUAL(cmap_in.getProteinIdentifications().size(), cmap_ref.getProteinIdentifications().size());
   TEST_EQUAL(cmap_in.getUnassignedPeptideIdentifications().size(), cmap_ref.getUnassignedPeptideIdentifications().size());
+  TEST_STRING_EQUAL(cmap_in.getProteinIdentifications()[0].getIdentifier(),
+                    cmap_ref.getProteinIdentifications()[0].getIdentifier());
+  TEST_STRING_EQUAL(cmap_in.getProteinIdentifications()[0].getScoreType(),
+                    cmap_ref.getProteinIdentifications()[0].getScoreType());
+  TEST_EQUAL(cmap_in.getProteinIdentifications()[0].isHigherScoreBetter(),
+             cmap_ref.getProteinIdentifications()[0].isHigherScoreBetter());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tests/class_tests/openms/source/FileHandler_test.cpp` around lines 406 -
459, Add assertions that compare actual identifier/score payloads between
cmap_ref and cmap_in in addition to counts: after loading, fetch a
representative ProteinIdentification via cmap_ref.getProteinIdentifications()[0]
and cmap_in.getProteinIdentifications()[0] and assert their getIdentifier() (or
another stable identifier field) matches; likewise fetch a representative
PeptideIdentification from a feature (e.g.
cmap_ref[0].getPeptideIdentifications()[0] and
cmap_in[0].getPeptideIdentifications()[0]) and assert a stable payload like the
best PeptideHit score or id (via getHits()[0].getScore() or
getHits()[0].getSequence()/getIdentifier()) is equal. Ensure checks use existing
symbols cmap_ref, cmap_in, getProteinIdentifications(),
getPeptideIdentifications(), and getHits() so the test will catch metadata-loss
serializer bugs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/tests/class_tests/openms/source/FileHandler_test.cpp`:
- Around line 373-404: The test currently only writes a bare FeatureMap and
misses identification sidecars for the FEATUREPARQUET bundle; attach a
PeptideIdentification (with at least one PeptideHit / score and an identifier)
to the Feature before calling FileHandler().storeFeatures and then after
FileHandler().loadFeatures assert that fm_in[0].getPeptideIdentifications()
contains the same identification (size, identifier and a hit score or sequence)
so the sidecar parquet is exercised; update the test to create and push a
PeptideIdentification into Feature (use
Feature::getPeptideIdentifications()/setPeptideIdentifications), and add
corresponding TEST_EQUAL/TEST_REAL_SIMILAR checks after loading to validate the
sidecar round-trip.
- Around line 406-459: Add assertions that compare actual identifier/score
payloads between cmap_ref and cmap_in in addition to counts: after loading,
fetch a representative ProteinIdentification via
cmap_ref.getProteinIdentifications()[0] and
cmap_in.getProteinIdentifications()[0] and assert their getIdentifier() (or
another stable identifier field) matches; likewise fetch a representative
PeptideIdentification from a feature (e.g.
cmap_ref[0].getPeptideIdentifications()[0] and
cmap_in[0].getPeptideIdentifications()[0]) and assert a stable payload like the
best PeptideHit score or id (via getHits()[0].getScore() or
getHits()[0].getSequence()/getIdentifier()) is equal. Ensure checks use existing
symbols cmap_ref, cmap_in, getProteinIdentifications(),
getPeptideIdentifications(), and getHits() so the test will catch metadata-loss
serializer bugs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 12f60c26-a6b6-4361-bd2d-9b9376e8db8b

📥 Commits

Reviewing files that changed from the base of the PR and between d679974 and cb3a6f3.

📒 Files selected for processing (1)
  • src/tests/class_tests/openms/source/FileHandler_test.cpp

Previously the real-data section only checked container counts and a
few first-feature numeric fields. Expand it to cover the cross-cutting
references that downstream tools depend on:

- ColumnHeaders: per-map_index filename, label, unique_id all match.
- FeatureHandle map references: multiset of (unique_id, map_index)
  pairs and per-map handle counts match exactly.
- Run references: ProteinIdentification.identifier set matches;
  every PeptideIdentification (attached + unassigned) resolves to a
  known run identifier (no dangling refs after round-trip).
- ProteinIdentification round-trip: identifier, search_engine(+version),
  score_type, higher_score_better, hit count, spectra_data list (5
  files), ProteinHit accession set.
- Inference info: IndistinguishableProteins (and ProteinGroups) groups
  compared as set of (probability, sorted-accessions) signatures.
- id_merge_index distribution (the per-PSM link to spectra_data files)
  matches, with all 5 merge indices present and no missing entries.
- Per-PSM hit content: (run_id, merge_index, RT, MZ, sequence, charge,
  score) tuples match for both unassigned and feature-attached PSMs.

The earlier sanity-anchor assertion that compared getIdentifier() to
the literal "PI_0" was wrong — ConsensusXMLHandler rebuilds the run
identifier as "<engine>_<date>_<hash>" on load (the XML id="PI_0" is
only an internal cross-reference, not the C++ identifier). Use a
hasPrefix("OMSSA_") check instead.
- FileTypes_test: drop the redundant hard-coded 70 literal in
  typesWithProperties; the next line already verifies the same value
  symbolically against FileTypes::Type::SIZE_OF_TYPE, which is the
  intent (catch missing TypeNameBindings without baking in a brittle
  count that needs bumping every time a new type is added).
- FileHandler_test: extend the two minimal feature/consensus parquet
  round-trip sections with an ID sidecar — a ProteinIdentification on
  the map and a PeptideIdentification (with one PeptideHit) attached
  to the feature, linked by identifier. After load, assert the IDs
  survive: container sizes, identifier, score type, higher_score_better,
  and the hit's sequence/charge/score. The real-data ProteomicsLFQ
  section already exercises this end-to-end; the synthetic sections now
  cover the same contract on the FileHandler dispatch path.
@timosachsenberg
timosachsenberg merged commit 7b0cfb5 into OpenMS:develop Apr 29, 2026
16 checks passed
timosachsenberg pushed a commit that referenced this pull request Apr 30, 2026
Added entries for:
- Perf: BrukerTimsFile FrameAggregator boost::unordered_flat_map (#9243)
- Native .featureparquet and .consensusparquet formats (#9242)
- IsobaricWorkflow: .idparquet and .mzId input support (#9241)
- IDMerger: fix preserved input file order (#9240)
- PercolatorAdapter: fix in-process post-filter (#9240)
- IDRipper: .idparquet input/output support (#9237)
- ProteomicsLFQ: .idparquet and .mzId input support (#9236)
- FileTypes::FEATUREPARQUET, FileTypes::CONSENSUSPARQUET in Library section (#9242)

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
timosachsenberg added a commit that referenced this pull request Apr 30, 2026
Added entries for:
- IDRipper .idparquet input/output support (#9237)
- FEATUREPARQUET and CONSENSUSPARQUET file types (#9242)
- BrukerTimsFile FrameAggregator perf improvement with boost::unordered_flat_map (#9243)
- PercolatorAdapter: fix post-filters on in-process backend (#9240)
- IDMerger: fix input file order preservation (#9240)
- ProteomicsLFQ: .idparquet/.mzId input support (#9236)
- IsobaricWorkflow: .idparquet/.mzId input support (#9241)
- wnetalign/wnet/pylmcf FetchContent dependencies (#8992)
- OpenMS Library: FileTypes::FEATUREPARQUET/CONSENSUSPARQUET (#9242)
- OpenMS Library: FeatureGroupingAlgorithmWNet and WNetMatcher (#8992)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
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.

1 participant