Repository navigation
feat: add QPX directory export to ProteomicsLFQ and IsobaricWorkflow - #8973
Conversation
Replace -out_feature_qpx (single file) with -out_qpx (directory) in ProteomicsLFQ and IsobaricWorkflow. The directory contains three Parquet files following the QPX spec: - features.parquet (ConsensusMapArrowExport, existing) - psms.parquet (QPXFile, newly wired) - protein_groups.parquet (ProteinGroupArrowExport, new class) ProteinGroupArrowExport implements the QPX pg schema with one row per protein group per run file. Quantification data from annotateQuantificationsToProteins() is grouped by filename with per-channel intensities. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
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 (1)
📝 WalkthroughWalkthroughA new Changes
Sequence DiagramsequenceDiagram
participant Tool as TOPP Tool
participant Export as ProteinGroupArrowExport
participant Builders as Arrow Builders
participant Schema as Arrow Schema
participant Writer as Parquet Writer
participant File as Parquet File
Tool->>Export: exportToParquet(ConsensusMap, filepath, config)
activate Export
Export->>Export: Validate ConsensusMap (protein IDs, groups)
Export->>Builders: Create column/list/struct builders
activate Builders
loop per protein group
Export->>Builders: Populate group fields, per-run intensities, counts
Builders-->>Export: Append row(s)
end
Builders->>Builders: Finalize builders → Arrow arrays
deactivate Builders
Export->>Schema: Assemble QPX schema & field order
Export->>Export: Create arrow::Table and add metadata (UUID, timestamp)
Export->>Writer: Configure Parquet properties (compression, stats)
activate Writer
Writer->>File: WriteTable(arrow::Table)
File-->>Writer: Success/Error
deactivate Writer
Export-->>Tool: return bool (success/failure)
deactivate Export
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/openms/source/FORMAT/ProteinGroupArrowExport.cpp (1)
350-378: Document the implicit contract withannotateQuantificationsToProteinsoutput.The code accesses data arrays by index (
FloatDataArrays[3],StringDataArrays[0],IntegerDataArrays[0]) without name-based lookup. While this works correctly based on the currentannotateQuantificationsToProteinsimplementation, it creates a fragile coupling.Consider adding a brief comment documenting this dependency, or using
getFloatDataArrayByName/getStringDataArrayByNamefor more robust access:// Data arrays populated by PeptideAndProteinQuant::annotateQuantificationsToProteins(): // FloatDataArrays[3] = "file_channel_level_abundance" // StringDataArrays[0] = "file_channel_level_filename" // IntegerDataArrays[0] = "file_channel_level_channel"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/FORMAT/ProteinGroupArrowExport.cpp` around lines 350 - 378, The code currently assumes positions of quantification arrays (accessing group.getFloatDataArrays()[3], group.getStringDataArrays()[0], group.getIntegerDataArrays()[0]) which couples it to PeptideAndProteinQuant::annotateQuantificationsToProteins; either (a) replace index-based access with name-based lookup using group.getFloatDataArrayByName("file_channel_level_abundance"), group.getStringDataArrayByName("file_channel_level_filename"), and group.getIntegerDataArrayByName("file_channel_level_channel") before using them, or (b) if you prefer minimal change, add the suggested comment above this block documenting the implicit contract with annotateQuantificationsToProteins and the exact names/indices used so future maintainers understand the dependency (reference symbols: annotateQuantificationsToProteins, getFloatDataArrays, getStringDataArrays, getIntegerDataArrays, emitRow).src/topp/ProteomicsLFQ.cpp (1)
1717-1759: Consider extracting shared QPX export logic.The QPX export block is functionally correct and mirrors the implementation in
IsobaricWorkflow.cpp. Both tools iterate consensus features identically to collect peptide IDs and call the same three export methods.While acceptable for this PR, consider extracting this into a shared helper (e.g., in a
QPXExporterutility class or as part ofQPXFile) in a follow-up to reduce duplication and ensure consistent behavior across tools.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/topp/ProteomicsLFQ.cpp` around lines 1717 - 1759, This block duplicates QPX Parquet export logic found in IsobaricWorkflow; extract it into a shared helper (e.g., a QPXExporter utility or a static helper on QPXFile) that encapsulates collecting peptide IDs from a ConsensusMap and calling ConsensusMapArrowExport::exportToParquet, QPXFile::exportToParquet, and ProteinGroupArrowExport::exportToParquet; replace the inlined code in ProteomicsLFQ (and mirror change in IsobaricWorkflow) with a single call like QPXExporter::exportAll(consensus, out_qpx) that returns a status or throws on error so callers can log and return CANNOT_WRITE_OUTPUT_FILE consistently.
🤖 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/openms/source/FORMAT/ProteinGroupArrowExport.cpp`:
- Around line 350-378: The code currently assumes positions of quantification
arrays (accessing group.getFloatDataArrays()[3], group.getStringDataArrays()[0],
group.getIntegerDataArrays()[0]) which couples it to
PeptideAndProteinQuant::annotateQuantificationsToProteins; either (a) replace
index-based access with name-based lookup using
group.getFloatDataArrayByName("file_channel_level_abundance"),
group.getStringDataArrayByName("file_channel_level_filename"), and
group.getIntegerDataArrayByName("file_channel_level_channel") before using them,
or (b) if you prefer minimal change, add the suggested comment above this block
documenting the implicit contract with annotateQuantificationsToProteins and the
exact names/indices used so future maintainers understand the dependency
(reference symbols: annotateQuantificationsToProteins, getFloatDataArrays,
getStringDataArrays, getIntegerDataArrays, emitRow).
In `@src/topp/ProteomicsLFQ.cpp`:
- Around line 1717-1759: This block duplicates QPX Parquet export logic found in
IsobaricWorkflow; extract it into a shared helper (e.g., a QPXExporter utility
or a static helper on QPXFile) that encapsulates collecting peptide IDs from a
ConsensusMap and calling ConsensusMapArrowExport::exportToParquet,
QPXFile::exportToParquet, and ProteinGroupArrowExport::exportToParquet; replace
the inlined code in ProteomicsLFQ (and mirror change in IsobaricWorkflow) with a
single call like QPXExporter::exportAll(consensus, out_qpx) that returns a
status or throws on error so callers can log and return CANNOT_WRITE_OUTPUT_FILE
consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6425593c-1f03-418f-87c5-d283b6826081
📒 Files selected for processing (6)
src/openms/include/OpenMS/FORMAT/ProteinGroupArrowExport.hsrc/openms/include/OpenMS/FORMAT/sources.cmakesrc/openms/source/FORMAT/ProteinGroupArrowExport.cppsrc/openms/source/FORMAT/sources.cmakesrc/topp/IsobaricWorkflow.cppsrc/topp/ProteomicsLFQ.cpp
Verify that -out_qpx produces features.parquet, psms.parquet, and protein_groups.parquet. Uses the existing BSA subset test data. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add missing changelog entries for: - QPX directory export replacing -out_feature_qpx with -out_qpx in ProteomicsLFQ and IsobaricWorkflow (#8973) - ProteinGroupArrowExport new library class for QPX pg schema (#8973) - ArrowSchemaRegistry centralizing Arrow/Parquet schemas with strict/subset validation (#8970) Co-authored-by: Copilot <[email protected]>
Add missing changelog entries for: - QPX directory export replacing -out_feature_qpx with -out_qpx in ProteomicsLFQ and IsobaricWorkflow (#8973) - ProteinGroupArrowExport new library class for QPX pg schema (#8973) - ArrowSchemaRegistry centralizing Arrow/Parquet schemas with strict/subset validation (#8970) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]>
Summary
-out_feature_qpx(single Parquet file) with-out_qpx(directory) in ProteomicsLFQ and IsobaricWorkflowfeatures.parquet— feature-level quantification (existingConsensusMapArrowExport)psms.parquet— PSM-level data (existingQPXFile, newly wired)protein_groups.parquet— protein group quantification (newProteinGroupArrowExportclass)ProteinGroupArrowExportclass implements the QPX pg schema with one row per protein group per run fileTest plan
WITH_PARQUET=ON:cmake --build OpenMS-build --target ProteomicsLFQ IsobaricWorkflow-out_qpx /tmp/test_qpxand verify directory containsfeatures.parquet,psms.parquet,protein_groups.parquetctest --test-dir OpenMS-build -R "ProteomicsLFQ|IsobaricWorkflow"🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests
Chores