From 98b024c0e46ef0ea994cd2cba408f0043e7e4dcf Mon Sep 17 00:00:00 2001 From: "Maxime U. Garcia" Date: Mon, 6 Dec 2021 12:59:49 +0100 Subject: [PATCH] Fix syntax for extra containers for ensemblvep and snpeff (#1105) * fix: correct syntax for task.ext.use_cache * Apply suggestions from code review * fix: simplify logic * fix: update to new syntax --- modules/ensemblvep/main.nf | 14 ++++++-------- modules/snpeff/main.nf | 14 ++++++-------- tests/modules/ensemblvep/nextflow.config | 3 +-- tests/modules/snpeff/nextflow.config | 3 +-- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/modules/ensemblvep/main.nf b/modules/ensemblvep/main.nf index 3182feb2..9caffb0c 100644 --- a/modules/ensemblvep/main.nf +++ b/modules/ensemblvep/main.nf @@ -2,13 +2,11 @@ process ENSEMBLVEP { label 'process_medium' conda (params.enable_conda ? "bioconda::ensembl-vep=104.3" : null) - if (task.ext.use_cache) { - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + !task.ext.container_tag ? 'https://depot.galaxyproject.org/singularity/ensembl-vep:104.3--pl5262h4a94de4_0' : - 'quay.io/biocontainers/ensembl-vep:104.3--pl5262h4a94de4_0' }" - } else { - container "nfcore/vep:${task.ext.vep_tag}" - } + 'quay.io/biocontainers/ensembl-vep:104.3--pl5262h4a94de4_0' : + "nfcore/vep:${task.ext.container_tag}" }" input: tuple val(meta), path(vcf) @@ -25,7 +23,7 @@ process ENSEMBLVEP { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def dir_cache = task.ext.use_cache ? "\${PWD}/${cache}" : "/.vep" + def dir_cache = cache ? "\${PWD}/${cache}" : "/.vep" """ mkdir $prefix @@ -39,7 +37,7 @@ process ENSEMBLVEP { --cache_version $cache_version \\ --dir_cache $dir_cache \\ --fork $task.cpus \\ - --format vcf \\ + --vcf \\ --stats_file ${prefix}.summary.html rm -rf $prefix diff --git a/modules/snpeff/main.nf b/modules/snpeff/main.nf index d0ec993e..db9cca72 100644 --- a/modules/snpeff/main.nf +++ b/modules/snpeff/main.nf @@ -2,13 +2,11 @@ process SNPEFF { label 'process_medium' conda (params.enable_conda ? "bioconda::snpeff=5.0" : null) - if (task.ext.use_cache) { - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + !task.ext.container_tag ? 'https://depot.galaxyproject.org/singularity/snpeff:5.0--hdfd78af_1' : - 'quay.io/biocontainers/snpeff:5.0--hdfd78af_1' }" - } else { - container "nfcore/snpeff:${task.ext.snpeff_tag}" - } + 'quay.io/biocontainers/snpeff:5.0--hdfd78af_1' : + "nfcore/snpeff:${task.ext.container_tag}" }" input: tuple val(meta), path(vcf) @@ -29,14 +27,14 @@ process SNPEFF { avail_mem = task.memory.giga } def prefix = task.ext.prefix ?: "${meta.id}" - def dir_cache = task.ext.use_cache ? "-dataDir \${PWD}/${cache}" : "" + def cache_command = cache ? "-dataDir \${PWD}/${cache}" : "" """ snpEff \\ -Xmx${avail_mem}g \\ $db \\ $args \\ -csvStats ${prefix}.csv \\ - $dir_cache \\ + $cache_command \\ $vcf \\ > ${prefix}.ann.vcf diff --git a/tests/modules/ensemblvep/nextflow.config b/tests/modules/ensemblvep/nextflow.config index bcca2d06..717fcae9 100644 --- a/tests/modules/ensemblvep/nextflow.config +++ b/tests/modules/ensemblvep/nextflow.config @@ -3,8 +3,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } withName: ENSEMBLVEP { - ext.vep_tag = '104.3.WBcel235' - ext.use_cache = false + ext.container_tag = '104.3.WBcel235' } } diff --git a/tests/modules/snpeff/nextflow.config b/tests/modules/snpeff/nextflow.config index 589c8cfb..3b094eed 100644 --- a/tests/modules/snpeff/nextflow.config +++ b/tests/modules/snpeff/nextflow.config @@ -3,8 +3,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } withName: SNPEFF { - ext.snpeff_tag = '5.0.WBcel235' - ext.use_cache = false + ext.container_tag = '5.0.WBcel235' } }