diff --git a/modules/hmmer/eslreformat/main.nf b/modules/hmmer/eslreformat/main.nf index e813e816..c7c20ffb 100644 --- a/modules/hmmer/eslreformat/main.nf +++ b/modules/hmmer/eslreformat/main.nf @@ -11,8 +11,8 @@ process HMMER_ESLREFORMAT { tuple val(meta), path(seqfile) output: - tuple val(meta), path("*.sequences.gz"), emit: seqreformated - path "versions.yml" , emit: versions + tuple val(meta), path("*.*.gz"), emit: seqreformated + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -20,6 +20,7 @@ process HMMER_ESLREFORMAT { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = args ? args.trim().tokenize(" ")[-1] : "sequences" // Use for any postprocessing of the sequence file, e.g. removal of gap characters def postproc = task.ext.postprocessing ?: "" """ @@ -27,7 +28,7 @@ process HMMER_ESLREFORMAT { $args \\ $seqfile \\ $postproc \\ - | gzip -c > ${prefix}.sequences.gz + | gzip -c > ${prefix}.${suffix}.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/hmmer/eslreformat/meta.yml b/modules/hmmer/eslreformat/meta.yml index eb85a4d7..39cb7ab2 100644 --- a/modules/hmmer/eslreformat/meta.yml +++ b/modules/hmmer/eslreformat/meta.yml @@ -35,7 +35,7 @@ output: - seqreformated: type: file description: Reformated sequence file - pattern: "*.sequences.gz" + pattern: "*.*.gz" authors: - "@erikrikarddaniel" diff --git a/tests/modules/hmmer/eslreformat/main.nf b/tests/modules/hmmer/eslreformat/main.nf index 82cc0666..aa1d3d69 100644 --- a/tests/modules/hmmer/eslreformat/main.nf +++ b/tests/modules/hmmer/eslreformat/main.nf @@ -4,6 +4,7 @@ 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_ESLREFORMAT as HMMER_ESLREFORMAT_PHYLIP } from '../../../../modules/hmmer/eslreformat/main.nf' include { HMMER_ESLREFORMAT as HMMER_ESLREFORMAT_UNALIGN } from '../../../../modules/hmmer/eslreformat/main.nf' workflow test_hmmer_eslreformat_afa { @@ -20,6 +21,20 @@ workflow test_hmmer_eslreformat_afa { HMMER_ESLREFORMAT_AFA ( HMMER_HMMALIGN.out.sthlm ) } +workflow test_hmmer_eslreformat_phylip { + + 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_PHYLIP ( HMMER_HMMALIGN.out.sthlm ) +} + workflow test_hmmer_eslreformat_unalign { input = [ diff --git a/tests/modules/hmmer/eslreformat/nextflow.config b/tests/modules/hmmer/eslreformat/nextflow.config index be48a765..40a83917 100644 --- a/tests/modules/hmmer/eslreformat/nextflow.config +++ b/tests/modules/hmmer/eslreformat/nextflow.config @@ -6,6 +6,10 @@ process { ext.args = 'afa' } + withName: HMMER_ESLREFORMAT_PHYLIP { + ext.args = ' -u phylip ' + } + withName: HMMER_ESLREFORMAT_UNALIGN { ext.args = '--gapsym=- afa' ext.postprocessing = '| sed "/^>/!s/-//g"' diff --git a/tests/modules/hmmer/eslreformat/test.yml b/tests/modules/hmmer/eslreformat/test.yml index 0f98bae0..b625c5f2 100644 --- a/tests/modules/hmmer/eslreformat/test.yml +++ b/tests/modules/hmmer/eslreformat/test.yml @@ -4,20 +4,32 @@ - hmmer/eslreformat - hmmer files: - - path: output/hmmer/test.sequences.gz + - path: output/hmmer/test.afa.gz contains: - ">CP025268.1" - "aaa---UUGAAGAGUUUGAUCAUGGCUCAGAUUGAACGCUGGCGGCAGGCCUAACACAUG" - path: output/hmmer/versions.yml contains: - "easel:" +- name: hmmer eslreformat test_hmmer_eslreformat_phylip + command: nextflow run ./tests/modules/hmmer/eslreformat -entry test_hmmer_eslreformat_phylip -c ./tests/config/nextflow.config -c ./tests/modules/hmmer/eslreformat/nextflow.config + tags: + - hmmer/eslreformat + - hmmer + files: + - path: output/hmmer/test.phylip.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 + - path: output/hmmer/test.afa.gz contains: - ">CP025268.1" - "aaaUUGAAGAGUUUGAUCAUGGCUCAGAUUGAACGCUGGCGGCAGGCCUAACACAUG"