Repository navigation
chore(qpx): update the diann module and pass the search database - #125
Conversation
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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
PR Summary by QodoHarden QPX DIA-NN export and enrich proteins from search FASTA
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. MuData failure handling goes untested
|
| input[2] = file('${resultsDir.getAbsolutePath()}/PXD063291/PXD063291.sdrf.tsv') | ||
| input[3] = file('${resultsDir.getAbsolutePath()}/PXD063291/DiaNN/report.log.txt') | ||
| input[4] = "PXD063291" | ||
| input[5] = [] |
There was a problem hiding this comment.
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
| if written is None: | ||
| print( | ||
| "WARNING: no MuData view was written; see the log above. " | ||
| "The qpx_output parquet views are complete and authoritative." |
There was a problem hiding this comment.
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}" : '' |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
|
nf-core modules update rewrote the file without one, which the end-of-file-fixer pre-commit hook rejects.
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_mudatainstead ofbuild_mudata+mdata.write().build_mudatacatches 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).*.h5muis optional again, restoring qpx's contract: the parquet views are the source of truth and the MuData view is best-effort.Passing the search database
DIA-NN reports no protein sequences at all, so without a FASTA
pg.sequence_coverage,pg.molecular_weightandfeature.pg_positionsare always null. The workflow now passesch_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, sincech_searchdbalready 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 lintreports no errors inworkflows/dia.nfor the qpx module (the 22 errors it prints are pre-existingVersionUtils/BlockedFlagsreferences inmodules/local/diann/*).