From 2c0a980b07290bea3c17618949da5125d880954e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Famke=20Ba=CC=88uerle?= Date: Wed, 11 Dec 2024 16:27:39 +0100 Subject: [PATCH 1/2] update and add stubs --- modules/nf-core/vcf2maf/environment.yml | 2 +- modules/nf-core/vcf2maf/main.nf | 31 +++-- modules/nf-core/vcf2maf/tests/main.nf.test | 111 +++++++++++++++--- .../nf-core/vcf2maf/tests/main.nf.test.snap | 104 +++++++++++++++- modules/nf-core/vcf2maf/tests/nextflow.config | 19 +-- .../vcf2maf/tests/nextflow.withVEP.config | 9 -- modules/nf-core/vcf2maf/tests/tags.yml | 2 - 7 files changed, 230 insertions(+), 48 deletions(-) delete mode 100644 modules/nf-core/vcf2maf/tests/nextflow.withVEP.config delete mode 100644 modules/nf-core/vcf2maf/tests/tags.yml diff --git a/modules/nf-core/vcf2maf/environment.yml b/modules/nf-core/vcf2maf/environment.yml index bfe50913b91..44e574f23c5 100644 --- a/modules/nf-core/vcf2maf/environment.yml +++ b/modules/nf-core/vcf2maf/environment.yml @@ -3,4 +3,4 @@ channels: - bioconda dependencies: - bioconda::ensembl-vep=106.1 - - bioconda::vcf2maf=1.6.21 + - bioconda::vcf2maf=1.6.22 diff --git a/modules/nf-core/vcf2maf/main.nf b/modules/nf-core/vcf2maf/main.nf index 55f7c6c597f..f964fc78315 100644 --- a/modules/nf-core/vcf2maf/main.nf +++ b/modules/nf-core/vcf2maf/main.nf @@ -6,8 +6,8 @@ process VCF2MAF { // WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions. conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-b6fc09bed47d0dc4d8384ce9e04af5806f2cc91b:305092c6f8420acd17377d2cc8b96e1c3ccb7d26-0': - 'biocontainers/mulled-v2-b6fc09bed47d0dc4d8384ce9e04af5806f2cc91b:305092c6f8420acd17377d2cc8b96e1c3ccb7d26-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/7c/7cbf9421f0bee23a93a35c5d0c7166ac1e89a40008d8e474cecfddb93226bf65/data': + 'community.wave.seqera.io/library/ensembl-vep_vcf2maf:2d40b60b4834af73' }" input: tuple val(meta), path(vcf) // Use an uncompressed VCF file! @@ -24,13 +24,10 @@ process VCF2MAF { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def vep_cache_cmd = vep_cache ? "--vep-data $vep_cache" : "" - // If VEP is present, it will find it and add it to commands. - // If VEP is not present they will be blank - def VERSION = '1.6.21' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def vep_cache_cmd = vep_cache ? "--vep-data $vep_cache" : "" // If VEP is present, it will find it and add it to commands otherwise blank + def VERSION = '1.6.22' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. """ - if command -v vep &> /dev/null - then + if [ "$vep_cache" ]; then VEP_CMD="--vep-path \$(dirname \$(type -p vep))" VEP_VERSION=\$(echo -e "\\n ensemblvep: \$( echo \$(vep --help 2>&1) | sed 's/^.*Versions:.*ensembl-vep : //;s/ .*\$//')") else @@ -51,4 +48,22 @@ process VCF2MAF { vcf2maf: $VERSION\$VEP_VERSION END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + def VERSION = '1.6.22' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + """ + if [ "$vep_cache" ]; then + VEP_VERSION=\$(echo -e "\\n ensemblvep: \$( echo \$(vep --help 2>&1) | sed 's/^.*Versions:.*ensembl-vep : //;s/ .*\$//')") + else + VEP_VERSION="" + fi + + touch ${prefix}.maf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + vcf2maf: $VERSION\$VEP_VERSION + END_VERSIONS + """ } diff --git a/modules/nf-core/vcf2maf/tests/main.nf.test b/modules/nf-core/vcf2maf/tests/main.nf.test index f17e7740ee6..faa5888ab2f 100644 --- a/modules/nf-core/vcf2maf/tests/main.nf.test +++ b/modules/nf-core/vcf2maf/tests/main.nf.test @@ -8,16 +8,49 @@ nextflow_process { tag "vcf2maf" tag "untar" + setup { + run("UNTAR") { + script "../../../../modules/nf-core/untar/main.nf" + process { + """ + input[0] = [ + [ id:'test_genome_vep' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/vep.tar.gz", checkIfExists: true) + ] + """ + } + } + run("ENSEMBLVEP_DOWNLOAD") { + script "../../../../modules/nf-core/ensemblvep/download/main.nf" + process { + """ + input[0] = [ + [ id:'test_genome_vep' ], + 'GRCh38', + 'homo_sapiens', + '113' + ] + """ + } + } + } + test("Run without VEP") { + config "./nextflow.config" + when { + params { + module_args = '--ncbi-build GRCh38 --species homo_sapiens --inhibit-vep' + module_setup_args = "" + } process { """ input[0] = [ [ id:'test'], // meta map file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/gvcf/test.genome.vcf", checkIfExists: true) ] - input[1] = [ file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.fasta", checkIfExists: true) ] + input[1] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.fasta", checkIfExists: true) input[2] = [] """ } @@ -27,30 +60,74 @@ nextflow_process { { assert process.success }, { assert snapshot( path(process.out.maf[0][1]).readLines()[5..131], - process.out.versions + process.out.versions, + path(process.out.versions[0]).readLines() ).match() }, - { assert path(process.out.versions[0]).readLines() == ['"VCF2MAF":', ' vcf2maf: 1.6.21', ' ensemblvep: 106.1'] } ) } } test("Run with VEP"){ - tag "vcf2maf-withVEP" - config "./nextflow.withVEP.config" - setup { - run("UNTAR") { - script "../../../../modules/nf-core/untar/main.nf" - process { + config "./nextflow.config" + + when { + params { + module_args = "--ncbi-build GRCh38 --species homo_sapiens" + module_setup_args = '--AUTO c --CONVERT --NO_BIOPERL --NO_HTSLIB --NO_TEST --NO_UPDATE' + } + process { """ - input[0] = [ - [ id:'test_genome_vep' ], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/vep.tar.gz", checkIfExists: true) - ] + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/gvcf/test.genome.vcf", checkIfExists: true) + ] + input[1] = [ file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.fasta", checkIfExists: true) ] + input[2] = ENSEMBLVEP_DOWNLOAD.out.cache.map { it[1] } + """ + } //UNTAR.out.untar.map { it[1] } + } + + then{ + assertAll( + { assert process.success }, + { assert path(process.out.maf[0][1]).readLines().size() == 2 }, // no variants, only header lines + { assert snapshot(process.out.versions, path(process.out.versions[0]).readLines()).match() } + ) + } + } + + test("Run without VEP - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/gvcf/test.genome.vcf", checkIfExists: true) + ] + input[1] = [ file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.fasta", checkIfExists: true) ] + input[2] = [] """ } } + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out, + path(process.out.versions[0]).readLines() + ).match() + }, + ) } + } + + test("Run with VEP - stub"){ + + options "-stub" when { process { @@ -68,9 +145,13 @@ nextflow_process { then{ assertAll( { assert process.success }, - { assert path(process.out.maf[0][1]).readLines().size() == 2 }, // no variants, only header lines - { assert path(process.out.versions[0]).readLines() == ['"VCF2MAF":', ' vcf2maf: 1.6.21', ' ensemblvep: 106.1'] } + { assert snapshot( + process.out, + path(process.out.versions[0]).readLines() + ).match() + }, ) } } + } diff --git a/modules/nf-core/vcf2maf/tests/main.nf.test.snap b/modules/nf-core/vcf2maf/tests/main.nf.test.snap index c81d6c6221f..14b3a4c5078 100644 --- a/modules/nf-core/vcf2maf/tests/main.nf.test.snap +++ b/modules/nf-core/vcf2maf/tests/main.nf.test.snap @@ -1,4 +1,96 @@ { + "Run with VEP - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.maf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,999ed581957e1a97cf9a483e5cc65d05" + ], + "maf": [ + [ + { + "id": "test" + }, + "test.maf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,999ed581957e1a97cf9a483e5cc65d05" + ] + }, + [ + "\"VCF2MAF\":", + " vcf2maf: 1.6.22", + " ensemblvep: 113.0" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-11T16:01:35.707312" + }, + "Run with VEP": { + "content": [ + [ + "versions.yml:md5,080a78cfd7c0753ff81d09eb48ffcb55" + ], + [ + "\"VCF2MAF\":", + " vcf2maf: 1.6.22", + " ensemblvep: 106.1" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-11T15:50:59.184221" + }, + "Run without VEP - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.maf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,f3398fb1c4621649331dca91212dac23" + ], + "maf": [ + [ + { + "id": "test" + }, + "test.maf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,f3398fb1c4621649331dca91212dac23" + ] + }, + [ + "\"VCF2MAF\":", + " vcf2maf: 1.6.22" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-11T15:49:39.498519" + }, "Run without VEP": { "content": [ [ @@ -131,13 +223,17 @@ "Unknown\t0\t.\tGRCh38\tchr22\t4608\t4608\t+\tTargeted_Region\tINS\tA\tA\t\t\t\tTUMOR\tNORMAL\tA\tA\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.\tCAA\t.\t.\t\t\t\t\t\t\t\t\t\t4608" ], [ - "versions.yml:md5,a81fb1aa49b86f6c9c17e3158336d930" + "versions.yml:md5,f3398fb1c4621649331dca91212dac23" + ], + [ + "\"VCF2MAF\":", + " vcf2maf: 1.6.22" ] ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.2" }, - "timestamp": "2024-09-12T15:59:58.867897" + "timestamp": "2024-12-11T15:52:16.957598" } } \ No newline at end of file diff --git a/modules/nf-core/vcf2maf/tests/nextflow.config b/modules/nf-core/vcf2maf/tests/nextflow.config index 1f0aad364a7..2e81757de2d 100644 --- a/modules/nf-core/vcf2maf/tests/nextflow.config +++ b/modules/nf-core/vcf2maf/tests/nextflow.config @@ -1,11 +1,12 @@ -// config for running without VEP -params.species = "homo_sapiens" -params.build = "GRCh38" - process { - container = "biocontainers/vcf2maf:1.6.21--hdfd78af_0" - conda = "bioconda::vcf2maf=1.6.21" - withName: 'VCF2MAF' { - ext.args = "--ncbi-build ${params.build} --species ${params.species} --inhibit-vep" + + withName: 'VCF2MAF' { + ext.args = params.module_args } -} \ No newline at end of file + + withName: 'ENSEMBLVEP_DOWNLOAD' { + ext.args = params.module_setup_args + ext.prefix = { "${params.vep_cache_version}_${params.vep_genome}" } + } + +} diff --git a/modules/nf-core/vcf2maf/tests/nextflow.withVEP.config b/modules/nf-core/vcf2maf/tests/nextflow.withVEP.config deleted file mode 100644 index 0991b358b00..00000000000 --- a/modules/nf-core/vcf2maf/tests/nextflow.withVEP.config +++ /dev/null @@ -1,9 +0,0 @@ -// config for running with VEP -params.species = "homo_sapiens" -params.build = "GRCh38" - -process { - withName: 'VCF2MAF' { - ext.args = "--ncbi-build ${params.build} --species ${params.species}" - } -} diff --git a/modules/nf-core/vcf2maf/tests/tags.yml b/modules/nf-core/vcf2maf/tests/tags.yml deleted file mode 100644 index b0c967f4207..00000000000 --- a/modules/nf-core/vcf2maf/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -vcf2maf: - - modules/nf-core/vcf2maf/** From 0a799e09fda5af1cd86cc2e74f815820032efa2f Mon Sep 17 00:00:00 2001 From: famosab Date: Thu, 12 Dec 2024 00:03:28 +0100 Subject: [PATCH 2/2] update snap --- modules/nf-core/vcf2maf/tests/main.nf.test.snap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/vcf2maf/tests/main.nf.test.snap b/modules/nf-core/vcf2maf/tests/main.nf.test.snap index 14b3a4c5078..5fd1b0001b2 100644 --- a/modules/nf-core/vcf2maf/tests/main.nf.test.snap +++ b/modules/nf-core/vcf2maf/tests/main.nf.test.snap @@ -40,19 +40,19 @@ "Run with VEP": { "content": [ [ - "versions.yml:md5,080a78cfd7c0753ff81d09eb48ffcb55" + "versions.yml:md5,999ed581957e1a97cf9a483e5cc65d05" ], [ "\"VCF2MAF\":", " vcf2maf: 1.6.22", - " ensemblvep: 106.1" + " ensemblvep: 113.0" ] ], "meta": { "nf-test": "0.9.2", - "nextflow": "24.10.2" + "nextflow": "24.10.1" }, - "timestamp": "2024-12-11T15:50:59.184221" + "timestamp": "2024-12-11T16:49:11.083460421" }, "Run without VEP - stub": { "content": [