/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Config file for defining DSL2 per module options and publishing paths
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Available keys to override module options:
        ext.args   = Additional arguments appended to command in module.
        ext.args2  = Second set of arguments appended to command in module (multi-tool modules).
        ext.args3  = Third set of arguments appended to command in module (multi-tool modules).
        ext.prefix = File name prefix for output files.
        ext.when   = When to run the module.
----------------------------------------------------------------------------------------
*/

// PREPARE_CACHE

process {

    // SNPEFF
    withName: 'SNPEFF_DOWNLOAD' {
        ext.when         = { params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('merge')) }
        publishDir       = [
            mode: params.publish_dir_mode,
            path: { params.outdir_cache ? "${params.outdir_cache}/": "${params.outdir}/cache/" }
        ]
    }

    // VEP
    withName: 'ENSEMBLVEP_DOWNLOAD' {
        ext.when         = { params.tools && (params.tools.split(',').contains('vep') || params.tools.split(',').contains('merge')) }
        ext.args         = '--AUTO c --CONVERT --NO_BIOPERL --NO_HTSLIB --NO_TEST --NO_UPDATE'
        publishDir       = [
            mode: params.publish_dir_mode,
            path: { params.outdir_cache ? "${params.outdir_cache}/": "${params.outdir}/cache/" }
        ]
    }
}
