From 847bebc0abfdf6b9ebff8fe2dfd6abda51d7c04e Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Thu, 15 Sep 2022 14:06:18 +0200 Subject: [PATCH] Make hmmer/hmmalign output files with correct prefix (#2067) --- modules/hmmer/hmmalign/main.nf | 2 +- tests/modules/hmmer/hmmalign/main.nf | 15 ++++++++++++++- tests/modules/hmmer/hmmalign/nextflow.config | 3 +++ tests/modules/hmmer/hmmalign/test.yml | 8 ++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/hmmer/hmmalign/main.nf b/modules/hmmer/hmmalign/main.nf index f8156e04..b15740aa 100644 --- a/modules/hmmer/hmmalign/main.nf +++ b/modules/hmmer/hmmalign/main.nf @@ -25,7 +25,7 @@ process HMMER_HMMALIGN { hmmalign \\ $args \\ $hmm \\ - $fasta | gzip -c > ${meta.id}.sthlm.gz + $fasta | gzip -c > ${prefix}.sthlm.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/tests/modules/hmmer/hmmalign/main.nf b/tests/modules/hmmer/hmmalign/main.nf index 0a462a7a..7e48d00a 100644 --- a/tests/modules/hmmer/hmmalign/main.nf +++ b/tests/modules/hmmer/hmmalign/main.nf @@ -2,7 +2,8 @@ nextflow.enable.dsl = 2 -include { HMMER_HMMALIGN } from '../../../../modules/hmmer/hmmalign/main.nf' +include { HMMER_HMMALIGN as HMMER_HMMALIGN } from '../../../../modules/hmmer/hmmalign/main.nf' +include { HMMER_HMMALIGN as HMMER_HMMALIGN_PREFIX } from '../../../../modules/hmmer/hmmalign/main.nf' workflow test_hmmer_hmmalign { @@ -15,3 +16,15 @@ workflow test_hmmer_hmmalign { HMMER_HMMALIGN ( input, hmm ) } + +workflow test_hmmer_hmmalign_prefix { + + 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_PREFIX ( input, hmm ) +} diff --git a/tests/modules/hmmer/hmmalign/nextflow.config b/tests/modules/hmmer/hmmalign/nextflow.config index 8730f1c4..b2115af5 100644 --- a/tests/modules/hmmer/hmmalign/nextflow.config +++ b/tests/modules/hmmer/hmmalign/nextflow.config @@ -2,4 +2,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + withName: HMMER_HMMALIGN_PREFIX { + ext.prefix = { "${meta.id}.prefix" } + } } diff --git a/tests/modules/hmmer/hmmalign/test.yml b/tests/modules/hmmer/hmmalign/test.yml index 2e5ccfaf..becf51dd 100644 --- a/tests/modules/hmmer/hmmalign/test.yml +++ b/tests/modules/hmmer/hmmalign/test.yml @@ -6,3 +6,11 @@ files: - path: output/hmmer/test.sthlm.gz md5sum: ddaa8b96291edf4e1a929a224329161b +- name: hmmer hmmalign test_hmmer_hmmalign_prefix + command: nextflow run ./tests/modules/hmmer/hmmalign -entry test_hmmer_hmmalign_prefix -c ./tests/config/nextflow.config -c ./tests/modules/hmmer/hmmalign/nextflow.config + tags: + - hmmer + - hmmer/hmmalign + files: + - path: output/hmmer/test.prefix.sthlm.gz + md5sum: ddaa8b96291edf4e1a929a224329161b