From ecece498f10b47b7c9d06f53a310cea5811b4c5f Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Thu, 16 Jun 2022 13:42:01 +0200 Subject: [PATCH] samtools/*stats*: use prefix for outputs (#1788) * use prefix in flagstat * use prefix in idxstats * use prefix in stats * update test.yml --- modules/samtools/flagstat/main.nf | 3 ++- modules/samtools/idxstats/main.nf | 4 +++- modules/samtools/stats/main.nf | 9 +++++---- tests/modules/samtools/flagstat/test.yml | 6 +++--- tests/modules/samtools/idxstats/test.yml | 8 ++++---- tests/modules/samtools/stats/test.yml | 12 ++++++------ 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/modules/samtools/flagstat/main.nf b/modules/samtools/flagstat/main.nf index b87b2108..03ec2dcf 100644 --- a/modules/samtools/flagstat/main.nf +++ b/modules/samtools/flagstat/main.nf @@ -19,12 +19,13 @@ process SAMTOOLS_FLAGSTAT { script: def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" """ samtools \\ flagstat \\ --threads ${task.cpus-1} \\ $bam \\ - > ${bam}.flagstat + > ${prefix}.flagstat cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/samtools/idxstats/main.nf b/modules/samtools/idxstats/main.nf index a49ff35f..4b245419 100644 --- a/modules/samtools/idxstats/main.nf +++ b/modules/samtools/idxstats/main.nf @@ -19,11 +19,13 @@ process SAMTOOLS_IDXSTATS { script: def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ samtools \\ idxstats \\ $bam \\ - > ${bam}.idxstats + > ${prefix}.idxstats cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/samtools/stats/main.nf b/modules/samtools/stats/main.nf index bbdc3240..c913bc5e 100644 --- a/modules/samtools/stats/main.nf +++ b/modules/samtools/stats/main.nf @@ -8,7 +8,7 @@ process SAMTOOLS_STATS { 'quay.io/biocontainers/samtools:1.15.1--h1170115_0' }" input: - tuple val(meta), path(input), path(input_index) + tuple val(meta), path(bam), path(bai) path fasta output: @@ -20,14 +20,15 @@ process SAMTOOLS_STATS { script: def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" def reference = fasta ? "--reference ${fasta}" : "" """ samtools \\ stats \\ --threads ${task.cpus-1} \\ ${reference} \\ - ${input} \\ - > ${input}.stats + ${bam} \\ + > ${prefix}.stats cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -38,7 +39,7 @@ process SAMTOOLS_STATS { stub: def prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${input}.stats + touch ${prefix}.stats cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/tests/modules/samtools/flagstat/test.yml b/tests/modules/samtools/flagstat/test.yml index a5f28b36..31762434 100644 --- a/tests/modules/samtools/flagstat/test.yml +++ b/tests/modules/samtools/flagstat/test.yml @@ -1,8 +1,8 @@ -- name: samtools flagstat - command: nextflow run ./tests/modules/samtools/flagstat -entry test_samtools_flagstat -c ./tests/config/nextflow.config -c ./tests/modules/samtools/flagstat/nextflow.config +- name: samtools flagstat test_samtools_flagstat + command: nextflow run ./tests/modules/samtools/flagstat -entry test_samtools_flagstat -c ./tests/config/nextflow.config -c ./tests/modules/samtools/flagstat/nextflow.config tags: - samtools - samtools/flagstat files: - - path: ./output/samtools/test.paired_end.sorted.bam.flagstat + - path: output/samtools/test.flagstat md5sum: 4f7ffd1e6a5e85524d443209ac97d783 diff --git a/tests/modules/samtools/idxstats/test.yml b/tests/modules/samtools/idxstats/test.yml index 88786eef..84a65dbd 100644 --- a/tests/modules/samtools/idxstats/test.yml +++ b/tests/modules/samtools/idxstats/test.yml @@ -1,8 +1,8 @@ -- name: samtools idxstats - command: nextflow run ./tests/modules/samtools/idxstats -entry test_samtools_idxstats -c ./tests/config/nextflow.config -c ./tests/modules/samtools/idxstats/nextflow.config +- name: samtools idxstats test_samtools_idxstats + command: nextflow run ./tests/modules/samtools/idxstats -entry test_samtools_idxstats -c ./tests/config/nextflow.config -c ./tests/modules/samtools/idxstats/nextflow.config tags: - - samtools - samtools/idxstats + - samtools files: - - path: ./output/samtools/test.paired_end.sorted.bam.idxstats + - path: output/samtools/test.idxstats md5sum: df60a8c8d6621100d05178c93fb053a2 diff --git a/tests/modules/samtools/stats/test.yml b/tests/modules/samtools/stats/test.yml index 304619ee..be6c3ccc 100644 --- a/tests/modules/samtools/stats/test.yml +++ b/tests/modules/samtools/stats/test.yml @@ -1,17 +1,17 @@ - name: samtools stats test_samtools_stats - command: nextflow run ./tests/modules/samtools/stats -entry test_samtools_stats -c ./tests/config/nextflow.config -c ./tests/modules/samtools/stats/nextflow.config + command: nextflow run ./tests/modules/samtools/stats -entry test_samtools_stats -c ./tests/config/nextflow.config -c ./tests/modules/samtools/stats/nextflow.config tags: - - samtools/stats - samtools + - samtools/stats files: - - path: output/samtools/test.paired_end.sorted.bam.stats + - path: output/samtools/test.stats md5sum: c1e9ad551281b0bca32be1c832d125af - name: samtools stats test_samtools_stats_cram - command: nextflow run ./tests/modules/samtools/stats -entry test_samtools_stats_cram -c ./tests/config/nextflow.config -c ./tests/modules/samtools/stats/nextflow.config + command: nextflow run ./tests/modules/samtools/stats -entry test_samtools_stats_cram -c ./tests/config/nextflow.config -c ./tests/modules/samtools/stats/nextflow.config tags: - - samtools/stats - samtools + - samtools/stats files: - - path: output/samtools/test.paired_end.recalibrated.sorted.cram.stats + - path: output/samtools/test.stats md5sum: 103cd7b19743c42dab9ce570144c6f36