nf-core / nf-core/seqinspector

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

Open Beginner friendly
#254 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Nextflow
Stars
28
Forks
44
Avg merge
11d 8h
Merged PRs (30d)
2

Description


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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with modules/nf-core/seqtk/sample/main.nf and inspect the declared output glob alongside the script's preserved input extension. Reproduce with .fq.gz inputs and a non-zero --sample_size, then verify that the produced files are collected successfully for both .fq.gz and .fastq.gz inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
bioinformatics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.