process {

    withName: '.*BAM_NGSCHECKMATE:BCFTOOLS_MPILEUP' {
        ext.args2  = { '--no-version --ploidy 1 -c' }
        ext.args3  = { '--no-version' }
        ext.prefix = { "${meta.id}.ngscheckmate" }
        ext.when   = { params.tools && params.tools.split(',').contains('ngscheckmate') }
        publishDir = [
            mode: params.publish_dir_mode,
            path: { "${params.outdir}/reports/ngscheckmate/vcfs" },
            pattern: "*{vcf.gz}"
        ]
    }

    withName: '.*BAM_NGSCHECKMATE:NGSCHECKMATE_NCM' {
        ext.args = { '-V' }
        publishDir = [
            mode: params.publish_dir_mode,
            path: { "${params.outdir}/reports/ngscheckmate/" },
            saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
        ]
    }

}
