Skip to content

SEQTK_SAMPLE fails on .fq.gz inputs — output glob *.fastq.gz misses the preserved input extension #254

Description

@adamjtaylor

Description of the bug

When --sample_size is set to a non-zero value, SEQTK_SAMPLE fails for any input whose filename ends in .fq.gz (rather than .fastq.gz):

MissingFileException: Missing output file(s) `*.fastq.gz` expected by process
`NFCORE_SEQINSPECTOR:SEQINSPECTOR:SEQTK_SAMPLE (<sample>)`

The seqtk command itself succeeds (exit 0), but Nextflow cannot collect the output because the produced file ends in .fq.gz, while the process declares its output as *.fastq.gz.

This is an internal inconsistency: the samplesheet schema (assets/schema_input.json) explicitly accepts .fq.gz for fastq_1/fastq_2, but SEQTK_SAMPLE can only capture .fastq.gz. .fq/.fq.gz is a standard FASTQ extension and is common in public archives, so this breaks otherwise-valid inputs whenever subsampling is enabled.

Root causemodules/nf-core/seqtk/sample/main.nf:

output:
tuple val(meta), path("*.fastq.gz"), emit: reads          // only *.fastq.gz

script:
"""
printf "%s\\n" $reads | while read f;
do
    seqtk sample $args \$f $sample_size \\
        | gzip --no-name > ${prefix}_\$(basename \$f)      // preserves input ext -> .fq.gz stays .fq.gz
done
"""

${prefix}_$(basename $f) keeps the input extension, so G073_1.fq.gz<prefix>_G073_1.fq.gz, which *.fastq.gz never matches.

Suggested fix — broaden the output pattern:

tuple val(meta), path("*.{fastq,fq}.gz"), emit: reads

or normalize the emitted name to a canonical .fastq.gz in the script (also gives consistent downstream filenames). (Note: seqtk/sample is a shared nf-core/modules module, so the fix likely belongs there.)

Runs with the default --sample_size 0 succeed, since SEQTK_SAMPLE is not invoked.


Command used and terminal output

$ nextflow run nf-core/seqinspector -r 1.0.1 \
    -profile <...> \
    --input samplesheet.csv \        # fastq_1/fastq_2 point to *.fq.gz files
    --outdir results \
    --sample_size 2000000

ERROR ~ Error executing process > 'NFCORE_SEQINSPECTOR:SEQINSPECTOR:SEQTK_SAMPLE (<sample>)'
Caused by:
  Missing output file(s) `*.fastq.gz` expected by process
  `NFCORE_SEQINSPECTOR:SEQINSPECTOR:SEQTK_SAMPLE (<sample>)`

Command executed:
  printf "%s\n" G073_1.fq.gz G073_2.fq.gz | while read f;
  do
      seqtk sample -s100 $f 2000000 | gzip --no-name > <prefix>_$(basename $f)
  done

Command exit status: 0

Relevant files

.nextflow.log available on request. Minimal repro: any samplesheet whose fastq_1/fastq_2 end in .fq.gz, run with --sample_size > 0.


System information

  • Nextflow version: 25.10.2
  • Hardware: Cloud
  • Executor: awsbatch
  • Container engine: Docker
  • OS: Amazon Linux 2 (AWS Batch)
  • Version of nf-core/seqinspector: 1.0.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions