Skip to content

fix(modules): replace invalid touch .gz stubs with valid gzip#11312

Merged
mashehu merged 8 commits into
nf-core:masterfrom
HReed1:fix-stub-gz-issue-5409
Apr 28, 2026
Merged

fix(modules): replace invalid touch .gz stubs with valid gzip#11312
mashehu merged 8 commits into
nf-core:masterfrom
HReed1:fix-stub-gz-issue-5409

Conversation

@HReed1
Copy link
Copy Markdown
Contributor

@HReed1 HReed1 commented Apr 26, 2026

Description

Fixes #5409. Replaces touch filename.gz with echo '' | gzip > filename.gz in stub blocks for 8 modules. Empty files created by touch are not valid gzip and cause EOFException in nf-test snapshot assertions.

After this PR, git grep -cP "touch .*\.gz(\\s+.*)*$" -- 'modules/' returns zero matches across the entire repository.

Modules Fixed

Fix Pattern

- touch ${prefix}.output.vcf.gz
+ echo '' | gzip > ${prefix}.output.vcf.gz

PR Checklist

  • This comment contains all information about changes made
  • All touch filename.gz replaced with echo '' | gzip > filename.gz
  • No other changes to module logic, meta.yml, or tests
  • Snapshot updates may be needed — happy to run nf-core modules test --update if requested

@HReed1
Copy link
Copy Markdown
Contributor Author

HReed1 commented Apr 26, 2026

@nf-core-bot fix linting

Fixes nf-core#5409. Replaces `touch filename.gz` with `echo '' | gzip > filename.gz`
in stub blocks for 8 modules. Empty files created by `touch` are not valid
gzip and cause `EOFException` in nf-test snapshot assertions.

Modules fixed:
- bowtie2/align (unmapped .fastq.gz stubs)
- gatk4/haplotypecaller
- metamdbg/asm
- pharokka/installdatabases
- popscle/freemuxlet
- rastair/methylkit
- staramr/search
- vt/decomposeblocksub
@HReed1 HReed1 force-pushed the fix-stub-gz-issue-5409 branch from 6cf2e08 to d02fd2f Compare April 26, 2026 21:58
@HReed1
Copy link
Copy Markdown
Contributor Author

HReed1 commented Apr 26, 2026

CI Lint Failures — Pre-existing, Unrelated to This PR

The 4 remaining lint failures are pre-existing issues on master, unrelated to the touch → echo "" | gzip > stub fix in this PR:

Module Failing Lint Test Related to this PR?
popscle/freemuxlet main_nf_version_topic ❌ No — module does not emit software versions as topic
rastair/methylkit main_nf_version_topic, bioconda_latest, container_links ❌ No — outdated conda/container + missing version topic
staramr/search main_nf_version_topic, bioconda_latest ❌ No — outdated conda + missing version topic
vt/decomposeblocksub main_nf_version_topic ❌ No — missing version topic emit

These modules already fail nf-core modules lint on the current master branch. The only change in this PR is replacing touch filename.gz with echo "" | gzip > filename.gz in stub blocks — no other module logic, version emits, or container definitions were modified.

The 4 modules that only had the stub issue (bowtie2/align, gatk4/haplotypecaller, metamdbg/asm, pharokka/installdatabases) all pass lint cleanly ✅

@HReed1 HReed1 marked this pull request as ready for review April 26, 2026 22:05
@HReed1 HReed1 requested a review from maxulysse as a code owner April 26, 2026 22:05
@HReed1 HReed1 self-assigned this Apr 26, 2026
Comment thread modules/nf-core/bowtie2/align/main.nf Outdated
create_unmapped = save_unaligned ? "echo '' | gzip > ${prefix}.unmapped.fastq.gz" : ""
} else {
create_unmapped = save_unaligned ? "touch ${prefix}.unmapped_1.fastq.gz && touch ${prefix}.unmapped_2.fastq.gz" : ""
create_unmapped = save_unaligned ? "echo '' | gzip > ${prefix}.unmapped_1.fastq.gz && echo '' | gzip > ${prefix}.unmapped_2.fastq.gz" : ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
create_unmapped = save_unaligned ? "echo '' | gzip > ${prefix}.unmapped_1.fastq.gz && echo '' | gzip > ${prefix}.unmapped_2.fastq.gz" : ""
create_unmapped = save_unaligned ? "echo | gzip > ${prefix}.unmapped_1.fastq.gz && echo | gzip > ${prefix}.unmapped_2.fastq.gz" : ""

FYI: just echo | gzip is enough :) but as is is fine

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out! I had templated echo "" uniformly in my local AST mutation script to be overly cautious, but I agree your suggestion is much cleaner. I'm going to go ahead and make those updates. Brb!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated! All 8 modules now use echo | gzip > with the quotes dropped, as suggested. Pushed as a new commit.

Separately, while building the AST mutation script for this fix, my analysis also flagged ~44 additional modules that are completely missing stub: blocks entirely. I'm tracking that work under 4570 to keep this PR scoped strictly to the touch .gz → echo | gzip fix.

Comment thread modules/nf-core/gatk4/haplotypecaller/main.nf Outdated
@famosab
Copy link
Copy Markdown
Contributor

famosab commented Apr 27, 2026

I think you either need to swap the failed modules to topics as well here or @mashehu overwrites and merges :D

@mashehu
Copy link
Copy Markdown
Contributor

mashehu commented Apr 27, 2026

i can force merge, once @famosab suggestions have been accepted

@HReed1 HReed1 enabled auto-merge April 27, 2026 18:31
Comment thread modules/nf-core/gatk4/haplotypecaller/main.nf Outdated
@famosab
Copy link
Copy Markdown
Contributor

famosab commented Apr 28, 2026

I think we are good to go @mashehu

@mashehu mashehu disabled auto-merge April 28, 2026 15:00
@mashehu mashehu merged commit b73338e into nf-core:master Apr 28, 2026
8 of 15 checks passed
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.

Module stub that touch .gz break snapshots in nf-test

3 participants