Skip to content

feat: add QPX directory export to ProteomicsLFQ and IsobaricWorkflow - #8973

Merged
timosachsenberg merged 3 commits into
OpenMS:developfrom
timosachsenberg:feature/qpx-export-proteomicslfq-isobaricworkflow
Mar 23, 2026
Merged

timosachsenberg merged 3 commits into
OpenMS:developfrom
timosachsenberg:feature/qpx-export-proteomicslfq-isobaricworkflow

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Mar 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace -out_feature_qpx (single Parquet file) with -out_qpx (directory) in ProteomicsLFQ and IsobaricWorkflow
  • Export three QPX Parquet tables into the directory:
    • features.parquet — feature-level quantification (existing ConsensusMapArrowExport)
    • psms.parquet — PSM-level data (existing QPXFile, newly wired)
    • protein_groups.parquet — protein group quantification (new ProteinGroupArrowExport class)
  • New ProteinGroupArrowExport class implements the QPX pg schema with one row per protein group per run file
  • QPX export is placed after protein quantification/annotation so all data reflects final workflow state

Test plan

  • Verify build with WITH_PARQUET=ON: cmake --build OpenMS-build --target ProteomicsLFQ IsobaricWorkflow
  • Run ProteomicsLFQ with -out_qpx /tmp/test_qpx and verify directory contains features.parquet, psms.parquet, protein_groups.parquet
  • Inspect parquet schemas with pyarrow to confirm they match QPX spec
  • Run existing TOPP tests: ctest --test-dir OpenMS-build -R "ProteomicsLFQ|IsobaricWorkflow"

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added protein-group export to Parquet (QPX) with per-run quantification; workflows now emit three Parquet datasets: features, PSMs, and protein groups into a user-specified output directory.
  • Tests

    • Added conditional end-to-end test verifying generation of the three Parquet artifacts.
  • Chores

    • Updated build/configuration to include the new Parquet export components.

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]>
@coderabbitai

coderabbitai Bot commented Mar 23, 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: 6a9a4e3f-e7bd-45cf-8c77-659b4b61682c

📥 Commits

Reviewing files that changed from the base of the PR and between 36379cf and 4b7bc92.

📒 Files selected for processing (1)
  • src/tests/topp/CMakeLists.txt

📝 Walkthrough

Walkthrough

A new ProteinGroupArrowExport class is added to export protein-group consensus data as Apache Arrow tables and Parquet files. TOPP tools (IsobaricWorkflow, ProteomicsLFQ) now support an output directory (-out_qpx) producing three Parquet files: features.parquet, psms.parquet, and protein_groups.parquet. CMake lists updated to include the new files when WITH_PARQUET is enabled.

Changes

Cohort / File(s) Summary
Protein Group Arrow/Parquet Exporter
src/openms/include/OpenMS/FORMAT/ProteinGroupArrowExport.h, src/openms/source/FORMAT/ProteinGroupArrowExport.cpp
Adds ProteinGroupArrowExport (guarded by WITH_PARQUET) with exportToArrow(const ConsensusMap&) returning std::shared_ptr<arrow::Table> and exportToParquet(const ConsensusMap&, const String&, const ParquetWriteConfig&) writing Parquet with QPX metadata. Builds nested Arrow schema (accessions, genes, per-run intensities, counts, coverage, scores, CV params) and emits one row per protein-group per run file.
TOPP tools: multi-file QPX output
src/topp/IsobaricWorkflow.cpp, src/topp/ProteomicsLFQ.cpp
Replaces single feature-level Parquet output option with an output directory -out_qpx. Tools now write features.parquet (features), psms.parquet (aggregated PSMs), and protein_groups.parquet (protein groups) and return CANNOT_WRITE_OUTPUT_FILE on any export failure.
Build system: sources lists
src/openms/include/OpenMS/FORMAT/sources.cmake, src/openms/source/FORMAT/sources.cmake
Adds the new header and source files to CMake sources_list_h/OpenMS_sources_h under the WITH_PARQUET guard so the new exporter is compiled only when Parquet support is enabled.
Tests: TOPP test additions
src/tests/topp/CMakeLists.txt
Adds a conditional ProteomicsLFQ QPX export test (guarded by WITH_PARQUET) and three follow-up CTest entries that verify features.parquet, psms.parquet, and protein_groups.parquet outputs via SHA256 checksums.

Sequence Diagram

sequenceDiagram
    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
Loading

Possibly related PRs

Suggested reviewers

  • jpfeuffer

Poem

🐰 Hopping through schemas, rows in a trail,

Groups and genes packed in Arrow's pale,
Parquet files nest in a tidy directory,
Features, PSMs, proteins — a quantified story,
I nibble a carrot and chirp: “Export success!” 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding QPX directory export functionality to ProteomicsLFQ and IsobaricWorkflow, replacing single-file with multi-file directory output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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

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/openms/source/FORMAT/ProteinGroupArrowExport.cpp (1)

350-378: Document the implicit contract with annotateQuantificationsToProteins output.

The code accesses data arrays by index (FloatDataArrays[3], StringDataArrays[0], IntegerDataArrays[0]) without name-based lookup. While this works correctly based on the current annotateQuantificationsToProteins implementation, it creates a fragile coupling.

Consider adding a brief comment documenting this dependency, or using getFloatDataArrayByName/getStringDataArrayByName for 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 QPXExporter utility class or as part of QPXFile) 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4721c83 and 36379cf.

📒 Files selected for processing (6)
  • src/openms/include/OpenMS/FORMAT/ProteinGroupArrowExport.h
  • src/openms/include/OpenMS/FORMAT/sources.cmake
  • src/openms/source/FORMAT/ProteinGroupArrowExport.cpp
  • src/openms/source/FORMAT/sources.cmake
  • src/topp/IsobaricWorkflow.cpp
  • src/topp/ProteomicsLFQ.cpp

timosachsenberg and others added 2 commits March 23, 2026 15:02
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]>
@timosachsenberg
timosachsenberg merged commit c9a2677 into OpenMS:develop Mar 23, 2026
37 of 38 checks passed
github-actions Bot added a commit that referenced this pull request Mar 24, 2026
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]>
timosachsenberg pushed a commit that referenced this pull request Mar 24, 2026
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]>
@coderabbitai coderabbitai Bot mentioned this pull request Jun 12, 2026
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