Skip to content

feat(qpx): 1.1.4, MuData modality guard, and optional search FASTA - #52

Merged
ypriverol merged 3 commits into
mainfrom
fix/qpx-114-mudata-guard
Sep 16, 2026
Merged

ypriverol merged 3 commits into
mainfrom
fix/qpx-114-mudata-guard

Conversation

@ypriverol

@ypriverol ypriverol commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Both qpx/diann and qpx/openmsconsensus are updated; quantms vendors the first, quantmsdiann the second, and both had the same defects.

1. A partial MuData could ship as success

The modules called build_mudata() + mdata.write() directly, bypassing qpx's own writer. write_dataset_mudata checks missing = required_modalities - set(mdata.mod) and refuses a MuData missing a required quantification modality; build_mudata catches per-modality failures, logs them and continues, so a failed modality is simply absent. The module wrote that incomplete h5mu and the task exited 0.

On MSV000085836 (TMT, 552 runs x 10 channels) that shipped an h5mu with proteins and no precursors, from a pyarrow int32 offset overflow (bigbio/qpx#316). 1.1.4 fixes the overflow — that dataset now yields ['precursors', 'proteins'] (5,520 x 633,097) — but the guard matters for any future modality failure.

2. *.h5mu is optional again

As a required output it inverted qpx's contract: the parquet views are the dataset's source of truth and the MuData view is best-effort. It turned a best-effort artifact into a run-killer — MSV000085836 lost a ~1h19 conversion to it three times.

3. Optional search FASTA

qpx 1.1.4 accepts --fasta on both converters and fills, for target rows only and only where null, pg.sequence_coverage, pg.molecular_weight and feature.pg_positions. DIA-NN never reports protein sequences, and some consensusXML files carry protein hits without them (MSV000085836: 14,071 hits, none with a sequence), so without a FASTA those fields stay empty.

Both pipelines already have the search database, so each module takes it as an optional last input: pass the FASTA, or [] when unavailable. Appending it leaves existing positional inputs unchanged. A producer value is never overwritten, and proteins absent from the FASTA (DIA-NN's internal decoys, contaminants from another database) stay null and are counted in the step's report.

Measured with 1.1.4 on real data:

DIA PXD017199 TMT MSV000085836
pg.sequence_coverage / molecular_weight 0% -> 100% 0% -> 100%
feature.pg_positions 0% -> 100% already recorded (99.78%)

On PXD000612, where OpenMS records these itself, the FASTA values reproduce them: molecular weight identical on all 290,229 rows, coverage median difference 0.0 points (correlation 0.9995).

Pins

Container and conda move to 1.1.4 (on GHCR and PyPI; the image is stamped 1.1.4, unlike the floating :dev tag which reports 0.0.0.dev0 and would land in dataset provenance and versions.yml). 1.1.4 also brings failed-modality reporting, DIA-NN pg.contaminant / quantification_method, OpenMS protein annotations and positions, and integrity-verification fixes.

Tests

Stub tests pass for both modules with no snapshot drift; CI's docker module tests pass for both.

Downstream

quantms and quantmsdiann need nf-core modules update once this merges, and their workflows should pass the search database to the new input. bigbio/quantms#732 (currently a draft that hand-edits the vendored copy) will be redone that way.

Both QPX modules called build_mudata() + mdata.write() directly, which
bypasses qpx's own writer. write_dataset_mudata checks

    missing = required_modalities - set(mdata.mod)

and refuses a MuData that lacks a required quantification modality;
build_mudata catches per-modality failures, logs them and continues, so a
modality that failed to build was simply absent. The module then wrote that
INCOMPLETE h5mu and the task exited 0. On MSV000085836 that shipped a view
with proteins and no precursors, from a pyarrow offset overflow
(bigbio/qpx#316, fixed in 1.1.4: that dataset now yields
['precursors', 'proteins'], 5520 x 633097).

*.h5mu becomes an optional output again. As a required output it inverted
qpx's contract — the parquet views are the dataset's source of truth and
the MuData view is best-effort — and turned a best-effort artifact into a
run-killer: MSV000085836 lost a ~1h19 conversion to it three times.

Container and conda pins move to 1.1.4, which also brings the modality
reporting (#318), the DIA-NN contaminant/quantification_method fields and
the OpenMS protein annotations. Stub tests pass unchanged for both modules.
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c9c3cdea-0afa-4e94-bc36-70306ca17a62

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd54b3 and 7b9c1c0.

📒 Files selected for processing (4)
  • modules/bigbio/qpx/diann/environment.yml
  • modules/bigbio/qpx/diann/main.nf
  • modules/bigbio/qpx/openmsconsensus/environment.yml
  • modules/bigbio/qpx/openmsconsensus/main.nf

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Both QPX modules update to version 1.1.4. Their MuData outputs are optional. MuData writing now uses write_dataset_mudata and does not create incomplete files when required data is unavailable.

Changes

QPX MuData output update

Layer / File(s) Summary
Align QPX runtime versions
modules/bigbio/qpx/*/environment.yml, modules/bigbio/qpx/*/main.nf
The qpx package pins and container images change from 1.1.3 to 1.1.4 in both modules.
Handle optional MuData output
modules/bigbio/qpx/diann/main.nf, modules/bigbio/qpx/openmsconsensus/main.nf
The .h5mu outputs become optional. Both processes call write_dataset_mudata; they warn when it returns None and move successful output to ${prefix}.h5mu.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant QPX_Process
  participant write_dataset_mudata
  participant parquet_views
  QPX_Process->>write_dataset_mudata: Build MuData from qpx_output
  write_dataset_mudata->>parquet_views: Validate required quantification modality
  write_dataset_mudata-->>QPX_Process: Return generated file or None
  QPX_Process->>parquet_views: Warn when no h5mu is produced
  QPX_Process->>QPX_Process: Move successful output to prefix.h5mu
Loading

Merge Risk: ⚪ Minimal · up to 7b9c1

The change has no identified actionable merge risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title correctly mentions QPX 1.1.4 and the MuData modality guard, but it incorrectly states that the search FASTA becomes optional. The change makes the .h5mu output optional. Replace “optional search FASTA” with “optional h5mu output” or equivalent wording that matches the changeset.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/qpx-114-mudata-guard

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Guard optional MuData generation and upgrade QPX to 1.1.4

🐞 Bug fix ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Validate required modalities before publishing optional MuData views from both QPX converters.
• Preserve authoritative Parquet outputs when best-effort MuData generation fails.
• Pin container and Conda installations to QPX 1.1.4.
Diagram

graph TD
  INPUT["Quantification input"] --> CONVERT["QPX 1.1.4"] --> PARQUET["Parquet dataset"] --> WRITER["MuData writer"] --> CHECK{"Modalities complete?"} -->|Complete| MUDATA["Optional h5mu"]
  CHECK -->|Missing modality| OMIT["Omit h5mu"]
Loading
High-Level Assessment

Using QPX's public write_dataset_mudata API is the preferred approach because it centralizes modality validation, temporary-file handling, and stale-artifact cleanup. Retaining direct build_mudata calls with module-specific validation would duplicate QPX internals and risk diverging from future writer behavior.

Files changed (4) +44 / -20

Bug fix (2) +42 / -18
main.nfSafely emit optional DIA-NN MuData views +21/-9

Safely emit optional DIA-NN MuData views

• Upgrades the GHCR image to QPX 1.1.4 and makes the h5mu output optional. MuData generation now uses write_dataset_mudata for required-modality validation and atomic writing, moving the artifact into place only after success while preserving authoritative Parquet outputs on failure.

modules/bigbio/qpx/diann/main.nf

main.nfSafely emit optional OpenMS MuData views +21/-9

Safely emit optional OpenMS MuData views

• Upgrades the GHCR image to QPX 1.1.4 and restores the h5mu output to best-effort status. The module delegates MuData validation and safe writing to write_dataset_mudata, omitting failed views without invalidating successful Parquet conversion.

modules/bigbio/qpx/openmsconsensus/main.nf

Other (2) +2 / -2
environment.ymlPin DIA-NN Conda environment to QPX 1.1.4 +1/-1

Pin DIA-NN Conda environment to QPX 1.1.4

• Updates the PyPI dependency from QPX 1.1.3 to 1.1.4, aligning the Conda environment with the module container and incorporating upstream conversion fixes.

modules/bigbio/qpx/diann/environment.yml

environment.ymlPin OpenMS Conda environment to QPX 1.1.4 +1/-1

Pin OpenMS Conda environment to QPX 1.1.4

• Updates the PyPI dependency from QPX 1.1.3 to 1.1.4, keeping the Conda environment synchronized with the module container and upstream fixes.

modules/bigbio/qpx/openmsconsensus/environment.yml

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

editorconfig-checker: the wrapped print( continuation sat at 10 spaces;
the repo requires left-padding in multiples of 4.
qpx 1.1.4 accepts --fasta on both converters and fills, for target rows
only and only where null, pg.sequence_coverage, pg.molecular_weight and
feature.pg_positions. DIA-NN never reports protein sequences, and some
consensusXML files carry protein hits without them (MSV000085836 has
14,071 hits with no sequence), so without a FASTA those fields stay empty.

Both pipelines already have the search database, so both modules take it
as an optional last input: pass the FASTA, or [] when unavailable. The
input is appended, so existing positional inputs are unchanged.

A producer value is never overwritten, and proteins absent from the FASTA
(DIA-NN's internal decoys, contaminants from another database) stay null
and are counted in the step's report.

Measured with 1.1.4 on the real datasets: PXD017199 (DIA) and
MSV000085836 (TMT) go from 0% to 100% coverage and molecular weight, and
PXD017199 from 0% to 100% positions; on PXD000612, where OpenMS records
these itself, the FASTA values reproduce them (molecular weight identical
on all 290,229 rows, coverage median difference 0.0 points).
@ypriverol ypriverol changed the title fix(qpx): qpx 1.1.4 and write_dataset_mudata in both modules feat(qpx): 1.1.4, MuData modality guard, and optional search FASTA Sep 16, 2026
@ypriverol
ypriverol merged commit 6f371a7 into main Sep 16, 2026
8 checks passed
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