/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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. ---------------------------------------------------------------------------------------- */ process { withName: SAMPLESHEET_CHECK { publishDir = [ path: { "${params.outdir}/pipeline_info" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] } withName: DATABASE_CHECK { publishDir = [ path: { "${params.outdir}/pipeline_info" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] } withName: FASTQC { ext.args = '--quiet' ext.prefix = { "${meta.id}_${meta.run_accession}_raw" } publishDir = [ path: { "${params.outdir}/fastqc/raw" }, mode: params.publish_dir_mode, pattern: '*.html' ] } withName: FASTQC_PROCESSED { ext.args = '--quiet' ext.prefix = { "${meta.id}_${meta.run_accession}_processed" } publishDir = [ path: { "${params.outdir}/fastqc/processed" }, mode: params.publish_dir_mode, pattern: '*.html' ] } withName: FASTP_SINGLE { ext.args = [ // trimming options params.shortread_clipmerge_skipadaptertrim ? "--disable_adapter_trimming" : "", params.shortread_clipmerge_adapter1 ? "--adapter_sequence ${params.shortread_clipmerge_adapter1}" : "", // filtering options "--length_required ${params.shortread_clipmerge_minlength}" ].join(' ').trim() ext.prefix = { "${meta.id}_${meta.run_accession}" } publishDir = [ path: { "${params.outdir}/fastp" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', enabled: params.save_preprocessed_reads ] } withName: FASTP_PAIRED { ext.args = [ // collapsing options - option to retain singletons params.shortread_clipmerge_excludeunmerged ? '' : "--include_unmerged", // trimming options params.shortread_clipmerge_skipadaptertrim ? "--disable_adapter_trimming" : "", params.shortread_clipmerge_adapter1 ? "--adapter_sequence ${params.shortread_clipmerge_adapter1}" : "", params.shortread_clipmerge_adapter2 ? "--adapter_sequence_r2 ${params.shortread_clipmerge_adapter2}" : "--detect_adapter_for_pe", // filtering options "--length_required ${params.shortread_clipmerge_minlength}" ].join(' ').trim() ext.prefix = { "${meta.id}_${meta.run_accession}" } publishDir = [ path: { "${params.outdir}/fastp" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', enabled: params.save_preprocessed_reads ] } withName: ADAPTERREMOVAL_SINGLE { ext.args = [ // trimming options params.shortread_clipmerge_skipadaptertrim ? "--adapter1 '' --adapter2 ''" : "", params.shortread_clipmerge_adapter1 ? "--adapter1 ${params.shortread_clipmerge_adapter1}" : "", // filtering options "--minlength ${params.shortread_clipmerge_minlength}" ].join(' ').trim() ext.prefix = { "${meta.id}_${meta.run_accession}" } publishDir = [ path: { "${params.outdir}/adapterremoval" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', enabled: params.save_preprocessed_reads ] } withName: ADAPTERREMOVAL_PAIRED { ext.args = [ // collapsing options params.shortread_clipmerge_mergepairs ? "--collapse" : "", // trimming options params.shortread_clipmerge_skipadaptertrim ? "--adapter1 '' --adapter2 ''" : "", params.shortread_clipmerge_adapter1 ? "--adapter1 ${params.shortread_clipmerge_adapter1}" : "", params.shortread_clipmerge_adapter2 ? "--adapter2 ${params.shortread_clipmerge_adapter2}" : "", // filtering options "--minlength ${params.shortread_clipmerge_minlength}" ].join(' ').trim() ext.prefix = { "${meta.id}_${meta.run_accession}" } publishDir = [ path: { "${params.outdir}/adapterremoval" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', enabled: params.save_preprocessed_reads ] } withName: PORECHOP { ext.prefix = { "${meta.id}_${meta.run_accession}" } publishDir = [ path: { "${params.outdir}/porechop" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', enabled: params.save_preprocessed_reads ] } withName: BBMAP_BBDUK { ext.args = [ "entropy=${params.shortread_complexityfilter_entropy}", "entropywindow=${params.shortread_complexityfilter_bbduk_windowsize}", params.shortread_complexityfilter_bbduk_mask ? "entropymask=t" : "entropymask=f" ].join(' ').trim() ext.prefix = { "${meta.id}-${meta.run_accession}" } publishDir = [ path: { "${params.outdir}/bbduk/" }, mode: params.publish_dir_mode, pattern: '*.{fastq.gz,log}', enabled: params.save_complexityfiltered_reads ] } withName: PRINSEQPLUSPLUS { ext.args = [ params.shortread_complexityfilter_prinseqplusplus_mode == 'dust' ? "-lc_dust=${params.shortread_complexityfilter_prinseqplusplus_dustscore}" : "-lc_entropy=${params.shortread_complexityfilter_entropy}", "-trim_qual_left=0 -trim_qual_left=0 -trim_qual_window=0 -trim_qual_step=0" ].join(' ').trim() ext.prefix = { "${meta.id}-${meta.run_accession}" } publishDir = [ path: { "${params.outdir}/prinseqplusplus/" }, mode: params.publish_dir_mode, pattern: '*{_good_out.fastq.gz,_good_out_R1.fastq.gz,_good_out_R2.fastq.gz,log}', enabled: params.save_complexityfiltered_reads ] } withName: CAT_FASTQ { ext.prefix = { "${meta.id}" } publishDir = [ path: { "${params.outdir}/run_merging/" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', enabled: params.save_runmerged_reads ] } withName: MALT_RUN { ext.args = { "${meta.db_params}" } ext.prefix = params.run_merging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } publishDir = [ path: { "${params.outdir}/malt/${meta.db_name}" }, mode: params.publish_dir_mode, pattern: '*.{log}' ] } withName: KRAKEN2_KRAKEN2 { ext.args = { "${meta.db_params}" } ext.prefix = params.run_merging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } publishDir = [ path: { "${params.outdir}/kraken2/${meta.db_name}" }, mode: params.publish_dir_mode, pattern: '*.{txt}' ] } withName: METAPHLAN3 { ext.args = { "${meta.db_params}" } ext.prefix = params.run_merging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } publishDir = [ path: { "${params.outdir}/metaphlan3/${meta.db_name}" }, mode: params.publish_dir_mode, pattern: '*.{biom,txt}' ] } withName: CENTRIFUGE_CENTRIFUGE { publishDir = [ path: { "${params.outdir}/centrifuge/${meta.db_name}" }, mode: params.publish_dir_mode, pattern: '*.txt' ] ext.args = { "${meta.db_params}" } ext.prefix = { "${meta.id}-${meta.run_accession}-${meta.db_name}" } } withName: CUSTOM_DUMPSOFTWAREVERSIONS { publishDir = [ path: { "${params.outdir}/pipeline_info" }, mode: params.publish_dir_mode, pattern: '*_versions.yml' ] } withName: MULTIQC { publishDir = [ path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] } }