/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    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
----------------------------------------------------------------------------------------
*/

//
// SNV calling options - deepvariant
//

process {

    withName: '.*CALL_SNV_DEEPVARIANT:.*' {
        ext.when = params.variant_caller.equals("deepvariant")
    }

    withName: '.*CALL_SNV_DEEPVARIANT:DEEPVARIANT' {
        ext.args = { "--model_type=${params.analysis_type.toUpperCase()}" }
        ext.prefix = { "${meta.id}_deepvar" }
    }

    withName: '.*CALL_SNV_DEEPVARIANT:GLNEXUS' {
        ext.args = '--config DeepVariant_unfiltered'
    }

    withName: '.*CALL_SNV_DEEPVARIANT:SPLIT_MULTIALLELICS_GL' {
        ext.args = '--output-type z --multiallelics -both'
    }

    withName: '.*CALL_SNV_DEEPVARIANT:REMOVE_DUPLICATES_GL' {
        ext.args = '--output-type z --rm-dup none'
        ext.prefix = { "${meta.id}_split_rmdup" }
    }

    withName: '.*CALL_SNV_DEEPVARIANT:ADD_VARCALLER_TO_BED' {
        ext.args2   = '-s 1 -b 2 -e 3'
    }

    withName: '.*CALL_SNV_DEEPVARIANT:BCFTOOLS_ANNOTATE' {
        ext.args = "-c CHROM,FROM,TO,FOUND_IN --output-type z"
        ext.prefix = { "${meta.id}_split_rmdup_info" }
    }
}
