/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    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            = Conditional clause
----------------------------------------------------------------------------------------
*/

//
// CADD annotation
//

process {
    withName: '.*:ANNOTATE_CADD.*' {
        ext.when = { (params.cadd_resources != null) && ( !(workflow.profile.tokenize(',').intersect(['test', 'test_one_sample']).size() >= 1) || workflow.stubRun) }
    }

    withName: '.*:ANNOTATE_CADD:BCFTOOLS_VIEW' {
        ext.args   = { "--output-type z --types indels" }
        ext.prefix = { "${vcf.simpleName}_indels" }
    }

    withName: '.*:ANNOTATE_CADD:CADD' {
        ext.args   = { "-g ${params.genome}" }
        ext.prefix = { "${vcf.simpleName}_cadd" }
    }

    withName: '.*:ANNOTATE_CADD:TABIX_CADD' {
        ext.args = { "--force --sequence 1 --begin 2 --end 2" }
    }

    withName: '.*:ANNOTATE_CADD:BCFTOOLS_ANNOTATE' {
        ext.args   = { "--columns Chrom,Pos,Ref,Alt,-,CADD --output-type z" }
        ext.prefix = { "${input.simpleName}_ann" }
    }
}
