From 1f4a60b5f43153022e268a8a52bd98022da1e439 Mon Sep 17 00:00:00 2001 From: mmYeung Date: Fri, 12 Dec 2025 12:40:18 +1100 Subject: [PATCH] updating input suffix check for reference file input, including nf-tests --- .../nf-core/verifybamid/verifybamid2/main.nf | 13 +- .../verifybamid2/tests/main.nf.test | 59 +++++++ .../verifybamid2/tests/main.nf.test.snap | 151 ++++++++++++++++++ 3 files changed, 217 insertions(+), 6 deletions(-) diff --git a/modules/nf-core/verifybamid/verifybamid2/main.nf b/modules/nf-core/verifybamid/verifybamid2/main.nf index 9568fee958d4..b288cecffc81 100644 --- a/modules/nf-core/verifybamid/verifybamid2/main.nf +++ b/modules/nf-core/verifybamid/verifybamid2/main.nf @@ -3,9 +3,9 @@ process VERIFYBAMID_VERIFYBAMID2 { label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/verifybamid2:2.0.1--hbb20b25_6' : - 'biocontainers/verifybamid2:2.0.1--h19d48f6_8' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/verifybamid2:2.0.1--hbb20b25_6' + : 'biocontainers/verifybamid2:2.0.1--h19d48f6_8'}" input: tuple val(meta), path(bam), path(bai) @@ -36,12 +36,13 @@ process VERIFYBAMID_VERIFYBAMID2 { "--SVDPrefix ${svd_ud.baseName}" : "--UDPath ${svd_ud} --MeanPath ${svd_mu} --BedPath ${svd_bed}" def refvcf_args = "${refvcf}".endsWith(".vcf") ? "--RefVCF ${refvcf}" : "" - def reference_args = ("$references".endsWith('.fasta')) ? - "--Reference ${references}" : '' + def reference_args = "${references}".matches(/.+((fasta)|(fa)|(fna))(\.gz)*$/) + ? "--Reference ${references}" + : '' """ verifybamid2 \\ - --NumThread $task.cpus \\ + --NumThread ${task.cpus} \\ ${svd_args} \\ ${bam_file} \\ ${refvcf_args} \\ diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test index 3ea6c2e68648..af149f4a0119 100644 --- a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test +++ b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test @@ -67,6 +67,7 @@ nextflow_process { } } + test("Should run with panel input") { config "./nextflow.config" @@ -177,4 +178,62 @@ nextflow_process { ) } } + + test("Should run with alternative .fa reference input -stub") { + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam'), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai') ] + input[1] = [ [], [], [] ] + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf') + input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz') + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.log[0][1]).name, + process.out.bed, + process.out.mu, + process.out.self_sm, + process.out.ancestry, + process.out.versions, + file(process.out.ud[0][1]).name + ).match() } + ) + } + } + + test("Should run with alternative .fa reference input") { + config "./nextflow.config" + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam'), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai') ] + input[1] = [ [], [], [] ] + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf') + input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz') + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } } diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap index 9bc0853a4b63..9e13bf29fe69 100644 --- a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap +++ b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap @@ -1,4 +1,42 @@ { + "Should run with alternative .fa reference input -stub": { + "content": [ + "test.log", + [ + [ + { + "id": "test", + "single_end": false + }, + "test.genome.vcf.bed:md5,47106c764019ee359b1936410e2efa1e" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.genome.vcf.mu:md5,0810db02af2a176fa5ddc0f404911b66" + ] + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" + ], + "test.genome.vcf.UD" + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-12T12:09:25.523364" + }, "Should run with panel input": { "content": [ "test.log", @@ -238,6 +276,119 @@ }, "timestamp": "2025-05-05T16:45:57.687144464" }, + "Should run with alternative .fa reference input": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bed:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.mu:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "test.selfSM:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "test.Ancestry:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" + ], + "ancestry": [ + [ + { + "id": "test", + "single_end": false + }, + "test.Ancestry:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bed": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bed:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "mu": [ + [ + { + "id": "test", + "single_end": false + }, + "test.mu:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "self_sm": [ + [ + { + "id": "test", + "single_end": false + }, + "test.selfSM:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "ud": [ + + ], + "versions": [ + "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-12T12:28:45.106596" + }, "Should run with SVD input": { "content": [ {