process {

    publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

    withName: BWA_MEM {
        ext.prefix = "human"
    }

    withName: BWA_MEM_COV2 {
        ext.prefix = "cov2"
    }

    withName: SAMTOOLS_SORT {
        ext.args = '-n'
        ext.prefix = "sorted"
    }

    withName: SAMTOOLS_SORT_COV2 {
        ext.args = '-n'
        ext.prefix = "sorted_cov2"
    }
    
    withName: BAMCMP {
        ext.args = '-s "as"'
    }

}
