Skip to content

Conversation

@Krannich479
Copy link
Contributor

PR checklist

Closes #9657

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the module conventions in the contribution docs
  • If necessary, include test data in your PR.
  • Remove all TODO statements.
  • Broadcast software version numbers to topic: versions - See version_topics
  • Follow the naming conventions.
  • Follow the parameters requirements.
  • Follow the input/output options guidelines.
  • Add a resource label
  • Use BioConda and BioContainers if possible to fulfil software requirements.
  • Ensure that the test works with either Docker / Singularity. Conda CI tests can be quite flaky:
    • For modules:
      • nf-core modules test <MODULE> --profile docker
      • nf-core modules test <MODULE> --profile singularity
      • nf-core modules test <MODULE> --profile conda
    • For subworkflows:
      • nf-core subworkflows test <SUBWORKFLOW> --profile docker
      • nf-core subworkflows test <SUBWORKFLOW> --profile singularity
      • nf-core subworkflows test <SUBWORKFLOW> --profile conda

Summary

This PR adds samtools quickcheck to the nf-core modules. As opposed to many other tools, this samtools submodule does not return an output file. Instead, the command returns a non-zero exit code if the alignment file (SAM/BAM/CRAM) is invalid/malformatted.
The nf-core module specification does not strictly require output files. The idea here is to use the exit code of samtools for it's native behavior, i.e. the exit code determines the success of the nextflow workflow (regulated by the errorStrategy). If the input channel contains an invalid alignment file, the nf-core module returns a non-zero exit code and terminates the main worflow.

@Krannich479 Krannich479 self-assigned this Jan 16, 2026
Copy link
Contributor

@prototaxites prototaxites left a comment

Choose a reason for hiding this comment

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

A thought about how this might be made more malleable to pipeline developers.

I wonder if linting is failing because the module has no "ordinary" outputs?

@@ -0,0 +1,139 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:

Comment on lines +15 to +19
/* There is not generated output files.
The sole purpose of 'samtools quickcheck' is to return an error if the mapping file is malformatted.
The purpose in of the Nextflow process is to break the main workflow (by default) if the script returns a non-zero exit code.
The nf-core components guidelines (https://nf-co.re/docs/guidelines/components/modules) do not specify that there must be output files.
*/
Copy link
Contributor

@prototaxites prototaxites Jan 19, 2026

Choose a reason for hiding this comment

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

Suggestion: instead of erroring the process, we should capture the exitcode in the script and then return it.

This allows more flexibility to the module user - they can iterate over the outputs of the module and either filter out failed BAM files, throw an error, try and fix problems, etc.. - rather than just forcing the pipeline to die.

Suggested change
/* There is not generated output files.
The sole purpose of 'samtools quickcheck' is to return an error if the mapping file is malformatted.
The purpose in of the Nextflow process is to break the main workflow (by default) if the script returns a non-zero exit code.
The nf-core components guidelines (https://nf-co.re/docs/guidelines/components/modules) do not specify that there must be output files.
*/
tuple val(meta), path(bam), env("EXIT_CODE")

Comment on lines +28 to +30
samtools quickcheck \\
$args \\
$bam
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
samtools quickcheck \\
$args \\
$bam
samtools quickcheck \\
$args \\
$bam || EXIT_CODE=\$?
EXIT_CODE=\${EXIT_CODE:-0}

stub:
def args = task.ext.args ?: ''
"""
echo $args
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
echo $args
EXIT_CODE=0
echo $args

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.

new module: samtools/quickcheck

2 participants