/*
========================================================================================
    Config file for defining DSL2 per module options
========================================================================================
    Available keys to override module options:
        args            = Additional arguments appended to command in module.
        args2           = Second set of arguments appended to command in module (multi-tool modules).
        args3           = Third set of arguments appended to command in module (multi-tool modules).
        publish_dir     = Directory to publish results.
        publish_by_meta = Groovy list of keys available in meta map to append as directories to "publish_dir" path
                            If publish_by_meta = true                 - Value of ${meta['id']} is appended as a directory to "publish_dir" path
                            If publish_by_meta = ['id', 'custompath'] - If "id" is in meta map and "custompath" isn't then "${meta['id']}/custompath/"
                                                                        is appended as a directory to "publish_dir" path
                            If publish_by_meta = false / null         - No directories are appended to "publish_dir" path
        publish_files   = Groovy map where key = "file_ext" and value = "directory" to publish results for that file extension
                            The value of "directory" is appended to the standard "publish_dir" path as defined above.
                            If publish_files = null (unspecified)     - All files are published.
                            If publish_files = false                  - No files are published.
        suffix          = File name suffix for output files.
----------------------------------------------------------------------------------------
*/

params {
    modules {
        'sra_ids_to_runinfo' {
            publish_dir     = 'public_data'
            publish_files   = ['tsv':'runinfo']
        }
        'sra_runinfo_to_ftp' {
            publish_dir     = 'public_data'
            publish_files   = ['tsv':'runinfo']
        }
        'sra_fastq_ftp' {
            args            = '-C - --max-time 1200'
            publish_dir     = 'public_data'
            publish_files   = ['fastq.gz':'', 'md5':'md5']
        }
        'sra_to_samplesheet' {
            publish_dir     = 'public_data'
            publish_files   = false
        }
        'sra_merge_samplesheet' {
            publish_dir     = 'public_data'
        }
        'nanopore_collapse_primers' {
            publish_dir     = 'genome'
        }
        'nanopore_snpeff_build' {
            publish_dir     = 'genome'
        }
        'nanopore_pycoqc' {
            publish_dir     = 'pycoqc'
        }
        'nanopore_artic_guppyplex' {
            args            = '--min-length 400 --max-length 700'
            publish_files   = false
            publish_dir     = 'guppyplex'
        }
        'nanopore_nanoplot' {
            publish_by_meta = true
        }
        'nanopore_artic_minion' {
            args            = '--normalise 500'
            publish_files   = ['.sorted.bam':'', '.sorted.bam.bai':'', 'fail.vcf':'', 'merged.vcf':'', 'primers.vcf':'', 'gz':'', 'tbi':'', '.consensus.fasta':'']
            publish_dir     = "${params.artic_minion_caller}"
        }
        'nanopore_filter_bam' {
            args            = '-b -F 4'
            suffix          = '.mapped.sorted'
            publish_dir     = "${params.artic_minion_caller}"
        }
        'nanopore_filter_bam_stats' {
            suffix          = '.mapped.sorted'
            publish_files   = ['bai':'', 'stats':'samtools_stats', 'flagstat':'samtools_stats', 'idxstats':'samtools_stats']
            publish_dir     = "${params.artic_minion_caller}"
        }
        'nanopore_bcftools_stats' {
            publish_files   = ['txt':'']
            publish_dir     = "${params.artic_minion_caller}/bcftools_stats"
        }
        'nanopore_mosdepth_genome' {
            args            = '--fast-mode'
            publish_files   = ['summary.txt':'']
            publish_dir     = "${params.artic_minion_caller}/mosdepth/genome"
        }
        'nanopore_plot_mosdepth_regions_genome' {
            args            = '--input_suffix .regions.bed.gz'
            publish_files   = ['tsv':'', 'pdf': '']
            publish_dir     = "${params.artic_minion_caller}/mosdepth/genome"
        }
        'nanopore_mosdepth_amplicon' {
            args            = '--fast-mode --use-median --thresholds 0,1,10,50,100,500'
            publish_files   = ['summary.txt':'']
            publish_dir     = "${params.artic_minion_caller}/mosdepth/amplicon"
        }
        'nanopore_plot_mosdepth_regions_amplicon' {
            args            = '--input_suffix .regions.bed.gz'
            publish_files   = ['tsv':'', 'pdf': '']
            publish_dir     = "${params.artic_minion_caller}/mosdepth/amplicon"
        }
        'nanopore_pangolin' {
            publish_dir     = "${params.artic_minion_caller}/pangolin"
        }
        'nanopore_nextclade' {
            publish_dir     = "${params.artic_minion_caller}/nextclade"
        }
        'nanopore_asciigenome' {
            publish_dir     = "${params.artic_minion_caller}/asciigenome"
            publish_by_meta = true
        }
        'nanopore_quast' {
            publish_files   = ['quast':'']
            publish_dir     = "${params.artic_minion_caller}"
        }
        'nanopore_snpeff' {
            publish_files   = ['csv':'', 'txt':'', 'html':'']
            publish_dir     = "${params.artic_minion_caller}/snpeff"
        }
        'nanopore_snpeff_bgzip' {
            suffix          = '.snpeff'
            publish_dir     = "${params.artic_minion_caller}/snpeff"
        }
        'nanopore_snpeff_tabix' {
            args            = '-p vcf -f'
            suffix          = '.snpeff'
            publish_dir     = "${params.artic_minion_caller}/snpeff"
        }
        'nanopore_snpeff_stats' {
            suffix          = '.snpeff'
            publish_files   = ['txt':'bcftools_stats']
            publish_dir     = "${params.artic_minion_caller}/snpeff"
        }
        'nanopore_snpsift' {
            publish_dir     = "${params.artic_minion_caller}/snpeff"
        }
        'nanopore_multiqc' {
            args            = ''
            publish_files   = ['_data':"${params.artic_minion_caller}", 'html':"${params.artic_minion_caller}", 'csv':"${params.artic_minion_caller}"]
        }
        'illumina_bedtools_getfasta' {
            args            = '-s -nameOnly'
            publish_dir     = 'genome'
        }
        'illumina_collapse_primers_illumina' {
            publish_dir     = 'genome'
        }
        'illumina_bowtie2_build' {
            args            = '--seed 1'
            publish_dir     = 'genome/index'
        }
        'illumina_snpeff_build' {
            publish_dir     = 'genome/db'
        }
        'illumina_blast_makeblastdb' {
            args            = '-parse_seqids -dbtype nucl'
            publish_dir     = 'genome/db'
        }
        'illumina_kraken2_build' {
            args            = ''
            args2           = ''
            args3           = ''
            publish_dir     = 'genome/db'
        }
        'illumina_cat_fastq' {
            publish_files   = false
            publish_dir     = 'fastq'
        }
        'illumina_fastqc_raw' {
            args            = '--quiet'
            publish_dir     = 'fastqc/raw'
        }
        'illumina_fastqc_trim' {
            args            = '--quiet'
            publish_dir     = 'fastqc/trim'
        }
        'illumina_fastp' {
            args            = '--cut_front --cut_tail --trim_poly_x --cut_mean_quality 30 --qualified_quality_phred 30 --unqualified_percent_limit 10 --length_required 50'
            publish_files   = ['json':'', 'html':'', 'log': 'log']
        }
        'illumina_kraken2_run' {
            args            = '--report-zero-counts'
            publish_files   = ['txt':'']
        }
        'illumina_bowtie2_align' {
            args            = '--local --very-sensitive-local --seed 1'
            args2           = '-F4'
            publish_files   = ['log':'log']
            publish_dir     = 'variants/bowtie2'
        }
        'illumina_bowtie2_sort_bam' {
            suffix          = '.sorted'
            publish_files   = ['bam':'', 'bai':'', 'stats':'samtools_stats', 'flagstat':'samtools_stats', 'idxstats':'samtools_stats']
            publish_dir     = 'variants/bowtie2'
        }
        'illumina_ivar_trim' {
            args            = '-m 30 -q 20'
            suffix          = '.ivar_trim'
            publish_files   = ['log':'log']
            publish_dir     = 'variants/bowtie2'
        }
        'illumina_ivar_trim_sort_bam' {
            suffix          = '.ivar_trim.sorted'
            publish_files   = ['stats':'samtools_stats', 'flagstat':'samtools_stats', 'idxstats':'samtools_stats']
            publish_dir     = 'variants/bowtie2'
        }
        'illumina_picard_markduplicates' {
            args            = 'ASSUME_SORTED=true VALIDATION_STRINGENCY=LENIENT TMP_DIR=tmp'
            suffix          = '.markduplicates.sorted'
            publish_files   = ['bam': '', 'metrics.txt':'picard_metrics']
            publish_dir     = 'variants/bowtie2'
        }
        'illumina_picard_markduplicates_sort_bam' {
            suffix          = '.markduplicates.sorted'
            publish_files   = ['bai':'', 'stats':'samtools_stats', 'flagstat':'samtools_stats', 'idxstats':'samtools_stats']
            publish_dir     = 'variants/bowtie2'
        }
        'illumina_picard_collectmultiplemetrics' {
            args            = 'VALIDATION_STRINGENCY=LENIENT TMP_DIR=tmp'
            publish_files   = ['metrics':'picard_metrics', 'pdf': 'picard_metrics/pdf']
            publish_dir     = 'variants/bowtie2'
        }
        'illumina_mosdepth_genome' {
            args            = '--fast-mode'
            publish_files   = ['summary.txt':'']
            publish_dir     = 'variants/bowtie2/mosdepth/genome'
        }
        'illumina_plot_mosdepth_regions_genome' {
            args            = '--input_suffix .regions.bed.gz'
            publish_files   = ['tsv':'', 'pdf': '']
            publish_dir     = 'variants/bowtie2/mosdepth/genome'
        }
        'illumina_mosdepth_amplicon' {
            args            = '--fast-mode --use-median --thresholds 0,1,10,50,100,500'
            publish_files   = ['summary.txt':'']
            publish_dir     = 'variants/bowtie2/mosdepth/amplicon'
        }
        'illumina_plot_mosdepth_regions_amplicon' {
            args            = '--input_suffix .regions.bed.gz'
            publish_files   = ['tsv':'', 'pdf': '']
            publish_dir     = 'variants/bowtie2/mosdepth/amplicon'
        }
        'illumina_ivar_variants' {
            args            = '-t 0.25 -q 20 -m 10'
            args2           = '--count-orphans --no-BAQ --max-depth 0 --min-BQ 0'
            publish_dir     = 'variants/ivar'
        }
        'illumina_ivar_variants_to_vcf' {
            publish_files   = ['log':'log']
            publish_dir     = 'variants/ivar'
        }
        'illumina_ivar_tabix_bgzip' {
            publish_dir     = 'variants/ivar'
        }
        'illumina_ivar_tabix_tabix' {
            args            = '-p vcf -f'
            publish_dir     = 'variants/ivar'
        }
        'illumina_ivar_bcftools_stats' {
            publish_files   = ['txt':'bcftools_stats']
            publish_dir     = 'variants/ivar'
        }
        'illumina_ivar_consensus' {
            args            = '-t 0.75 -q 20 -m 10 -n N'
            args2           = '--count-orphans --no-BAQ --max-depth 0 --min-BQ 0 -aa'
            suffix          = '.consensus'
            publish_dir     = 'variants/ivar/consensus'
        }
        'illumina_ivar_consensus_plot' {
            suffix          = '.consensus'
            publish_dir     = 'variants/ivar/consensus/base_qc'
        }
        'illumina_ivar_snpeff' {
            publish_files   = ['csv':'', 'txt':'', 'html':'']
            publish_dir     = 'variants/ivar/snpeff'
        }
        'illumina_ivar_snpeff_bgzip' {
            suffix          = '.snpeff'
            publish_dir     = 'variants/ivar/snpeff'
        }
        'illumina_ivar_snpeff_tabix' {
            args            = '-p vcf -f'
            suffix          = '.snpeff'
            publish_dir     = 'variants/ivar/snpeff'
        }
        'illumina_ivar_snpeff_stats' {
            suffix          = '.snpeff'
            publish_files   = ['txt':'bcftools_stats']
            publish_dir     = 'variants/ivar/snpeff'
        }
        'illumina_ivar_snpsift' {
            publish_dir     = 'variants/ivar/snpeff'
        }
        'illumina_ivar_quast' {
            publish_files   = ['quast':'']
            publish_dir     = 'variants/ivar'
        }
        'illumina_ivar_pangolin' {
            publish_dir     = 'variants/ivar/pangolin'
        }
        'illumina_ivar_nextclade' {
            publish_dir     = 'variants/ivar/nextclade'
        }
        'illumina_ivar_asciigenome' {
            publish_dir     = 'variants/ivar/asciigenome'
            publish_by_meta = true
        }
        'illumina_bcftools_mpileup' {
            args            = '--count-orphans --no-BAQ --max-depth 0 --min-BQ 20 --annotate FORMAT/AD,FORMAT/ADF,FORMAT/ADR,FORMAT/DP,FORMAT/SP,INFO/AD,INFO/ADF,INFO/ADR'
            args2           = '--ploidy 1 --keep-alts --keep-masked-ref --multiallelic-caller --variants-only'
            args3           = "--include 'INFO/DP>=10'"
            publish_files   = ['gz':'', 'gz.tbi':'', 'stats.txt':'bcftools_stats']
            publish_dir     = 'variants/bcftools'
        }
        'illumina_bcftools_consensus_genomecov' {
            args            = "-bga | awk '\$4 < 10'"
            suffix          = '.coverage'
            publish_files   = false
            publish_dir     = 'variants/bcftools'
        }
        'illumina_bcftools_consensus_merge' {
            suffix          = '.coverage.merged'
            publish_files   = false
            publish_dir     = 'variants/bcftools'
        }
        'illumina_bcftools_consensus_mask' {
            suffix          = '.coverage.masked'
            publish_files   = false
            publish_dir     = 'variants/bcftools'
        }
        'illumina_bcftools_consensus_maskfasta' {
            suffix          = '.masked'
            publish_files   = false
            publish_dir     = 'variants/bcftools'
        }
        'illumina_bcftools_consensus_bcftools' {
            suffix          = '.consensus'
            publish_dir     = 'variants/bcftools/consensus'
        }
        'illumina_bcftools_consensus_plot' {
            suffix          = '.consensus'
            publish_dir     = 'variants/bcftools/consensus/base_qc'
        }
        'illumina_bcftools_snpeff' {
            publish_files   = ['csv':'', 'txt':'', 'html':'']
            publish_dir     = 'variants/bcftools/snpeff'
        }
        'illumina_bcftools_snpeff_bgzip' {
            suffix          = '.snpeff'
            publish_dir     = 'variants/bcftools/snpeff'
        }
        'illumina_bcftools_snpeff_tabix' {
            args            = '-p vcf -f'
            suffix          = '.snpeff'
            publish_dir     = 'variants/bcftools/snpeff'
        }
        'illumina_bcftools_snpeff_stats' {
            suffix          = '.snpeff'
            publish_files   = ['txt':'bcftools_stats']
            publish_dir     = 'variants/bcftools/snpeff'
        }
        'illumina_bcftools_snpsift' {
            publish_dir     = 'variants/bcftools/snpeff'
        }
        'illumina_bcftools_quast' {
            publish_files   = ['quast':'']
            publish_dir     = 'variants/bcftools'
        }
        'illumina_bcftools_pangolin' {
            publish_dir     = 'variants/bcftools/pangolin'
        }
        'illumina_bcftools_nextclade' {
            publish_dir     = 'variants/bcftools/nextclade'
        }
        'illumina_bcftools_asciigenome' {
            publish_dir     = 'variants/bcftools/asciigenome'
            publish_by_meta = true
        }
        'illumina_bcftools_isec' {
            args            = '--nfiles +2 --output-type z'
            publish_dir     = 'variants/intersect'
        }
        'illumina_cutadapt' {
            args            = '--overlap 5 --minimum-length 30 --error-rate 0.1'
            suffix          = '.primer_trim'
            publish_files   = ['log':'log']
            publish_dir     = 'assembly/cutadapt'
        }
        'illumina_cutadapt_fastqc' {
            args            = '--quiet'
            suffix          = 'primer_trim'
            publish_dir     = 'assembly/cutadapt/fastqc'
        }
        'illumina_spades' {
            args            = ''
            publish_files   = ['log':'log', 'fa':'', 'gfa':'']
            publish_dir     = "assembly/spades/${params.spades_mode}"
        }
        'illumina_spades_bandage' {
            args            = '--height 1000'
            publish_dir     = "assembly/spades/${params.spades_mode}/bandage"
        }
        'illumina_spades_blastn' {
            args            = "-outfmt '6 stitle std slen qlen qcovs'"
            publish_dir     = "assembly/spades/${params.spades_mode}/blastn"
        }
        'illumina_spades_blastn_filter' {
            suffix          = '.filter.blastn'
            publish_dir     = "assembly/spades/${params.spades_mode}/blastn"
        }
        'illumina_spades_abacas' {
            args            = '-m -p nucmer'
            publish_dir     = "assembly/spades/${params.spades_mode}/abacas"
        }
        'illumina_spades_plasmidid' {
            args            = '--only-reconstruct -C 47 -S 47 -i 60 --no-trim -k 0.80'
            publish_files   = ['html':'', 'tab':'', 'logs':'', 'images':'']
            publish_dir     = "assembly/spades/${params.spades_mode}/plasmidid"
        }
        'illumina_spades_quast' {
            publish_files   = ['quast':'']
            publish_dir     = "assembly/spades/${params.spades_mode}"
        }
        'illumina_unicycler' {
            publish_files   = ['log':'log', 'fa':'', 'gfa':'']
            publish_dir     = 'assembly/unicycler'
        }
        'illumina_unicycler_bandage' {
            args            = '--height 1000'
            publish_dir     = 'assembly/unicycler/bandage'
        }
        'illumina_unicycler_blastn' {
            args            = "-outfmt '6 stitle std slen qlen qcovs'"
            publish_dir     = 'assembly/unicycler/blastn'
        }
        'illumina_unicycler_blastn_filter' {
            suffix          = '.filter.blastn'
            publish_dir     = 'assembly/unicycler/blastn'
        }
        'illumina_unicycler_abacas' {
            args            = '-m -p nucmer'
            publish_dir     = 'assembly/unicycler/abacas'
        }
        'illumina_unicycler_plasmidid' {
            args            = '--only-reconstruct -C 47 -S 47 -i 60 --no-trim -k 0.80'
            publish_files   = ['html':'', 'tab':'', 'logs':'', 'images':'']
            publish_dir     = 'assembly/unicycler/plasmidid'
        }
        'illumina_unicycler_quast' {
            publish_files   = ['quast':'']
            publish_dir     = 'assembly/unicycler'
        }
        'illumina_minia' {
            args            = '-kmer-size 31 -abundance-min 20'
            publish_dir     = 'assembly/minia'
        }
        'illumina_minia_blastn' {
            args            = "-outfmt '6 stitle std slen qlen qcovs'"
            publish_dir     = 'assembly/minia/blastn'
        }
        'illumina_minia_blastn_filter' {
            suffix          = '.filter.blastn'
            publish_dir     = 'assembly/minia/blastn'
        }
        'illumina_minia_abacas' {
            args            = '-m -p nucmer'
            publish_dir     = 'assembly/minia/abacas'
        }
        'illumina_minia_plasmidid' {
            args            = '--only-reconstruct -C 47 -S 47 -i 60 --no-trim -k 0.80'
            publish_files   = ['html':'', 'tab':'', 'logs':'', 'images':'']
            publish_dir     = 'assembly/minia/plasmidid'
        }
        'illumina_minia_quast' {
            publish_files   = ['quast':'']
            publish_dir     = 'assembly/minia'
        }
        'illumina_multiqc' {
            args            = ''
            publish_files   = ['_data':'', 'html':'']
        }
    }
}
