Repository navigation
feat(FileHandler): add FEATUREPARQUET and CONSENSUSPARQUET file types - #9242
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds two Parquet-bundle file types ( Changes
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
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Review rate limit: 6/8 reviews remaining, refill in 10 minutes and 48 seconds.Comment |
There was a problem hiding this comment.
🧹 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
70while Line 160 already validates againstFileTypes::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
📒 Files selected for processing (5)
src/openms/include/OpenMS/FORMAT/FileTypes.hsrc/openms/source/FORMAT/FileHandler.cppsrc/openms/source/FORMAT/FileTypes.cppsrc/tests/class_tests/openms/source/FileHandler_test.cppsrc/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.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/tests/class_tests/openms/source/FileHandler_test.cpp (2)
373-404: Exercise the identification sidecars too.
FEATUREPARQUETis 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
📒 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.
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]>
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]>
Summary
FEATUREPARQUET(.featureparquet) andCONSENSUSPARQUET(.consensusparquet) — alongside the existingIDPARQUET, withPROVIDES_FEATURES/PROVIDES_CONSENSUSFEATURES(+PROVIDES_IDENTIFICATIONS,READABLE,WRITEABLE) properties.FileHandler::loadFeatures/storeFeaturesandloadConsensusFeatures/storeConsensusFeaturesto dispatch the new types to the existingFeatureMapArrowIO::importFromParquet/exportToParquetandConsensusMapArrowIO::importFromParquet/exportToParquet(same pattern asIDPARQUET→PSMArrowIO:ParseErroron read failure,UnableToCreateFileon write failure).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.parquetplus the four ID-side parquet files (psms,proteins,protein_groups,search_params).Test plan
FileTypes_test— name↔type round-trip andisDirectoryTypefor both new types; updated hardcoded type counts intypesWithProperties(45→47, 68→70).FileHandler_test— added two round-trip sections thatstoreFeatures/loadFeaturesagainst*.featureparquetandstoreConsensusFeatures/loadConsensusFeaturesagainst*.consensusparquet, verifying RT/MZ/intensity/charge/quality survive the trip.cmake --build OpenMS-build --target OpenMSclean.ctest -R '^FileTypes_test\$|^FileHandler_test\$'— 2/2 pass.🤖 Generated with Claude Code
Summary by CodeRabbit