From f9d25aad7fd6e9896b35552df3529e184c67ebc2 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 23 Feb 2022 10:59:24 +0100 Subject: [PATCH] Switch to native mandatory gzipped reading for hmmalign (#1343) * fix: remove left-over unnecessary code * Update main.nf * Update hmmer/hmmalign command to natively accept gzipped input * Making @drpatelh happy Co-authored-by: Moritz E. Beber Co-authored-by: Moritz E. Beber --- modules/hmmer/hmmalign/main.nf | 6 ++---- modules/hmmer/hmmalign/meta.yml | 9 +++++---- tests/modules/hmmer/hmmalign/main.nf | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/modules/hmmer/hmmalign/main.nf b/modules/hmmer/hmmalign/main.nf index d3df3c89..f8156e04 100644 --- a/modules/hmmer/hmmalign/main.nf +++ b/modules/hmmer/hmmalign/main.nf @@ -21,13 +21,11 @@ process HMMER_HMMALIGN { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def fastacmd = fasta.getExtension() == 'gz' ? "gunzip -c $fasta" : "cat $fasta" """ - $fastacmd | \\ - hmmalign \\ + hmmalign \\ $args \\ $hmm \\ - - | gzip -c > ${meta.id}.sthlm.gz + $fasta | gzip -c > ${meta.id}.sthlm.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/hmmer/hmmalign/meta.yml b/modules/hmmer/hmmalign/meta.yml index 296826d4..6c501120 100644 --- a/modules/hmmer/hmmalign/meta.yml +++ b/modules/hmmer/hmmalign/meta.yml @@ -19,12 +19,12 @@ input: e.g. [ id:'test' ] - fasta: type: file - description: Amino acid or nucleotide fasta file, gzipped or not - pattern: "*.{fna,fna.gz,faa,faa.gz,fasta,fasta.gz,fa,fa.gz}" + description: Amino acid or nucleotide gzipped compressed fasta file + pattern: "*.{fna.gz,faa.gz,fasta.gz,fa.gz}" - hmm: type: file - description: HMM file - pattern: "*.hmm" + description: A gzipped HMM file + pattern: "*.hmm.gz" output: - meta: @@ -43,3 +43,4 @@ output: authors: - "@erikrikarddaniel" + - "@jfy133" diff --git a/tests/modules/hmmer/hmmalign/main.nf b/tests/modules/hmmer/hmmalign/main.nf index 8758b124..0a462a7a 100644 --- a/tests/modules/hmmer/hmmalign/main.nf +++ b/tests/modules/hmmer/hmmalign/main.nf @@ -8,10 +8,10 @@ workflow test_hmmer_hmmalign { input = [ [ id:'test' ], // meta map - file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/e_coli_k12_16s.fna') // Change to params.test_data syntax after the data is included in tests/config/test_data.config + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz') // Change to params.test_data syntax after the data is included in tests/config/test_data.config ] - hmm = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/bac.16S_rRNA.hmm') + hmm = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz') HMMER_HMMALIGN ( input, hmm ) }