diff --git a/modules/nf-core/sentieon/gvcftyper/main.nf b/modules/nf-core/sentieon/gvcftyper/main.nf index af3cbdcf689c..9ef05cbcaaa0 100644 --- a/modules/nf-core/sentieon/gvcftyper/main.nf +++ b/modules/nf-core/sentieon/gvcftyper/main.nf @@ -27,13 +27,20 @@ process SENTIEON_GVCFTYPER { def prefix = task.ext.prefix ?: "${meta.id}_genotyped" def gvcfs_input = '-v ' + gvcfs.join(' -v ') def dbsnp_cmd = dbsnp ? "--dbsnp ${dbsnp}" : "" + def interval_command = intervals ? "--interval ${intervals}" : "" def sentieonLicense = secrets.SENTIEON_LICENSE_BASE64 ? "export SENTIEON_LICENSE=\$(mktemp);echo -e \"${secrets.SENTIEON_LICENSE_BASE64}\" | base64 -d > \$SENTIEON_LICENSE; " : "" """ ${sentieonLicense} - sentieon driver -r ${fasta} --algo GVCFtyper ${gvcfs_input} ${dbsnp_cmd} ${prefix}.vcf.gz + sentieon driver \\ + -r ${fasta} \\ + ${interval_command} \\ + --algo GVCFtyper \\ + ${gvcfs_input} \\ + ${dbsnp_cmd} \\ + ${prefix}.vcf.gz """ diff --git a/modules/nf-core/sentieon/gvcftyper/tests/main.nf.test b/modules/nf-core/sentieon/gvcftyper/tests/main.nf.test index a32a8d85eddd..5c810f438817 100644 --- a/modules/nf-core/sentieon/gvcftyper/tests/main.nf.test +++ b/modules/nf-core/sentieon/gvcftyper/tests/main.nf.test @@ -170,6 +170,45 @@ nextflow_process { } } + test("sentieon gvcftyper intervals constrain output - regression") { + // Regression test for the bug where `path(intervals)` was staged but + // never passed to `sentieon driver --interval`, causing GVCFtyper to + // run unconstrained. Before the fix, the variantsMD5 of an intervals + // run was identical to the no-intervals run + // ("d13216836f1452e200b215b796606671"). After the fix, the bed must + // actually restrict GVCFtyper, so the md5 MUST differ. + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics//homo_sapiens/illumina/gvcf/test.genome.vcf.gz.tbi', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true) + ] + + input[1] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)] + input[2] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)] + input[3] = [[:], []] + input[4] = [[:], []] + """ + } + } + + then { + assert process.success + assertAll( + { assert path(process.out.vcf_gz[0][1]).vcf.variantsMD5 != "d13216836f1452e200b215b796606671" }, + { assert snapshot( + process.out.findAll { key, val -> key.startsWith("versions") }, + file(process.out.vcf_gz_tbi.get(0).get(1)).name, + path(process.out.vcf_gz[0][1]).vcf.variantsMD5 + ).match() + } + ) + } + } + test("sentieon gvcftyper - stub") { options "-stub"