Skip to content

chore(qpx): update the diann module and pass the search database - #125

Merged
ypriverol merged 2 commits into
devfrom
chore/qpx-114-module-update
Sep 16, 2026
Merged

ypriverol merged 2 commits into
devfrom
chore/qpx-114-module-update

Conversation

@ypriverol

Copy link
Copy Markdown
Contributor

Module update for bigbio/nf-modules#52 (nf-core modules update qpx/diann -> d9e1b05), the DIA counterpart of bigbio/quantms#733.

What the module update brings

  • write_dataset_mudata instead of build_mudata + mdata.write(). build_mudata catches per-modality failures, logs them and continues, so a failed modality is simply absent and the module wrote that incomplete h5mu with exit 0 (fix(mudata): widen strings before combining chunks qpx#316, seen on the TMT path).
  • *.h5mu is optional again, restoring qpx's contract: the parquet views are the source of truth and the MuData view is best-effort.
  • qpx 1.1.4 container and conda pins.
  • An optional FASTA input.

Passing the search database

DIA-NN reports no protein sequences at all, so without a FASTA pg.sequence_coverage, pg.molecular_weight and feature.pg_positions are always null. The workflow now passes ch_searchdb.

Measured with 1.1.4 on PXD017199 (21.6M features, 1.7M pg rows): all three go 0% -> 100%, every filled position matches its FASTA substring (198,411/198,411), no existing column changes, and the dataset still validates. The step took 64 s.

DIA-NN's internal decoys are never in the FASTA — it generates them itself — so those rows stay null and are counted in the step's report, which is the intended behaviour rather than a silent gap.

.first() keeps it a value channel, since ch_searchdb already feeds the library-generation and search steps.

Checks

The vendored module's stub test passes (NXF_VER=25.10.4 nf-test); its full test needs downloaded data and a container, so CI runs it. nextflow lint reports no errors in workflows/dia.nf or the qpx module (the 22 errors it prints are pre-existing VersionUtils/BlockedFlags references in modules/local/diann/*).

nf-core modules update qpx/diann -> bigbio/nf-modules d9e1b05:

- write_dataset_mudata instead of build_mudata + mdata.write(), so a MuData
  missing a required quantification modality is refused rather than written.
  build_mudata skips a modality that fails to build, so the old path could
  write an incomplete h5mu and exit 0 (bigbio/qpx#316).
- *.h5mu optional again: the parquet views are the dataset's source of
  truth, so a view that cannot be built no longer kills a complete run.
- container/conda pinned to qpx 1.1.4.
- an optional FASTA input.

DIA reports no protein sequences at all, so without a FASTA
pg.sequence_coverage, pg.molecular_weight and feature.pg_positions are
always null. The workflow now passes ch_searchdb — the database the search
used — and on PXD017199 those three go from 0% to 100%. Proteins absent
from the FASTA, which is always the case for DIA-NN's internally generated
decoys, stay null and are counted in the step's report. .first() keeps it a
value channel, since ch_searchdb already feeds the library and search steps.
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 48c4f46d-2462-4481-9da6-0ae0ef6e1523

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Harden QPX DIA-NN export and enrich proteins from search FASTA

🐞 Bug fix ✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Rejects incomplete MuData views while preserving authoritative Parquet outputs.
• Passes the search FASTA to populate protein annotations absent from DIA-NN reports.
• Pins QPX 1.1.4 and adapts module metadata and tests for optional FASTA input.
Diagram

graph TD
  FASTA["Search FASTA"] -->|value channel| MODULE["QPX DIA-NN"] --> CONVERT["QPX Converter"] --> PARQUET[("Parquet Dataset")]
  REPORT["DIA-NN Outputs"] --> MODULE
  CONVERT --> WRITER["Validated Writer"] --> H5MU["Optional H5MU"]
Loading
High-Level Assessment

The selected approach is appropriate: passing the exact search FASTA into QPX centralizes sequence-derived enrichment in the format converter, while the validated writer prevents incomplete MuData artifacts without failing otherwise complete Parquet exports. Separate post-processing or earlier DIA-NN enrichment would duplicate QPX logic and would not improve handling of internally generated decoys.

Files changed (6) +55 / -18

Enhancement (1) +7 / -1
dia.nfPass the DIA search database into QPX conversion +7/-1

Pass the DIA search database into QPX conversion

• Passes the existing search database channel to QPX_DIANN using first() so it remains a reusable value channel. This enables sequence coverage, molecular weight, and protein-position enrichment from the same FASTA used by the search.

workflows/dia.nf

Bug fix (1) +30 / -9
main.nfAdd FASTA enrichment and validated optional MuData output +30/-9

Add FASTA enrichment and validated optional MuData output

• Upgrades the container to QPX 1.1.4 and forwards an optional FASTA to the DIA-NN converter. Replaces direct MuData construction with the validated QPX writer and makes H5MU output optional so failed views do not invalidate complete Parquet exports.

modules/bigbio/qpx/diann/main.nf

Tests (1) +2 / -0
main.nf.testAdapt QPX DIA-NN tests to the FASTA input +2/-0

Adapt QPX DIA-NN tests to the FASTA input

• Supplies an empty optional FASTA value in both the downloaded-data and stub process tests, preserving coverage of the module's no-FASTA path.

modules/bigbio/qpx/diann/tests/main.nf.test

Documentation (1) +8 / -0
meta.ymlDocument the optional search FASTA input +8/-0

Document the optional search FASTA input

• Adds the FASTA input contract, accepted file patterns, enriched protein fields, and expected behavior for missing proteins and DIA-NN decoys.

modules/bigbio/qpx/diann/meta.yml

Other (2) +8 / -8
modules.jsonAdvance the vendored QPX DIA-NN module revision +7/-7

Advance the vendored QPX DIA-NN module revision

• Updates the qpx/diann module lock to bigbio/nf-modules commit d9e1b05 while retaining the existing revisions for other BigBio modules.

modules.json

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

Pin the Conda environment to QPX 1.1.4

• Upgrades the module's pip-installed QPX dependency from 1.1.3 to 1.1.4.

modules/bigbio/qpx/diann/environment.yml

@qodo-code-review

qodo-code-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (2) 📜 Skill insights (0)

Grey Divider


Action required

1. MuData failure handling goes untested 📘 Rule violation ☼ Reliability
Description
write_dataset_mudata now treats None as a successful best-effort outcome, but neither module
test drives that branch. The full test still requires one MuData file and the stub always creates
one, so regressions in the new failure-handling path can reach final quantification unnoticed.
Code

modules/bigbio/qpx/diann/main.nf[R79-82]

+if written is None:
+    print(
+        "WARNING: no MuData view was written; see the log above. "
+        "The qpx_output parquet views are complete and authoritative."
Evidence
Compliance rule 3 requires tests for functional final-quantification and output changes. The module
adds a None branch and makes the MuData output optional, but the full test requires one MuData
result and the stub test also expects the file that stub mode always creates.

AGENTS.md: Code Changes Must Include Appropriate DIA-NN Test Coverage
modules/bigbio/qpx/diann/main.nf[78-85]
modules/bigbio/qpx/diann/tests/main.nf.test[48-55]
modules/bigbio/qpx/diann/tests/main.nf.test[80-87]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The newly supported successful run without a MuData output has no test coverage.

## Fix Focus Areas
- modules/bigbio/qpx/diann/tests/main.nf.test[48-87]

## Recommended Fix
Add a test fixture that makes MuData construction return no file while preserving valid parquet outputs, then assert that the process succeeds, the dataset output exists, and the optional MuData channel is empty.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Sequence enrichment goes untested 📘 Rule violation ☼ Reliability
Description
QPX_DIANN accepts and forwards fasta, but both updated test invocations bind input 5 to []. No
test executes --fasta or checks sequence coverage, molecular weight, and protein-group positions,
so the workflow’s new search-database enrichment path is outside regression coverage.
Code

modules/bigbio/qpx/diann/tests/main.nf.test[43]

+                input[5] = []
Evidence
Compliance rule 3 requires functional DIA-NN changes to have tests that exercise the changed path.
The production module forwards a FASTA to QPX, while both module tests explicitly provide an empty
input and therefore cannot validate the enrichment behavior.

AGENTS.md: Code Changes Must Include Appropriate DIA-NN Test Coverage
modules/bigbio/qpx/diann/main.nf[41-56]
modules/bigbio/qpx/diann/tests/main.nf.test[36-55]
modules/bigbio/qpx/diann/tests/main.nf.test[67-87]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The tests supply no FASTA file, leaving the newly added sequence-enrichment behavior unexercised.

## Fix Focus Areas
- modules/bigbio/qpx/diann/tests/main.nf.test[13-61]

## Recommended Fix
Add a functional test fixture with a small FASTA containing known target sequences, pass it as input 5, and assert that the generated dataset contains the expected sequence coverage, molecular weight, and protein-group positions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Module registry formatting fails ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
modules.json now ends immediately after its closing brace without a newline. The configured
end-of-file normalization check therefore fails when it processes this changed registry file.
Code

modules.json[70]

+}
Evidence
Compliance rule 1 requires changed files to pass end-of-file normalization. The diff explicitly
marks the new final line of modules.json with No newline at end of file.

AGENTS.md: Code Must Pass Configured Formatting and Style Checks
modules.json[70-70]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`modules.json` does not end with a newline, causing the configured formatting check to fail.

## Fix Focus Areas
- modules.json[70-70]

## Recommended Fix
Add exactly one newline after the final closing brace.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Users expect a file that may be absent 🐞 Bug ⚙ Maintainability
Description
QPX_DIANN now marks *.h5mu optional and exits successfully when write_dataset_mudata returns
None, while meta.yml, the parameter schema, and both QPX guides still describe that file as an
unconditional output. When MuData construction fails, a successful export omits the documented
artifact, leaving users and metadata consumers to assume a deliverable exists when it does not.
Code

modules/bigbio/qpx/diann/main.nf[29]

+    path "*.h5mu"      , emit: mudata, optional: true
Evidence
The changed output declaration and writer branch explicitly allow a successful process with no
MuData file. Module metadata and user-facing descriptions still enumerate .h5mu as a normal
guaranteed result, whereas another module demonstrates the repository's established optional: true
metadata syntax.

modules/bigbio/qpx/diann/main.nf[25-30]
modules/bigbio/qpx/diann/main.nf[78-85]
modules/bigbio/qpx/diann/meta.yml[56-60]
modules/local/utils/mzml_statistics/meta.yml[22-31]
docs/output.md[114-125]
docs/usage.md[762-780]
nextflow_schema.json[634-647]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The process now legitimately succeeds without an `.h5mu` file, but module metadata and user-facing QPX documentation continue to promise that file unconditionally.

## Fix Focus Areas
- modules/bigbio/qpx/diann/meta.yml[56-60]
- docs/output.md[114-125]
- docs/usage.md[762-780]
- nextflow_schema.json[634-647]

## Recommended Fix
Mark the MuData output as optional in module metadata and update the schema and guides to state that Parquet files are authoritative and `.h5mu` is produced only when MuData construction succeeds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Database filenames can execute commands 🐞 Bug ⛨ Security
Description
fasta_arg concatenates the staged fasta path into the generated Bash command without shell
escaping. A schema-valid database basename containing metacharacters such as ; is parsed as shell
syntax when this module runs, reaching arbitrary commands in the task environment.
Code

modules/bigbio/qpx/diann/main.nf[41]

+    def fasta_arg = fasta ? "--fasta ${fasta}" : ''
Evidence
The database schema permits every non-whitespace character before the required extension, including
shell metacharacters. That user-provided path is passed to the new path(fasta) input, converted to
unquoted text, and inserted directly into the executed command.

nextflow_schema.json[115-123]
workflows/dia.nf[95-97]
workflows/dia.nf[416-427]
modules/bigbio/qpx/diann/main.nf[13-23]
modules/bigbio/qpx/diann/main.nf[41-57]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new FASTA argument embeds a staged filename directly into Bash, allowing schema-valid shell metacharacters to alter the command.

## Fix Focus Areas
- modules/bigbio/qpx/diann/main.nf[41-41]
- modules/bigbio/qpx/diann/tests/main.nf.test[13-55]

## Recommended Fix
Construct the optional FASTA argument using robust shell escaping, preserving `[]` as no argument. Add a module test whose FASTA basename contains a shell metacharacter and verify it is passed as one literal path without executing additional commands.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: ⚖️ Balanced: This changes workflow dataflow and optional-input semantics, container/runtime behavior, and MuData generation across multiple Nextflow and Python execution paths, so it warrants a complete single-pass 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

Comment thread modules.json Resolved
input[2] = file('${resultsDir.getAbsolutePath()}/PXD063291/PXD063291.sdrf.tsv')
input[3] = file('${resultsDir.getAbsolutePath()}/PXD063291/DiaNN/report.log.txt')
input[4] = "PXD063291"
input[5] = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Sequence enrichment goes untested 📘 Rule violation ☼ Reliability

QPX_DIANN accepts and forwards fasta, but both updated test invocations bind input 5 to []. No
test executes --fasta or checks sequence coverage, molecular weight, and protein-group positions,
so the workflow’s new search-database enrichment path is outside regression coverage.
Agent Prompt
## Issue description
The tests supply no FASTA file, leaving the newly added sequence-enrichment behavior unexercised.

## Fix Focus Areas
- modules/bigbio/qpx/diann/tests/main.nf.test[13-61]

## Recommended Fix
Add a functional test fixture with a small FASTA containing known target sequences, pass it as input 5, and assert that the generated dataset contains the expected sequence coverage, molecular weight, and protein-group positions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +79 to +82
if written is None:
print(
"WARNING: no MuData view was written; see the log above. "
"The qpx_output parquet views are complete and authoritative."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Mudata failure handling goes untested 📘 Rule violation ☼ Reliability

write_dataset_mudata now treats None as a successful best-effort outcome, but neither module
test drives that branch. The full test still requires one MuData file and the stub always creates
one, so regressions in the new failure-handling path can reach final quantification unnoticed.
Agent Prompt
## Issue description
The newly supported successful run without a MuData output has no test coverage.

## Fix Focus Areas
- modules/bigbio/qpx/diann/tests/main.nf.test[48-87]

## Recommended Fix
Add a test fixture that makes MuData construction return no file while preserving valid parquet outputs, then assert that the process succeeds, the dataset output exists, and the optional MuData channel is empty.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

def pg_arg = pg_matrix ? "--pg-matrix-path ${pg_matrix}" : ''
def log_arg = diann_log ? "--diann-log ${diann_log}" : ''
def acc_arg = project_accession ? "--project-accession ${project_accession}" : ''
def fasta_arg = fasta ? "--fasta ${fasta}" : ''

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

4. Database filenames can execute commands 🐞 Bug ⛨ Security

fasta_arg concatenates the staged fasta path into the generated Bash command without shell
escaping. A schema-valid database basename containing metacharacters such as ; is parsed as shell
syntax when this module runs, reaching arbitrary commands in the task environment.
Agent Prompt
## Issue description
The new FASTA argument embeds a staged filename directly into Bash, allowing schema-valid shell metacharacters to alter the command.

## Fix Focus Areas
- modules/bigbio/qpx/diann/main.nf[41-41]
- modules/bigbio/qpx/diann/tests/main.nf.test[13-55]

## Recommended Fix
Construct the optional FASTA argument using robust shell escaping, preserving `[]` as no argument. Add a module test whose FASTA basename contains a shell metacharacter and verify it is passed as one literal path without executing additional commands.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

path "*.h5mu" , emit: mudata
// Optional: the parquet views are the dataset's source of truth, so a MuData
// view that cannot be built must not destroy an otherwise complete run.
path "*.h5mu" , emit: mudata, optional: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

5. Users expect a file that may be absent 🐞 Bug ⚙ Maintainability

QPX_DIANN now marks *.h5mu optional and exits successfully when write_dataset_mudata returns
None, while meta.yml, the parameter schema, and both QPX guides still describe that file as an
unconditional output. When MuData construction fails, a successful export omits the documented
artifact, leaving users and metadata consumers to assume a deliverable exists when it does not.
Agent Prompt
## Issue description
The process now legitimately succeeds without an `.h5mu` file, but module metadata and user-facing QPX documentation continue to promise that file unconditionally.

## Fix Focus Areas
- modules/bigbio/qpx/diann/meta.yml[56-60]
- docs/output.md[114-125]
- docs/usage.md[762-780]
- nextflow_schema.json[634-647]

## Recommended Fix
Mark the MuData output as optional in module metadata and update the schema and guides to state that Parquet files are authoritative and `.h5mu` is produced only when MuData construction succeeds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

nf-core pipelines lint overall result: Passed ✅ ⚠️

Posted for pipeline commit 0a497f5

+| ✅ 108 tests passed       |+
#| ❔  19 tests were ignored |#
#| ❔   1 tests had warnings |#
!| ❗   4 tests had warnings |!
Details

❗ Test warnings:

  • files_exist - File not found: conf/igenomes.config
  • files_exist - File not found: conf/igenomes_ignored.config
  • files_exist - File not found: .github/workflows/awstest.yml
  • files_exist - File not found: .github/workflows/awsfulltest.yml

❔ Tests ignored:

❔ Tests fixed:

✅ Tests passed:

Run details

  • nf-core/tools version 4.1.0
  • Run at 2026-09-16 06:52:29

nf-core modules update rewrote the file without one, which the
end-of-file-fixer pre-commit hook rejects.
@ypriverol
ypriverol merged commit 27a04c8 into dev Sep 16, 2026
21 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