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

// ASCAT

process {

    withName: 'ASCAT' {
        ext.args         = {[
            "gender": meta.sex,
            "genomeVersion": params.ascat_genome,
            "purity": params.ascat_purity,
            "ploidy": params.ascat_ploidy,
            "minCounts": params.ascat_min_counts,
            "chrom_names": meta.sex == 'XX' ? "c(1:22, 'X')" : "c(1:22, 'X', 'Y')",
            "min_base_qual": params.ascat_min_base_qual,
            "min_map_qual": params.ascat_min_map_qual
            ]}
        ext.when         = { params.tools && params.tools.split(',').contains('ascat') }
        publishDir       = [
            mode: params.publish_dir_mode,
            path: { "${params.outdir}/variant_calling/ascat/${meta.id}/" },
            pattern: "*{png,cnvs.txt,metrics.txt,purityploidy.txt,segments.txt,LogR.txt,BAF.txt}"
        ]
    }
}
