Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vcf2maf and add stub tests #7202

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/nf-core/vcf2maf/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ channels:
- bioconda
dependencies:
- bioconda::ensembl-vep=106.1
- bioconda::vcf2maf=1.6.21
- bioconda::vcf2maf=1.6.22
31 changes: 23 additions & 8 deletions modules/nf-core/vcf2maf/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
Expand All @@ -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
"""
}
111 changes: 96 additions & 15 deletions modules/nf-core/vcf2maf/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []
"""
}
Expand All @@ -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 {
Expand All @@ -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()
},
)
}
}

}
104 changes: 100 additions & 4 deletions modules/nf-core/vcf2maf/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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,999ed581957e1a97cf9a483e5cc65d05"
],
[
"\"VCF2MAF\":",
" vcf2maf: 1.6.22",
" ensemblvep: 113.0"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-11T16:49:11.083460421"
},
"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": [
[
Expand Down Expand Up @@ -131,13 +223,17 @@
"Unknown\t0\t.\tGRCh38\tchr22\t4608\t4608\t+\tTargeted_Region\tINS\tA\tA\t<NON_REF>\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"
}
}
19 changes: 10 additions & 9 deletions modules/nf-core/vcf2maf/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -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
}
}

withName: 'ENSEMBLVEP_DOWNLOAD' {
ext.args = params.module_setup_args
ext.prefix = { "${params.vep_cache_version}_${params.vep_genome}" }
}

}
9 changes: 0 additions & 9 deletions modules/nf-core/vcf2maf/tests/nextflow.withVEP.config

This file was deleted.

2 changes: 0 additions & 2 deletions modules/nf-core/vcf2maf/tests/tags.yml

This file was deleted.

Loading