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

//
// Filter out clinical and research variants
//

// SNVs

process {
    withName: '.*:GENERATE_CLINICAL_SET_SNV:ENSEMBLVEP_FILTERVEP' {
        ext.when   = !params.skip_vep_filter
        ext.prefix = { "${meta.id}_snv_${meta.set}" }
        ext.args   = { "--filter \"HGNC_ID in ${meta.hgnc_ids.join(',')}\"" }
    }

    withName: '.*:GENERATE_CLINICAL_SET_SNV:TABIX_BGZIP' {
        ext.when   = !params.skip_vep_filter
        ext.prefix = { "${meta.id}_snv_${meta.set}" }
    }
}

// SVs

process {
    withName: '.*:GENERATE_CLINICAL_SET_SV:ENSEMBLVEP_FILTERVEP' {
        ext.when   = !params.skip_vep_filter
        ext.prefix = { "${input.simpleName}_sv_${meta.set}" }
        ext.args   = { "--filter \"HGNC_ID in ${meta.hgnc_ids.join(',')}\"" }
    }

    withName: '.*:GENERATE_CLINICAL_SET_SV:TABIX_BGZIP' {
        ext.when   = !params.skip_vep_filter
        ext.prefix = { "${meta.id}_sv_${meta.set}" }
    }
}

// MT variants

process {
    withName: '.*:GENERATE_CLINICAL_SET_MT:ENSEMBLVEP_FILTERVEP' {
        ext.when   = !params.skip_vep_filter
        ext.prefix = { "${meta.id}_mt_${meta.set}" }
        ext.args   = { "--filter \"HGNC_ID in ${meta.hgnc_ids.join(',')}\"" }
    }

    withName: '.*:GENERATE_CLINICAL_SET_MT:TABIX_BGZIP' {
        ext.when   = !params.skip_vep_filter
        ext.prefix = { "${meta.id}_mt_${meta.set}" }
    }
}
