diff --git a/modules/nf-core/parabricks/mutectcaller/main.nf b/modules/nf-core/parabricks/mutectcaller/main.nf index d674793fb321..3d662b935bd3 100644 --- a/modules/nf-core/parabricks/mutectcaller/main.nf +++ b/modules/nf-core/parabricks/mutectcaller/main.nf @@ -17,9 +17,10 @@ process PARABRICKS_MUTECTCALLER { path panel_of_normals_index output: - tuple val(meta), path("*.vcf.gz"), emit: vcf - tuple val(meta), path("*.vcf.gz.stats"), emit: stats - path "compatible_versions.yml", emit: compatible_versions, optional: true + tuple val(meta), path("${prefix}.vcf.gz"), emit: vcf + tuple val(meta), path("${prefix}.vcf.gz.tbi"), emit: tbi + tuple val(meta), path("${prefix}.vcf.gz.stats"), emit: stats + path "compatible_versions.yml", emit: compatible_versions, optional: true tuple val("${task.process}"), val('parabricks'), eval("pbrun version | grep -m1 '^pbrun:' | sed 's/^pbrun:[[:space:]]*//'"), topic: versions, emit: versions_parabricks when: @@ -32,10 +33,13 @@ process PARABRICKS_MUTECTCALLER { } def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" + prefix = task.ext.prefix ?: "${meta.id}" def intervals_command = intervals ? (intervals instanceof List ? intervals.collect { interval -> "--interval-file ${interval}" }.join(' ') : "--interval-file ${intervals}") : "" - def prepon_command = panel_of_normals ? "cp -L ${panel_of_normals_index} `readlink -f ${panel_of_normals}`.tbi && pbrun prepon --in-pon-file ${panel_of_normals}" : "" + // prepon and postpon expect the index at .tbi + def pon_index_command = panel_of_normals && panel_of_normals_index.name != "${panel_of_normals.name}.tbi" ? "cp -L ${panel_of_normals_index} ${panel_of_normals}.tbi" : "" + def prepon_command = panel_of_normals ? "pbrun prepon --in-pon-file ${panel_of_normals}" : "" + def pon_command = panel_of_normals ? "--pon ${panel_of_normals}" : "" // pbrun postpon requires uncompressed .vcf input; output uncompressed when PON is provided def mutect_out = panel_of_normals ? "${prefix}.vcf" : "${prefix}.vcf.gz" def stats_rename = panel_of_normals ? "mv ${prefix}.vcf.stats ${prefix}.vcf.gz.stats" : "" @@ -44,7 +48,8 @@ process PARABRICKS_MUTECTCALLER { def num_gpus = task.accelerator ? "--num-gpus ${task.accelerator.request}" : "" def normal_bam_flag = normal_bam ? "--in-normal-bam ${normal_bam}" : "" """ - # if panel of normals specified, run prepon + # if panel of normals specified, place its index at .tbi and run prepon + ${pon_index_command} ${prepon_command} pbrun \\ @@ -52,6 +57,7 @@ process PARABRICKS_MUTECTCALLER { --ref ${fasta} \\ --in-tumor-bam ${tumor_bam} \\ ${normal_bam_flag} \\ + ${pon_command} \\ --out-vcf ${mutect_out} \\ ${intervals_command} \\ ${num_gpus} \\ @@ -63,9 +69,10 @@ process PARABRICKS_MUTECTCALLER { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}" + prefix = task.ext.prefix ?: "${meta.id}" """ echo "" | gzip > ${prefix}.vcf.gz + touch ${prefix}.vcf.gz.tbi touch ${prefix}.vcf.gz.stats # Capture the full version output once and store it in a variable diff --git a/modules/nf-core/parabricks/mutectcaller/meta.yml b/modules/nf-core/parabricks/mutectcaller/meta.yml index 1f95467a2531..9a3597df2d9d 100644 --- a/modules/nf-core/parabricks/mutectcaller/meta.yml +++ b/modules/nf-core/parabricks/mutectcaller/meta.yml @@ -29,9 +29,9 @@ input: - edam: "http://edamontology.org/format_2572" # BAM - tumor_bam_index: type: file - description: (Optional) bai index corresponding to tumor bam file. Only required + description: (Optional) bai or csi index corresponding to tumor bam file. Only required if intervals are provided. - pattern: "*.bam.bai" + pattern: "*.{bai,csi}" ontologies: [] - normal_bam: type: file @@ -41,9 +41,9 @@ input: - edam: "http://edamontology.org/format_2572" # BAM - normal_bam_index: type: file - description: (Optional) bai index corresponding to normal bam file. Only required + description: (Optional) bai or csi index corresponding to normal bam file. Only required if intervals are provided. - pattern: "*.bam.bai" + pattern: "*.{bai,csi}" ontologies: [] - intervals: type: file @@ -68,7 +68,12 @@ input: ontologies: [] - panel_of_normals: type: file - description: (Optional) panel of normals file. + description: | + (Optional) bgzipped panel of normals file. When provided, the module runs + prepon, passes it to mutectcaller via --pon and annotates the output with + postpon. Its header must contain only contigs present in the reference, + otherwise prepon fails with "Chromosome number of pon file doesn't match + reference" (see `bcftools reheader --fai`). Do not add --pon via ext.args. pattern: "*.vcf.gz" ontologies: - edam: http://edamontology.org/format_3989 # GZIP format @@ -84,20 +89,32 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test' ] - - "*.vcf.gz": + - "${prefix}.vcf.gz": type: file description: Compressed variants file. Will include an annotated vcf file if panel of normals is used. pattern: "*.vcf.gz" ontologies: - edam: http://edamontology.org/format_3989 # GZIP format + tbi: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - "${prefix}.vcf.gz.tbi": + type: file + description: Tabix index of the compressed variants file. + pattern: "*.vcf.gz.tbi" + ontologies: + - edam: http://edamontology.org/format_3700 # Tabix index file format stats: - - meta: type: map description: | Groovy Map containing sample information e.g. [ id:'test' ] - - "*.vcf.gz.stats": + - "${prefix}.vcf.gz.stats": type: file description: Variant statistics. pattern: "*.vcf.gz.stats" diff --git a/modules/nf-core/parabricks/mutectcaller/tests/main.nf.test b/modules/nf-core/parabricks/mutectcaller/tests/main.nf.test index 6f747dd22fb4..499b7c225a52 100644 --- a/modules/nf-core/parabricks/mutectcaller/tests/main.nf.test +++ b/modules/nf-core/parabricks/mutectcaller/tests/main.nf.test @@ -6,6 +6,8 @@ nextflow_process { tag "modules" tag "parabricks/mutectcaller" + tag "bcftools/reheader" + tag "samtools/addreplacerg" tag "modules_nfcore" tag "parabricks" tag "gpu" @@ -40,195 +42,243 @@ nextflow_process { } then { + def variants = path(process.out.vcf[0][1]).vcf.variants + // Calls overlapping PON deletions in the PON test; they must disappear when --pon is used + def pon_overlapping = [44145050, 44145051, 46156071, 46156077] + // Gaps between the intervals in the intervals test + def interval_gaps = [23354001..24132499, 24910999..25689497] assertAll( { assert process.success }, - { assert snapshot( - path(process.out.vcf[0][1]).vcf.variantsMD5, - process.out.stats, - process.out.findAll { key, val -> key.startsWith('versions') } - ).match() } + { assert variants.count { variant -> variant.start in pon_overlapping } == 4 }, + { assert variants.count { variant -> interval_gaps.any { gap -> variant.start in gap } } == 17 }, + { assert snapshot(sanitizeOutput(process.out, variantsMD5Keys: ["vcf"], unstableKeys: ["tbi"])).match() } + ) + } + + } + + test("human - bam - intervals") { + + when { + params { + module_args = "--tumor-name tumour --mutect-low-memory" + } + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), + [], + [], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true) + ] + input[1] = [ // fasta + fasta_fai + [ id: 'reference' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[2] = [] // pon + input[3] = [] // pon index + """ + } + } + + then { + def variants = path(process.out.vcf[0][1]).vcf.variants + def interval_gaps = [23354001..24132499, 24910999..25689497] + assertAll( + { assert process.success }, + { assert variants.count { variant -> interval_gaps.any { gap -> variant.start in gap } } == 0 }, + { assert snapshot(sanitizeOutput(process.out, variantsMD5Keys: ["vcf"], unstableKeys: ["tbi"])).match() } ) } } - // test("human - bam - tn") { - // // tumor-normal calling not passing because of issue with readgroups in the test files - // // [PB Error][src/readers.cpp:1314] ID simulation01 maps to tm_simulation01, but PU is nm_simulation01 (different platform), exiting. - - // config "./nextflow.config" - - // when { - // params { - // module_args = "--mutect-low-memory" - // } - // process { - // """ - // input[0] = [ - // [ id:'test' ], - // 'tumour', - // 'normal', - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), - // [] - // ] - // input[1] = [ // fasta - // [ id: 'reference' ], //genomics/homo_sapiens/genome/chr21/sequence/genome.fasta - // // file() - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) - // ] - // input[2] = [] // pon - // input[3] = [] // pon index - // """ - // } - // } - - // then { - // assertAll( - // { assert process.success }, - // { assert snapshot( - // path(process.out.vcf[0][1]).vcf.variantsMD5, - // process.out.stats, - // process.out.versions - // ).match() } - // ) - // } - - // } - - // test("human - bam - intervals") { - // // Invalid tumor sample name input, exiting. - - // when { - // params { - // module_args = "--tumor-name tumour --mutect-low-memory" - // } - // process { - // """ - // input[0] = [ - // [ id:'test' ], - // 'tumor', - // null, - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), - // [], - // [], - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true) - // ] - // input[1] = [ // fasta - // [ id: 'reference' ], - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) - // ] - // input[2] = [] // pon - // input[3] = [] // pon index - // """ - // } - // } - - // then { - // assertAll( - // { assert process.success }, - // { assert snapshot( - // path(process.out.vcf[0][1]).vcf.variantsMD5, - // process.out.stats, - // process.out.versions - // ).match() } - // ) - // } - - // } - - // test("human - bam - tn - intervals") { - // // tumor-normal calling not passing because of issue with readgroups in the test files - // // [PB Error][src/readers.cpp:1314] ID simulation01 maps to tm_simulation01, but PU is nm_simulation01 (different platform), exiting. - - // config "./nextflow.config" - - // when { - // params { - // module_args = "--mutect-low-memory" - // } - // process { - // """ - // input[0] = [ - // [ id:'test' ], - // 'tumor', - // 'normal', - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true) - // ] - // input[1] = [ // fasta - // [ id: 'reference' ], - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) - // ] - // input[2] = [] // pon - // input[3] = [] // pon index - // """ - // } - // } - - // then { - // assertAll( - // { assert process.success }, - // { assert snapshot( - // path(process.out.vcf[0][1]).vcf.variantsMD5, - // process.out.stats, - // process.out.versions - // ).match() } - // ) - // } - - // } - - // test("human - bam - pon") { - // // PON test not passing because the tool expects all chromosomes in the PON file to - // // be present in the reference genome. - - // config "./nextflow.config" - - // when { - // params { - // module_args = "--pon $panel_of_normals --mutect-low-memory" - // } - // process { - // """ - // input[0] = [ - // [ id:'test' ], - // 'tumour', - // null, - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), - // [], - // [], - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true) - // ] - // input[1] = [ // fasta - // [ id: 'reference' ], - // file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) - // ] - // input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/germlineresources/mills_and_1000G.indels.hg38.vcf.gz', checkIfExists: true) - // input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/germlineresources/mills_and_1000G.indels.hg38.vcf.gz.tbi', checkIfExists: true) - // """ - // } - // } - - // then { - // assertAll( - // { assert process.success }, - // { assert snapshot( - // path(process.out.vcf[0][1]).vcf.variantsMD5, - // process.out.stats, - // process.out.versions - // ).match() } - // ) - // } - - // } + test("human - bam - tn") { + + setup { + // Both test BAMs share read group ID and PU, which Parabricks rejects in tumour-normal mode + run("SAMTOOLS_ADDREPLACERG") { + script "../../../samtools/addreplacerg/main.nf" + process { + """ + input[0] = [ + [ id:'normal' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true), + [], + "\'@RG\\\\tID:normal01\\\\tPU:normal01\\\\tSM:normal\\\\tLB:normal\\\\tPL:illumina\'" + ] + input[1] = [[],[],[],[]] + """ + } + } + } + + when { + params { + module_args = "--tumor-name tumour --normal-name normal --mutect-low-memory" + } + process { + """ + input[0] = SAMTOOLS_ADDREPLACERG.out.bam + .join(SAMTOOLS_ADDREPLACERG.out.index) + .map { meta, bam, index -> [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), + bam, + index, + [] + ] } + input[1] = [ // fasta + fasta_fai + [ id: 'reference' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[2] = [] // pon + input[3] = [] // pon index + """ + } + } + + then { + def vcf = path(process.out.vcf[0][1]).vcf + assertAll( + { assert process.success }, + { assert vcf.header.genotypeSamples.sort() == ['normal', 'tumour'] }, + { assert snapshot(sanitizeOutput(process.out, variantsMD5Keys: ["vcf"], unstableKeys: ["tbi"])).match() } + ) + } + + } + + test("human - bam - pon") { + + setup { + run("BCFTOOLS_REHEADER") { + script "../../../bcftools/reheader/main.nf" + process { + """ + input[0] = [ + [ id:'pon' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/germlineresources/mills_and_1000G.indels.hg38.vcf.gz', checkIfExists: true), + [], + [] + ] + input[1] = [ + [ id:'reference' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + """ + } + } + } + + when { + params { + module_args = "--tumor-name tumour --mutect-low-memory" + } + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), + [], + [], + [], + [] + ] + input[1] = [ // fasta + fasta_fai + [ id: 'reference' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[2] = BCFTOOLS_REHEADER.out.vcf.map { meta, vcf -> vcf } + input[3] = BCFTOOLS_REHEADER.out.index.map { meta, tbi -> tbi } + """ + } + } + + then { + def vcf = path(process.out.vcf[0][1]).vcf + def variants = vcf.variants + def mutect_command = vcf.header.otherHeaderLines.find { line -> line.key == 'GATKCommandLine' && line.value.contains('ID=mutectcaller,') } + def pon_overlapping = [44145050, 44145051, 46156071, 46156077] + assertAll( + { assert process.success }, + { assert mutect_command.value.contains('--pon ') }, + { assert variants.count { variant -> variant.start in pon_overlapping } == 0 }, + // postpon flags calls at PON positions + { assert variants.find { variant -> variant.start == 45495715 }.hasAttribute('PON') }, + { assert snapshot(sanitizeOutput(process.out, variantsMD5Keys: ["vcf"], unstableKeys: ["tbi"])).match() } + ) + } + + } + + test("human - bam - pon - renamed index") { + + setup { + run("BCFTOOLS_REHEADER") { + script "../../../bcftools/reheader/main.nf" + process { + """ + input[0] = [ + [ id:'pon' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/germlineresources/mills_and_1000G.indels.hg38.vcf.gz', checkIfExists: true), + [], + [] + ] + input[1] = [ + [ id:'reference' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + """ + } + } + } + + when { + params { + module_args = "--tumor-name tumour --mutect-low-memory" + } + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), + [], + [], + [], + [] + ] + input[1] = [ // fasta + fasta_fai + [ id: 'reference' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[2] = BCFTOOLS_REHEADER.out.vcf.map { meta, vcf -> vcf } + input[3] = BCFTOOLS_REHEADER.out.index.map { meta, tbi -> tbi.copyTo(tbi.resolveSibling('pon.tbi')) } + """ + } + } + + then { + def vcf = path(process.out.vcf[0][1]).vcf + def mutect_command = vcf.header.otherHeaderLines.find { line -> line.key == 'GATKCommandLine' && line.value.contains('ID=mutectcaller,') } + assertAll( + { assert process.success }, + { assert mutect_command.value.contains('--pon ') }, + // the index copied to .tbi must not be emitted + { assert !(process.out.tbi[0][1] instanceof List) }, + { assert file(process.out.tbi[0][1]).name == 'test.vcf.gz.tbi' }, + { assert snapshot(sanitizeOutput(process.out, variantsMD5Keys: ["vcf"], unstableKeys: ["tbi"])).match() } + ) + } + + } test("human - bam - stub") { @@ -263,7 +313,7 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - process.out, + sanitizeOutput(process.out), path(process.out.compatible_versions.get(0)).yaml ).match() } ) @@ -271,13 +321,89 @@ nextflow_process { } + test("human - bam - intervals - stub") { + + options '-stub' + + when { + params { + module_args = "--tumor-name tumour --mutect-low-memory" + } + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), + [], + [], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true) + ] + input[1] = [ // fasta + fasta_fai + [ id: 'reference' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[2] = [] // pon + input[3] = [] // pon index + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + + } + + test("human - bam - tn - stub") { + + options '-stub' + + when { + params { + module_args = "--tumor-name tumour --normal-name normal --mutect-low-memory" + } + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), + [] + ] + input[1] = [ // fasta + fasta_fai + [ id: 'reference' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[2] = [] // pon + input[3] = [] // pon index + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + + } + test("human - bam - pon - stub") { options '-stub' when { params { - module_args = "--pon ${panel_of_normals} --mutect-low-memory" + module_args = "--tumor-name tumour --mutect-low-memory" } process { """ @@ -303,7 +429,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( process.out ).match() } + { assert snapshot(sanitizeOutput(process.out)).match() } ) } diff --git a/modules/nf-core/parabricks/mutectcaller/tests/main.nf.test.snap b/modules/nf-core/parabricks/mutectcaller/tests/main.nf.test.snap index 92572c5a39c6..5eb0aa57ce65 100644 --- a/modules/nf-core/parabricks/mutectcaller/tests/main.nf.test.snap +++ b/modules/nf-core/parabricks/mutectcaller/tests/main.nf.test.snap @@ -2,32 +2,51 @@ "human - bam - pon - stub": { "content": [ { - "0": [ + "compatible_versions": [ + "compatible_versions.yml:md5,62a44f82ee1258428b4afc9d67dc1b4b" + ], + "stats": [ [ { "id": "test" }, - "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test.vcf.gz.stats:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], - "1": [ + "tbi": [ [ { "id": "test" }, - "test.vcf.gz.stats:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], - "2": [ - "compatible_versions.yml:md5,62a44f82ee1258428b4afc9d67dc1b4b" + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] ], - "3": [ + "versions_parabricks": [ [ "PARABRICKS_MUTECTCALLER", "parabricks", "4.8.0-1" ] - ], + ] + } + ], + "timestamp": "2026-10-29T07:29:33.082777472", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.10.3" + } + }, + "human - bam - stub": { + "content": [ + { "compatible_versions": [ "compatible_versions.yml:md5,62a44f82ee1258428b4afc9d67dc1b4b" ], @@ -39,6 +58,14 @@ "test.vcf.gz.stats:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], + "tbi": [ + [ + { + "id": "test" + }, + "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], "vcf": [ [ { @@ -54,52 +81,132 @@ "4.8.0-1" ] ] + }, + { + "PARABRICKS_MUTECTCALLER": { + "pbrun_version": "4.8.0-1", + "compatible_with": { + "GATK:": "4.3.0.0" + } + } } ], - "timestamp": "2026-10-22T07:00:22.879955427", + "timestamp": "2026-10-29T07:28:51.747209946", "meta": { "nf-test": "0.9.5", - "nextflow": "26.04.6" + "nextflow": "26.10.3" } }, - "human - bam - stub": { + "human - bam - pon": { "content": [ { - "0": [ + "compatible_versions": [ + + ], + "stats": [ [ { "id": "test" }, - "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test.vcf.gz.stats:md5,a9bfbdd92e86ca832ad6e2dafc561e9f" ] ], - "1": [ + "tbi": [ [ { "id": "test" }, - "test.vcf.gz.stats:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.vcf.gz.tbi" ] ], - "2": [ - "compatible_versions.yml:md5,62a44f82ee1258428b4afc9d67dc1b4b" + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5Variants,1c7638f2c8861c5491570dc79b36af3b" + ] ], - "3": [ + "versions_parabricks": [ [ "PARABRICKS_MUTECTCALLER", "parabricks", "4.8.0-1" ] + ] + } + ], + "timestamp": "2026-10-29T07:39:01.433409231", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.10.3" + } + }, + "human - bam - tn": { + "content": [ + { + "compatible_versions": [ + + ], + "stats": [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,33493aaf38103a76df205f22d287b17d" + ] + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.vcf.gz.tbi" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5Variants,5a75d8a1c59a59ba6e7ffd04b02b204c" + ] ], + "versions_parabricks": [ + [ + "PARABRICKS_MUTECTCALLER", + "parabricks", + "4.8.0-1" + ] + ] + } + ], + "timestamp": "2026-10-29T07:38:36.992728475", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.10.3" + } + }, + "human - bam - pon - renamed index": { + "content": [ + { "compatible_versions": [ - "compatible_versions.yml:md5,62a44f82ee1258428b4afc9d67dc1b4b" + ], "stats": [ [ { "id": "test" }, - "test.vcf.gz.stats:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.vcf.gz.stats:md5,a9bfbdd92e86ca832ad6e2dafc561e9f" + ] + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.vcf.gz.tbi" ] ], "vcf": [ @@ -107,7 +214,7 @@ { "id": "test" }, - "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test.vcf.gz:md5Variants,1c7638f2c8861c5491570dc79b36af3b" ] ], "versions_parabricks": [ @@ -117,34 +224,179 @@ "4.8.0-1" ] ] - }, + } + ], + "timestamp": "2026-10-29T08:10:16.044585038", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.10.3" + } + }, + "human - bam - intervals": { + "content": [ { - "PARABRICKS_MUTECTCALLER": { - "pbrun_version": "4.8.0-1", - "compatible_with": { - "GATK:": "4.3.0.0" - } - } + "compatible_versions": [ + + ], + "stats": [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,730b6c6fd6c35aa7752c2455e9e50847" + ] + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.vcf.gz.tbi" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5Variants,e7a67bdfa88e542bc73b02bce45be059" + ] + ], + "versions_parabricks": [ + [ + "PARABRICKS_MUTECTCALLER", + "parabricks", + "4.8.0-1" + ] + ] } ], - "timestamp": "2026-10-22T07:00:14.180750126", + "timestamp": "2026-10-29T07:38:05.331423388", "meta": { "nf-test": "0.9.5", - "nextflow": "26.04.6" + "nextflow": "26.10.3" } }, "human - bam": { "content": [ - "e9e77b557c40e868547a34dfca4fbd45", - [ - [ - { - "id": "test" - }, - "test.vcf.gz.stats:md5,c58bc062c6f18d38df3892d15548d8c8" + { + "compatible_versions": [ + + ], + "stats": [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,c58bc062c6f18d38df3892d15548d8c8" + ] + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.vcf.gz.tbi" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5Variants,e9e77b557c40e868547a34dfca4fbd45" + ] + ], + "versions_parabricks": [ + [ + "PARABRICKS_MUTECTCALLER", + "parabricks", + "4.8.0-1" + ] + ] + } + ], + "timestamp": "2026-10-29T07:37:46.32194125", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.10.3" + } + }, + "human - bam - intervals - stub": { + "content": [ + { + "compatible_versions": [ + "compatible_versions.yml:md5,62a44f82ee1258428b4afc9d67dc1b4b" + ], + "stats": [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions_parabricks": [ + [ + "PARABRICKS_MUTECTCALLER", + "parabricks", + "4.8.0-1" + ] ] - ], + } + ], + "timestamp": "2026-10-29T07:29:05.449895767", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.10.3" + } + }, + "human - bam - tn - stub": { + "content": [ { + "compatible_versions": [ + "compatible_versions.yml:md5,62a44f82ee1258428b4afc9d67dc1b4b" + ], + "stats": [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], "versions_parabricks": [ [ "PARABRICKS_MUTECTCALLER", @@ -154,10 +406,10 @@ ] } ], - "timestamp": "2026-10-22T07:00:06.819566288", + "timestamp": "2026-10-29T07:29:20.436090658", "meta": { "nf-test": "0.9.5", - "nextflow": "26.04.6" + "nextflow": "26.10.3" } } } \ No newline at end of file diff --git a/modules/nf-core/parabricks/mutectcaller/tests/nextflow.config b/modules/nf-core/parabricks/mutectcaller/tests/nextflow.config index 6376c82c4862..71c8611159cc 100644 --- a/modules/nf-core/parabricks/mutectcaller/tests/nextflow.config +++ b/modules/nf-core/parabricks/mutectcaller/tests/nextflow.config @@ -4,4 +4,12 @@ process { ext.args = { params.module_args } } + withName: BCFTOOLS_REHEADER { + ext.args2 = '--output-type z --write-index=tbi --no-version' + } + + withName: SAMTOOLS_ADDREPLACERG { + ext.args = '-m overwrite_all --write-index -O bam' + } + }