Add postprocessing option to hmmer/eslreformat (#2061)

* Add postprocessing option to hmmer/eslreformat

* Update tests/modules/hmmer/eslreformat/nextflow.config

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>

* Update modules/hmmer/eslreformat/main.nf

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>
This commit is contained in:
Daniel Lundin 2022-09-14 18:43:50 +02:00 committed by GitHub
parent 8c0127e071
commit 885e724e07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 8 deletions

View file

@ -18,15 +18,16 @@ process HMMER_ESLREFORMAT {
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
// Use for any postprocessing of the sequence file, e.g. removal of gap characters
def postproc = task.ext.postprocessing ?: ""
"""
esl-reformat \\
-o ${prefix}.sequences \\
$args \\
$seqfile
gzip ${prefix}.sequences
$seqfile \\
$postproc \\
| gzip -c > ${prefix}.sequences.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":

View file

@ -2,8 +2,9 @@
nextflow.enable.dsl = 2
include { HMMER_HMMALIGN } from '../../../../modules/hmmer/hmmalign/main.nf'
include { HMMER_ESLREFORMAT as HMMER_ESLREFORMAT_AFA } from '../../../../modules/hmmer/eslreformat/main.nf'
include { HMMER_HMMALIGN } from '../../../../modules/hmmer/hmmalign/main.nf'
include { HMMER_ESLREFORMAT as HMMER_ESLREFORMAT_AFA } from '../../../../modules/hmmer/eslreformat/main.nf'
include { HMMER_ESLREFORMAT as HMMER_ESLREFORMAT_UNALIGN } from '../../../../modules/hmmer/eslreformat/main.nf'
workflow test_hmmer_eslreformat_afa {
@ -18,3 +19,17 @@ workflow test_hmmer_eslreformat_afa {
HMMER_ESLREFORMAT_AFA ( HMMER_HMMALIGN.out.sthlm )
}
workflow test_hmmer_eslreformat_unalign {
input = [
[ id:'test' ], // meta map
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/hmmer/bac.16S_rRNA.hmm.gz')
HMMER_HMMALIGN ( input, hmm )
HMMER_ESLREFORMAT_UNALIGN ( HMMER_HMMALIGN.out.sthlm )
}

View file

@ -6,4 +6,9 @@ process {
ext.args = 'afa'
}
withName: HMMER_ESLREFORMAT_UNALIGN {
ext.args = '--gapsym=- afa'
ext.postprocessing = '| sed "/^>/!s/-//g"'
}
}

View file

@ -7,6 +7,20 @@
- path: output/hmmer/test.sequences.gz
contains:
- ">CP025268.1"
- "aaa---UUGAAGAGUUUGAUCAUGGCUCAGAUUGAACGCUGGCGGCAGGCCUAACACAUG"
- path: output/hmmer/versions.yml
contains:
- "easel:"
- name: hmmer eslreformat test_hmmer_eslreformat_unalign
command: nextflow run ./tests/modules/hmmer/eslreformat -entry test_hmmer_eslreformat_unalign -c ./tests/config/nextflow.config -c ./tests/modules/hmmer/eslreformat/nextflow.config
tags:
- hmmer/eslreformat
- hmmer
files:
- path: output/hmmer/test.sequences.gz
contains:
- ">CP025268.1"
- "aaaUUGAAGAGUUUGAUCAUGGCUCAGAUUGAACGCUGGCGGCAGGCCUAACACAUG"
- path: output/hmmer/versions.yml
contains:
- "easel:"