Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 29 additions & 26 deletions modules/bigbio/pmultiqc/main.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
process PMULTIQC {
tag "$meta.id"
label 'process_high'

conda "${moduleDir}/environment.yml"
Expand All @@ -8,42 +7,46 @@ process PMULTIQC {
'biocontainers/pmultiqc:0.0.39--pyhdfd78af_0' }"

input:
val meta
path results
path 'results/*'
path quantms_log
Comment on lines +10 to +11
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for any usage of quantms_log in the codebase
rg -n 'quantms_log' --type=nf

Repository: bigbio/nf-modules

Length of output: 87


🏁 Script executed:

#!/bin/bash
# Read the main.nf file to see the full context
cat -n modules/bigbio/pmultiqc/main.nf | head -60

Repository: bigbio/nf-modules

Length of output: 2055


🏁 Script executed:

#!/bin/bash
# Search for similar wildcard input patterns in other Nextflow modules
rg "path\s+'[^']+/\*'" --type=nf -A 2

Repository: bigbio/nf-modules

Length of output: 87


🏁 Script executed:

#!/bin/bash
# Search for quantms_log usage without file type restriction
rg 'quantms_log' -n

Repository: bigbio/nf-modules

Length of output: 116


🏁 Script executed:

#!/bin/bash
# Search for wildcard path patterns in Nextflow files
rg "path\s+'" -n | grep -E "\*'|/\*'" | head -20

Repository: bigbio/nf-modules

Length of output: 115


🏁 Script executed:

#!/bin/bash
# Check the broader context of the PR to understand the change
git log --oneline -10 -- modules/bigbio/pmultiqc/main.nf

Repository: bigbio/nf-modules

Length of output: 114


Remove the unused quantms_log input and clarify the wildcard staging pattern.

The quantms_log input is declared at line 10 but is never referenced in the script—it's dead code and should be removed.

The wildcard pattern path 'results/*' is unusual for Nextflow inputs. This is the only occurrence of this pattern in the codebase. Clarify whether this is intentional (to stage individual files into a results/ subdirectory) or if it should be path 'results' to stage the directory itself. The script logic at line 32 (cat results/*openms_design.tsv) and line 43 (./results) suggests the latter is expected.

🤖 Prompt for AI Agents
In modules/bigbio/pmultiqc/main.nf around lines 9–10, remove the unused
`quantms_log` input declaration and change the unusual `path 'results/*'`
staging pattern to `path 'results'` so the whole directory is staged (this
matches downstream uses like `cat results/*openms_design.tsv` and executing
`./results`); update any tests or documentation if they relied on per-file
staging and run the pipeline to confirm file paths still resolve.


output:
tuple val(meta), path("*.html"), emit: report
path "*.db", optional: true, emit: quantmsdb
path "*.html", emit: ch_pmultiqc_report
path "*.db", optional: true, emit: ch_pmultiqc_db
path "versions.yml", emit: versions
path "*_data", emit: data

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def disable_pmultiqc = (params.enable_pmultiqc) && (params.export_mztab) ? "--quantms_plugin" : ""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Misleading variable name.

The variable disable_pmultiqc actually enables the quantms plugin when conditions are met, making the code confusing to maintain. Consider renaming to better reflect its purpose.

🔎 Proposed fix
-def disable_pmultiqc = (params.enable_pmultiqc) && (params.export_mztab) ? "--quantms_plugin" : ""
+def enable_quantms_plugin = (params.enable_pmultiqc) && (params.export_mztab) ? "--quantms_plugin" : ""

And update line 36 accordingly:

-    ${disable_pmultiqc} \\
+    ${enable_quantms_plugin} \\

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In modules/bigbio/pmultiqc/main.nf around line 20, the variable name
`disable_pmultiqc` is misleading because it actually sets the quantms plugin
flag when enabled; rename it to something clear like `pmultiqc_quantms_flag` (or
`enable_pmultiqc_quantms`) and update all usages (notably the reference at line
36) to use the new name so the variable meaning matches its behavior; keep the
ternary expression and value unchanged, only rename the identifier and adjust
any downstream references accordingly.

def disable_table_plots = (params.enable_pmultiqc) && (params.skip_table_plots) ? "--disable_table" : ""
def disable_idxml_index = (params.enable_pmultiqc) && (params.pmultiqc_idxml_skip) ? "--ignored_idxml" : ""
def contaminant_affix = params.contaminant_string ? "--contaminant_affix ${params.contaminant_string}" : ""

"""
multiqc \\
--force \\
--filename ${prefix}_multiqc_report \\
${args} \\
.
set -x
set -e

cat <<END_VERSIONS > versions.yml
"PMULTIQC":
pmultiqc: \$(python -c "from importlib.metadata import version; print(version('pmultiqc'))" 2>/dev/null || echo "0.0.39")
END_VERSIONS
"""
# leaving here to ease debugging
ls -lcth *

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
cat results/*openms_design.tsv
Comment on lines +27 to +33
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Risk of script failure and debug artifacts.

Two concerns:

  1. Line 32: The cat results/*openms_design.tsv command will fail if the file doesn't exist. Combined with set -e (line 27), this will halt execution. Consider adding existence checks or making this command optional.

  2. Lines 29-30, 32: Debug commands (ls and cat) are left in production code. While the comment indicates they're for debugging, consider removing them or making them conditional on a debug flag.

🔎 Proposed fix for safer file handling
-cat results/*openms_design.tsv
+if ls results/*openms_design.tsv 1> /dev/null 2>&1; then
+    cat results/*openms_design.tsv
+fi
🤖 Prompt for AI Agents
In modules/bigbio/pmultiqc/main.nf around lines 26 to 32, the script uses set -e
and includes unconditional debug commands (ls -lcth * and cat
results/*openms_design.tsv) which will either leak debug artifacts in production
or cause the job to fail if the target file is missing; replace these with
conditional checks and a debug flag: add a DEBUG environment variable or
Nextflow parameter that when true runs the ls and cat for debugging, and guard
the cat with an existence check (e.g., test -f results/*openms_design.tsv or
iterate files) or append || true to avoid exiting under set -e when the file is
absent, ensuring production runs don't fail or print debug output unless
explicitly requested.


"""
touch '${prefix}_multiqc_report.html'
mkdir '${prefix}_multiqc_report_data'

cat <<END_VERSIONS > versions.yml
"PMULTIQC":
pmultiqc: \$(python -c "from importlib.metadata import version; print(version('pmultiqc'))" 2>/dev/null || echo "0.0.39")
END_VERSIONS
multiqc \\
-f \\
${disable_pmultiqc} \\
--config ./results/multiqc_config.yml \\
${args} \\
${disable_table_plots} \\
${disable_idxml_index} \\
${contaminant_affix} \\
--quantification_method $params.quantification_method \\
./results \\
-o .
Comment on lines +35 to +45
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, find the file and read it to understand the context around lines 34-44
find . -name "main.nf" -path "*/pmultiqc/*" | head -5

Repository: bigbio/nf-modules

Length of output: 94


🏁 Script executed:

# Search for the pmultiqc module
fd -p "pmultiqc" -t d | head -10

Repository: bigbio/nf-modules

Length of output: 116


🏁 Script executed:

# Read the main.nf file to see full context
cat -n ./modules/bigbio/pmultiqc/main.nf

Repository: bigbio/nf-modules

Length of output: 2055


🏁 Script executed:

# Search for quantification_method parameter in config files
rg -n 'quantification_method' --type=nf -g '*.config' -g 'nextflow.config'

Repository: bigbio/nf-modules

Length of output: 87


🏁 Script executed:

# Also search in all files to understand where this parameter is defined
rg -n 'quantification_method' --max-count=20

Repository: bigbio/nf-modules

Length of output: 298


🏁 Script executed:

# Read the meta.yml to understand the parameter better
cat -n ./modules/bigbio/pmultiqc/meta.yml

Repository: bigbio/nf-modules

Length of output: 2443


🏁 Script executed:

# Search for nextflow.config files to see if quantification_method is defined there
fd -n 'nextflow.config' -o 'config.nf' | head -10

Repository: bigbio/nf-modules

Length of output: 291


🏁 Script executed:

# Search for where this parameter might be defined as a workflow parameter
rg -n 'params\.' -g 'nextflow.config' -g '*.config' | grep -i 'quantification' | head -20

Repository: bigbio/nf-modules

Length of output: 43


🏁 Script executed:

# Find all config files
fd 'nextflow.config' -o '\.config$'

Repository: bigbio/nf-modules

Length of output: 198


🏁 Script executed:

# Check the tests directory for pmultiqc to see how it's configured
find ./modules/bigbio/pmultiqc/tests -type f | head -20

Repository: bigbio/nf-modules

Length of output: 364


🏁 Script executed:

# Look for where quantification_method might be set with a default
rg 'quantification_method\s*=' -B2 -A2

Repository: bigbio/nf-modules

Length of output: 43


🏁 Script executed:

# Read the test nextflow.config files to see how parameters are set
cat -n ./modules/bigbio/pmultiqc/tests/nextflow.config

Repository: bigbio/nf-modules

Length of output: 335


🏁 Script executed:

# Read the quantms variant config
cat -n ./modules/bigbio/pmultiqc/tests/nextflow.config.quantms

Repository: bigbio/nf-modules

Length of output: 427


🏁 Script executed:

# Check if multiqc_config.yml exists in tests
cat -n ./modules/bigbio/pmultiqc/tests/multiqc_config.yml | head -30

Repository: bigbio/nf-modules

Length of output: 149


🏁 Script executed:

# Read the base test config to see if quantification_method is defined
cat -n ./tests/config/nextflow.config

Repository: bigbio/nf-modules

Length of output: 1737


🏁 Script executed:

# Check if there's test_data.config that might define parameters
cat -n ./tests/config/test_data.config | head -50

Repository: bigbio/nf-modules

Length of output: 1875


🏁 Script executed:

# Read the test file to understand how PMULTIQC is invoked
cat -n ./modules/bigbio/pmultiqc/tests/main.nf.test | head -80

Repository: bigbio/nf-modules

Length of output: 3634


🏁 Script executed:

# Continue reading the test file to see if quantification_method is set somewhere
tail -n +50 ./modules/bigbio/pmultiqc/tests/main.nf.test | head -100

Repository: bigbio/nf-modules

Length of output: 3766


🏁 Script executed:

# Search for any default value for quantification_method in the entire codebase
rg 'quantification_method' -B3 -A3

Repository: bigbio/nf-modules

Length of output: 1104


🏁 Script executed:

# Check if there's a default value set anywhere by looking more broadly
rg 'params\.' ./modules/bigbio/pmultiqc/main.nf -A1 -B1

Repository: bigbio/nf-modules

Length of output: 653


🏁 Script executed:

# Check for any conditional usage of quantification_method
rg -C5 'quantification_method' ./modules/bigbio/pmultiqc/main.nf

Repository: bigbio/nf-modules

Length of output: 390


🏁 Script executed:

# Look for parent workflows that might define quantification_method
fd 'workflow.nf' | head -10

Repository: bigbio/nf-modules

Length of output: 43


🏁 Script executed:

# Check if there are any parent configs or if this module is part of a larger workflow
find . -maxdepth 2 -name 'nextflow.config' -type f

Repository: bigbio/nf-modules

Length of output: 43


🏁 Script executed:

# Look at the test more carefully - especially what parameters might be passed
tail -n +100 ./modules/bigbio/pmultiqc/tests/main.nf.test | head -50

Repository: bigbio/nf-modules

Length of output: 1894


🏁 Script executed:

# Check the entire test file to see if there's a quantms_plugin test that would set quantification_method
wc -l ./modules/bigbio/pmultiqc/tests/main.nf.test

Repository: bigbio/nf-modules

Length of output: 109


🏁 Script executed:

# Look at the rest of the test file, particularly the quantms test
tail -n 100 ./modules/bigbio/pmultiqc/tests/main.nf.test

Repository: bigbio/nf-modules

Length of output: 3746


🏁 Script executed:

# Check if nextflow.config.quantms sets the quantification_method parameter
cat -n ./modules/bigbio/pmultiqc/tests/nextflow.config.quantms

Repository: bigbio/nf-modules

Length of output: 427


🏁 Script executed:

# Search for where this pmultiqc module is called from to see if quantification_method is set by the caller
rg 'PMULTIQC' --type=nf | grep -v test | grep -v '\.snap'

Repository: bigbio/nf-modules

Length of output: 87


🏁 Script executed:

# Check if there's documentation about required parameters
find . -name 'README.md' -exec grep -l 'quantification_method' {} \;

Repository: bigbio/nf-modules

Length of output: 43


🏁 Script executed:

# Look for any parent workflow configuration that might set these parameters
rg 'params\.quantification_method' -g '*.nf' -g '*.config'

Repository: bigbio/nf-modules

Length of output: 157


🏁 Script executed:

# Check if the tests actually pass with the current setup
# by looking at the test snapshot results
cat -n ./modules/bigbio/pmultiqc/tests/main.nf.test.snap

Repository: bigbio/nf-modules

Length of output: 2228


🏁 Script executed:

# Search the entire repository to see if quantification_method is set as a parameter anywhere
rg 'quantification_method' -C3

Repository: bigbio/nf-modules

Length of output: 1104


Add validation for required parameters and config file.

The code uses $params.quantification_method and ./results/multiqc_config.yml unconditionally without checking if they exist. This is inconsistent with how other optional parameters are handled (e.g., contaminant_affix uses a conditional expression). While tests pass because they provide these values, the code should either:

  1. Make both parameters conditional (like contaminant_affix), or
  2. Add validation to ensure they're defined before the multiqc command executes

Consider aligning with the pattern used for contaminant_affix on line 23, which checks if the parameter exists before adding it to the command.

🤖 Prompt for AI Agents
In modules/bigbio/pmultiqc/main.nf around lines 34 to 44, the multiqc invocation
uses $params.quantification_method and ./results/multiqc_config.yml
unconditionally; update the script to either (A) conditionally append the
quantification method and config args in the command only when
params.quantification_method is defined and the config file exists (following
the same pattern used for contaminant_affix), or (B) add an explicit validation
early in the task that checks params.quantification_method is set and
./results/multiqc_config.yml exists and fail fast with a clear error message;
choose one approach and apply it consistently for both the quantification_method
and the config file.


cat <<-END_VERSIONS > versions.yml
"${task.process}":
pmultiqc: \$(multiqc --pmultiqc_version | sed -e "s/pmultiqc, version //g")
END_VERSIONS
Comment on lines +47 to +50
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

pmultiqc MultiQC plugin --pmultiqc_version flag documentation

💡 Result:

I couldn't find any documented --pmultiqc_version flag in the pmultiqc or MultiQC documentation or source. The official pmultiqc docs and package pages list its command-line options but do not include that flag. See the pmultiqc GitHub and PyPI pages for the documented options. [1][2]

Would you like me to (a) search the pmultiqc source tree for an undocumented/hidden flag, (b) check a specific pmultiqc version/release, or (c) inspect your local installation (if you can paste output of multiqc --help or pip show pmultiqc)?

Sources:

  • pmultiqc GitHub repository (options & README). [1]
  • pmultiqc PyPI project page (release / usage). [2]

🌐 Web query:

multiqc --version flag and pmultiqc version reporting methods

💡 Result:

Short answer:

  • multiqc --version: prints the installed MultiQC package version and exits (e.g. "multiqc, version 1.20") — same as shown in the Quick Start/docs. [1]

  • How MultiQC reports versions in reports: MultiQC attempts to auto-detect tool versions from tool log output and shows them inline and in a "Software Versions" table. You can (a) supply manual versions in a MultiQC config under software_versions, (b) provide standalone YAML version files, or (c) disable automatic detection with disable_version_detection or hide the versions section with skip_versions_section. [2]

  • pmultiqc (the proteomics MultiQC plugin): pmultiqc is a MultiQC module/plugin — when installed it adds its own section(s) to the MultiQC report and the report's "About" area will show the MultiQC version used to generate the report. pmultiqc-specific metadata/versions are reported like other modules (from logs or via the manual software_versions YAML/config). See the pmultiqc docs/GitHub for plugin behavior and example reports. [3][2]

Sources:

  1. MultiQC Quick Start / running docs (example of multiqc --version). [1]
  2. MultiQC documentation — listing software versions, config options (software_versions, disable_version_detection, skip_versions_section). [2]
  3. pmultiqc project/docs & example reports (pmultiqc module appears in report and example reports show MultiQC version in "About"). [3]

🌐 Web query:

pmultiqc GitHub repository source code --pmultiqc_version flag implementation

💡 Result:

Do you want (A) the exact file/lines in the pmultiqc GitHub repo that implement the --pmultiqc_version flag, (B) a short explanation of how that flag is implemented, or (C) both?


🌐 Web query:

pmultiqc GitHub repository exact file and line numbers implementing --pmultiqc_version flag

💡 Result:

I can find that for you — do you mean the bigbio/pmultiqc GitHub repo (which branch or tag/version)? If so I’ll search the repository and return the exact file path(s) and line numbers that implement the --pmultiqc_version flag. Which branch/version should I use?


🏁 Script executed:

find . -type f -name "*.nf" | xargs rg -l "versions\.yml" | head -10

Repository: bigbio/nf-modules

Length of output: 171


🏁 Script executed:

cat -n ./modules/bigbio/pmultiqc/main.nf | head -60

Repository: bigbio/nf-modules

Length of output: 2055


🏁 Script executed:

cat -n ./modules/bigbio/thermorawfileparser/main.nf | grep -A 5 "versions.yml"

Repository: bigbio/nf-modules

Length of output: 691


🏁 Script executed:

cat -n ./modules/bigbio/onsite/main.nf | grep -A 5 "versions.yml"

Repository: bigbio/nf-modules

Length of output: 528


🏁 Script executed:

rg "pmultiqc_version" . --type nf

Repository: bigbio/nf-modules

Length of output: 87


🏁 Script executed:

rg "pmultiqc_version" .

Repository: bigbio/nf-modules

Length of output: 178


🌐 Web query:

how to get pmultiqc version installed pip show pmultiqc python import

💡 Result:

Ways to get the installed pmultiqc version:

  1. From pip (shell):
  • pip show pmultiqc
  • pip list | grep pmultiqc
    (works for packages installed into the active Python environment). [1]
  1. From Python by checking the package (if it exposes version):
  • python -c "import pmultiqc; print(pmultiqc.version)"
  1. From Python using importlib.metadata (recommended, works even if package has no version):
  • Python 3.8+: python -c "from importlib.metadata import version; print(version('pmultiqc'))"
  • For older Pythons, install backport and use: python -c "from importlib_metadata import version; print(version('pmultiqc'))". [2]

References:

  • pmultiqc on PyPI / project pages. [1]
  • importlib.metadata documentation (version() / distribution). [2]
  • pmultiqc GitHub / docs (install/usage). [3]

Fix the version extraction command; --pmultiqc_version is not a supported MultiQC flag.

The command multiqc --pmultiqc_version does not exist and will cause the process to fail. The standard multiqc --version outputs "multiqc, version X.X", not pmultiqc-specific versions. Use pip show pmultiqc or python -c "from importlib.metadata import version; print(version('pmultiqc'))" to extract the pmultiqc version instead.

🤖 Prompt for AI Agents
In modules/bigbio/pmultiqc/main.nf around lines 46 to 49, the current version
extraction uses the unsupported flag `multiqc --pmultiqc_version`; replace that
with a command that queries the pmultiqc package itself (for example `pip show
pmultiqc` or `python -c "from importlib.metadata import version;
print(version('pmultiqc'))"`) and write that output into versions.yml under the
pmultiqc key; ensure you capture stderr/out properly and strip any extraneous
text so the value is just the version string.

"""
}
Loading