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

// BAM TO FASTQ

process {

    withName: 'COLLATE_FASTQ_MAP' {
        ext.args2  = { '-N' }
        ext.prefix = { "${meta.id}.mapped" }
        publishDir = [
            //specify to avoid publishing, overwritten otherwise
            enabled: false
        ]
    }

    withName: 'COLLATE_FASTQ_UNMAP' {
        ext.args2  = { '-N' }
        ext.prefix = { "${meta.id}.unmapped" }
        publishDir = [
            //specify to avoid publishing, overwritten otherwise
            enabled: false
        ]
    }

    withName: 'SAMTOOLS_VIEW_MAP_MAP' {
        ext.args   = { '-b -f1 -F12' }
        ext.prefix = { "${meta.id}.map_map" }
        publishDir = [
            //specify to avoid publishing, overwritten otherwise
            enabled: false
        ]
    }

    withName: 'SAMTOOLS_VIEW_MAP_UNMAP' {
        ext.args   = { '-b -f8 -F260' }
        ext.prefix = { "${meta.id}.map_unmap" }
        publishDir = [
            //specify to avoid publishing, overwritten otherwise
            enabled: false
        ]
    }

    withName: 'SAMTOOLS_VIEW_UNMAP_MAP' {
        ext.args   = { '-b -f4 -F264' }
        ext.prefix = { "${meta.id}.unmap_map" }
        publishDir = [
            //specify to avoid publishing, overwritten otherwise
            enabled: false
        ]
    }

    withName: 'SAMTOOLS_VIEW_UNMAP_UNMAP' {
        ext.args   = { '-b -f12 -F256' }
        ext.prefix = { "${meta.id}.unmap_unmap" }
        publishDir = [
            //specify to avoid publishing, overwritten otherwise
            enabled: false
        ]
    }

    withName: 'SAMTOOLS_MERGE_UNMAP' {
        ext.prefix = { "${meta.id}.merged_unmap" }
        publishDir = [
            //specify to avoid publishing, overwritten otherwise
            enabled: false
        ]
    }
    withName: 'CAT_FASTQ' {
        publishDir = [
            //specify to avoid publishing, overwritten otherwise
            enabled: false
        ]
    }
}
