diff --git a/modules/bcftools/stats/main.nf b/modules/bcftools/stats/main.nf index 1e0f3a47..c42ed29a 100644 --- a/modules/bcftools/stats/main.nf +++ b/modules/bcftools/stats/main.nf @@ -9,6 +9,7 @@ process BCFTOOLS_STATS { input: tuple val(meta), path(vcf) + path(target_bed) output: tuple val(meta), path("*stats.txt"), emit: stats @@ -20,8 +21,13 @@ process BCFTOOLS_STATS { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def target = target_bed ? "--regions-file ${target_bed}" : "" """ - bcftools stats $args $vcf > ${prefix}.bcftools_stats.txt + bcftools stats \\ + $args \\ + $target \\ + $vcf > ${prefix}.bcftools_stats.txt + cat <<-END_VERSIONS > versions.yml "${task.process}": bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') diff --git a/modules/bcftools/stats/meta.yml b/modules/bcftools/stats/meta.yml index 304b88ec..b0aec1eb 100644 --- a/modules/bcftools/stats/meta.yml +++ b/modules/bcftools/stats/meta.yml @@ -19,6 +19,10 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] + - target_bed: + type: file + description: target bed file + pattern: "*.{bed}" - vcf: type: file description: VCF input file @@ -40,3 +44,4 @@ output: authors: - "@joseespinosa" - "@drpatelh" + - "@SusiJo" diff --git a/tests/modules/bcftools/stats/main.nf b/tests/modules/bcftools/stats/main.nf index 808a3330..b25cc6b2 100644 --- a/tests/modules/bcftools/stats/main.nf +++ b/tests/modules/bcftools/stats/main.nf @@ -6,8 +6,8 @@ include { BCFTOOLS_STATS } from '../../../../modules/bcftools/stats/main.nf' workflow test_bcftools_stats { input = [ [ id:'test' ], // meta map - [ file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) ] + [ file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) ], ] - BCFTOOLS_STATS ( input ) + BCFTOOLS_STATS ( input, [] ) }