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
This commit is contained in:
Maxime U. Garcia 2021-12-06 12:59:49 +01:00 committed by GitHub
parent e0aa89141f
commit 98b024c0e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 20 deletions

View file

@ -2,13 +2,11 @@ process ENSEMBLVEP {
label 'process_medium' label 'process_medium'
conda (params.enable_conda ? "bioconda::ensembl-vep=104.3" : null) 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' : 'https://depot.galaxyproject.org/singularity/ensembl-vep:104.3--pl5262h4a94de4_0' :
'quay.io/biocontainers/ensembl-vep:104.3--pl5262h4a94de4_0' }" 'quay.io/biocontainers/ensembl-vep:104.3--pl5262h4a94de4_0' :
} else { "nfcore/vep:${task.ext.container_tag}" }"
container "nfcore/vep:${task.ext.vep_tag}"
}
input: input:
tuple val(meta), path(vcf) tuple val(meta), path(vcf)
@ -25,7 +23,7 @@ process ENSEMBLVEP {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" 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 mkdir $prefix
@ -39,7 +37,7 @@ process ENSEMBLVEP {
--cache_version $cache_version \\ --cache_version $cache_version \\
--dir_cache $dir_cache \\ --dir_cache $dir_cache \\
--fork $task.cpus \\ --fork $task.cpus \\
--format vcf \\ --vcf \\
--stats_file ${prefix}.summary.html --stats_file ${prefix}.summary.html
rm -rf $prefix rm -rf $prefix

View file

@ -2,13 +2,11 @@ process SNPEFF {
label 'process_medium' label 'process_medium'
conda (params.enable_conda ? "bioconda::snpeff=5.0" : null) 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' : 'https://depot.galaxyproject.org/singularity/snpeff:5.0--hdfd78af_1' :
'quay.io/biocontainers/snpeff:5.0--hdfd78af_1' }" 'quay.io/biocontainers/snpeff:5.0--hdfd78af_1' :
} else { "nfcore/snpeff:${task.ext.container_tag}" }"
container "nfcore/snpeff:${task.ext.snpeff_tag}"
}
input: input:
tuple val(meta), path(vcf) tuple val(meta), path(vcf)
@ -29,14 +27,14 @@ process SNPEFF {
avail_mem = task.memory.giga avail_mem = task.memory.giga
} }
def prefix = task.ext.prefix ?: "${meta.id}" 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 \\ snpEff \\
-Xmx${avail_mem}g \\ -Xmx${avail_mem}g \\
$db \\ $db \\
$args \\ $args \\
-csvStats ${prefix}.csv \\ -csvStats ${prefix}.csv \\
$dir_cache \\ $cache_command \\
$vcf \\ $vcf \\
> ${prefix}.ann.vcf > ${prefix}.ann.vcf

View file

@ -3,8 +3,7 @@ process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: ENSEMBLVEP { withName: ENSEMBLVEP {
ext.vep_tag = '104.3.WBcel235' ext.container_tag = '104.3.WBcel235'
ext.use_cache = false
} }
} }

View file

@ -3,8 +3,7 @@ process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: SNPEFF { withName: SNPEFF {
ext.snpeff_tag = '5.0.WBcel235' ext.container_tag = '5.0.WBcel235'
ext.use_cache = false
} }
} }