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 <midnighter@posteo.net>

Co-authored-by: Moritz E. Beber <midnighter@posteo.net>
This commit is contained in:
James A. Fellows Yates 2022-02-23 10:59:24 +01:00 committed by GitHub
parent 2383d43a0f
commit f9d25aad7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

View file

@ -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 \\
$args \\
$hmm \\
- | gzip -c > ${meta.id}.sthlm.gz
$fasta | gzip -c > ${meta.id}.sthlm.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":

View file

@ -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"

View file

@ -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 )
}