diff --git a/conf/modules.config b/conf/modules.config index eaa35f259..d3c22f00c 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -41,8 +41,7 @@ process { publishDir = [ path: { "${params.outdir}/genome" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -54,8 +53,7 @@ process { publishDir = [ path: { "${params.outdir}/genome/index" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -64,8 +62,7 @@ process { publishDir = [ path: { "${params.outdir}/genome" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -73,8 +70,7 @@ process { publishDir = [ path: { "${params.outdir}/genome/index" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -83,8 +79,7 @@ process { publishDir = [ path: { "${params.outdir}/genome/index" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -93,8 +88,7 @@ process { publishDir = [ path: { "${params.outdir}/genome/index" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -102,8 +96,7 @@ process { publishDir = [ path: { "${params.outdir}/genome" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -111,8 +104,7 @@ process { publishDir = [ path: { "${params.outdir}/genome" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -120,8 +112,7 @@ process { publishDir = [ path: { "${params.outdir}/genome" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -129,8 +120,7 @@ process { publishDir = [ path: { "${params.outdir}/genome" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } @@ -138,8 +128,7 @@ process { publishDir = [ path: { "${params.outdir}/fastq" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_merged_fastq + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_merged_fastq ? filename : null } ] } } @@ -151,8 +140,7 @@ if (!params.skip_bbsplit && params.bbsplit_fasta_list) { publishDir = [ path: { "${params.outdir}/genome/index" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference + saveAs: { filename -> filename.equals('versions.yml') ? null : params.save_reference ? filename : null } ] } } @@ -167,9 +155,6 @@ process { ext.args = '--record-count 1000000 --seed 1' ext.prefix = { "${meta.id}.subsampled" } publishDir = [ - path: { "${params.outdir}/sample_fastq/fastq" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, enabled: false ] } @@ -177,9 +162,6 @@ process { withName: '.*:FASTQ_SUBSAMPLE_FQ_SALMON:SALMON_QUANT' { ext.args = '--skipQuant' publishDir = [ - path: { "${params.outdir}/sample_fastq/salmon" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_meta_info.json') ? null : filename }, enabled: false ] } @@ -236,7 +218,7 @@ if (!params.skip_trimming) { path: { "${params.outdir}/${params.trimmer}" }, mode: params.publish_dir_mode, pattern: "*.fq.gz", - enabled: params.save_trimmed + saveAs: { params.save_trimmed ? it : null } ], [ path: { "${params.outdir}/${params.trimmer}" }, @@ -251,7 +233,7 @@ if (!params.skip_trimming) { if (params.trimmer == 'fastp') { process { withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTP' { - ext.args = params.extra_fastp_args ?: '' + ext.args = { params.extra_fastp_args ?: '' } publishDir = [ [ path: { "${params.outdir}/${params.trimmer}" }, @@ -267,7 +249,7 @@ if (!params.skip_trimming) { path: { "${params.outdir}/${params.trimmer}" }, mode: params.publish_dir_mode, pattern: "*.fastq.gz", - enabled: params.save_trimmed + saveAs: { params.save_trimmed ? it : null } ] ] } @@ -278,12 +260,12 @@ if (!params.skip_trimming) { if (params.with_umi && !params.skip_umi_extract) { process { withName: 'UMITOOLS_EXTRACT' { - ext.args = [ + ext.args = { [ params.umitools_extract_method ? "--extract-method=${params.umitools_extract_method}" : '', params.umitools_bc_pattern ? "--bc-pattern='${params.umitools_bc_pattern}'" : '', params.umitools_bc_pattern2 ? "--bc-pattern2='${params.umitools_bc_pattern2}'" : '', params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' - ].join(' ').trim() + ].join(' ').trim() } publishDir = [ [ path: { "${params.outdir}/umitools" }, @@ -294,7 +276,7 @@ if (params.with_umi && !params.skip_umi_extract) { path: { "${params.outdir}/umitools" }, mode: params.publish_dir_mode, pattern: "*.fastq.gz", - enabled: params.save_umi_intermeds + saveAs: { params.save_umi_intermeds ? it : null } ] ] } @@ -319,7 +301,7 @@ if (!params.skip_bbsplit) { path: { "${params.outdir}/bbsplit" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', - enabled: params.save_bbsplit_reads + saveAs: { params.save_bbsplit_reads ? it : null } ] ] } @@ -340,7 +322,7 @@ if (params.remove_ribo_rna) { path: { "${params.outdir}/sortmerna" }, mode: params.publish_dir_mode, pattern: "*.fastq.gz", - enabled: params.save_non_ribo_reads + saveAs: { params.save_non_ribo_reads ? it : null } ] ] } @@ -368,25 +350,21 @@ if (!params.skip_alignment) { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: "*.bam", - enabled: ( ['star_salmon','hisat2'].contains(params.aligner) && - ( params.save_align_intermeds || - ( !params.with_umi && params.skip_markduplicates ) - ) - ) || params.save_align_intermeds || params.skip_markduplicates + saveAs: { ( ['star_salmon','hisat2'].contains(params.aligner) && + ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) + ) || params.save_align_intermeds || params.skip_markduplicates ? it : null } ] } withName: 'NFCORE_RNASEQ:RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX' { - ext.args = params.bam_csi_index ? '-c' : '' + ext.args = { params.bam_csi_index ? '-c' : '' } publishDir = [ path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: "*.{bai,csi}", - enabled: ( ['star_salmon','hisat2'].contains(params.aligner) && - ( params.save_align_intermeds || - ( !params.with_umi && params.skip_markduplicates ) - ) - ) || params.save_align_intermeds || params.skip_markduplicates + saveAs: { ( ['star_salmon','hisat2'].contains(params.aligner) && + ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) + ) || params.save_align_intermeds || params.skip_markduplicates ? it : null } ] } } @@ -411,7 +389,7 @@ if (!params.skip_alignment) { } withName: '.*:BAM_MARKDUPLICATES_PICARD:SAMTOOLS_INDEX' { - ext.args = params.bam_csi_index ? '-c' : '' + ext.args = { params.bam_csi_index ? '-c' : '' } ext.prefix = { "${meta.id}.markdup.sorted" } publishDir = [ path: { "${params.outdir}/${params.aligner}" }, @@ -450,27 +428,19 @@ if (!params.skip_alignment) { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bam', - enabled: ( - params.save_align_intermeds || - params.with_umi || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? it : null } ] ] } withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_GENOME:SAMTOOLS_INDEX' { - ext.args = params.bam_csi_index ? '-c' : '' + ext.args = { params.bam_csi_index ? '-c' : '' } ext.prefix = { "${meta.id}.umi_dedup.sorted" } publishDir = [ path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.{bai,csi}', - enabled: ( - params.save_align_intermeds || - params.with_umi || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? it : null } ] } @@ -490,7 +460,6 @@ if (!params.skip_alignment) { withName: 'BEDTOOLS_GENOMECOV' { ext.args = '-split -du' publishDir = [ - path: { "${params.outdir}/bedtools/${meta.id}" }, enabled: false ] } @@ -498,7 +467,6 @@ if (!params.skip_alignment) { withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_FORWARD:UCSC_BEDCLIP' { ext.prefix = { "${meta.id}.clip.forward" } publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, enabled: false ] } @@ -515,7 +483,6 @@ if (!params.skip_alignment) { withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_REVERSE:UCSC_BEDCLIP' { ext.prefix = { "${meta.id}.clip.reverse" } publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, enabled: false ] } @@ -534,10 +501,10 @@ if (!params.skip_alignment) { if (!params.skip_stringtie) { process { withName: 'STRINGTIE_STRINGTIE' { - ext.args = [ + ext.args = { [ '-v', params.stringtie_ignore_gtf ? '' : '-e' - ].join(' ').trim() + ].join(' ').trim() } publishDir = [ path: { "${params.outdir}/${params.aligner}/stringtie" }, mode: params.publish_dir_mode, @@ -555,7 +522,7 @@ if (!params.skip_alignment) { if (!params.skip_alignment && params.aligner == 'star_salmon') { process { withName: '.*:ALIGN_STAR:STAR_ALIGN|.*:ALIGN_STAR:STAR_ALIGN_IGENOMES' { - ext.args = [ + ext.args = { [ '--quantMode TranscriptomeSAM', '--twopassMode Basic', '--outSAMtype BAM Unsorted', @@ -568,7 +535,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { '--outSAMstrandField intronMotif', params.save_unaligned ? '--outReadsUnmapped Fastx' : '', params.extra_star_align_args ? params.extra_star_align_args.split("\\s(?=--)") : '' - ].flatten().unique(false).join(' ').trim() + ].flatten().unique(false).join(' ').trim() } publishDir = [ [ path: { "${params.outdir}/${params.aligner}/log" }, @@ -579,19 +546,19 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bam', - enabled: params.save_align_intermeds + saveAs: { params.save_align_intermeds ? it : null } ], [ path: { "${params.outdir}/${params.aligner}/unmapped" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', - enabled: params.save_unaligned + saveAs: { params.save_unaligned ? it : null } ] ] } withName: '.*:QUANTIFY_STAR_SALMON:SALMON_QUANT' { - ext.args = params.extra_salmon_quant_args ?: '' + ext.args = { params.extra_salmon_quant_args ?: '' } publishDir = [ path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, @@ -633,10 +600,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bam', - enabled: ( - params.save_align_intermeds || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } ] } @@ -652,10 +616,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bam', - enabled: ( - params.save_align_intermeds || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } ] ] } @@ -666,10 +627,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bam', - enabled: ( - params.save_align_intermeds || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } ] } @@ -678,10 +636,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bai', - enabled: ( - params.save_align_intermeds || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } ] } @@ -691,10 +646,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { path: { "${params.outdir}/${params.aligner}/samtools_stats" }, mode: params.publish_dir_mode, pattern: '*.{stats,flagstat,idxstats}', - enabled: ( - params.save_align_intermeds || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } ] } @@ -715,10 +667,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bam', - enabled: ( - params.save_align_intermeds || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } ] ] } @@ -728,10 +677,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bai', - enabled: ( - params.save_align_intermeds || - params.save_umi_intermeds - ) + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } ] } @@ -749,13 +695,13 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { if (!params.skip_qc & !params.skip_deseq2_qc) { process { withName: 'DESEQ2_QC_STAR_SALMON' { - ext.args = [ + ext.args = { [ "--id_col 1", "--sample_suffix ''", "--outprefix deseq2", "--count_col 3", params.deseq2_vst ? '--vst TRUE' : '' - ].join(' ').trim() + ].join(' ').trim() } ext.args2 = 'star_salmon' publishDir = [ path: { "${params.outdir}/${params.aligner}/deseq2_qc" }, @@ -791,7 +737,7 @@ if (!params.skip_alignment && params.aligner == 'star_rsem') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: "*.bam", - enabled: params.save_align_intermeds + saveAs: { params.save_align_intermeds ? it : null } ], [ path: { "${params.outdir}/${params.aligner}/log" }, @@ -813,13 +759,13 @@ if (!params.skip_alignment && params.aligner == 'star_rsem') { if (!params.skip_qc & !params.skip_deseq2_qc) { process { withName: 'DESEQ2_QC_RSEM' { - ext.args = [ + ext.args = { [ "--id_col 1", "--sample_suffix ''", "--outprefix deseq2", "--count_col 3", params.deseq2_vst ? '--vst TRUE' : '' - ].join(' ').trim() + ].join(' ').trim() } ext.args2 = 'star_rsem' publishDir = [ path: { "${params.outdir}/${params.aligner}/deseq2_qc" }, @@ -849,13 +795,13 @@ if (!params.skip_alignment && params.aligner == 'hisat2') { path: { "${params.outdir}/${params.aligner}" }, mode: params.publish_dir_mode, pattern: '*.bam', - enabled: params.save_align_intermeds + saveAs: { params.save_align_intermeds ? it : null } ], [ path: { "${params.outdir}/${params.aligner}/unmapped" }, mode: params.publish_dir_mode, pattern: '*.fastq.gz', - enabled: params.save_unaligned + saveAs: { params.save_unaligned ? it : null } ] ] } @@ -936,11 +882,11 @@ if (!params.skip_alignment && !params.skip_qc) { if (!params.skip_biotype_qc && params.featurecounts_group_type) { process { withName: 'SUBREAD_FEATURECOUNTS' { - ext.args = [ + ext.args = { [ '-B -C', params.gencode ? "-g gene_type" : "-g $params.featurecounts_group_type", "-t $params.featurecounts_feature_type" - ].join(' ').trim() + ].join(' ').trim() } publishDir = [ path: { "${params.outdir}/${params.aligner}/featurecounts" }, mode: params.publish_dir_mode, @@ -1112,7 +1058,7 @@ if (!params.skip_alignment && !params.skip_qc) { if (!params.skip_multiqc) { process { withName: 'MULTIQC' { - ext.args = params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' + ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' } publishDir = [ path: { [ "${params.outdir}/multiqc", @@ -1132,7 +1078,7 @@ if (!params.skip_multiqc) { if (!params.skip_pseudo_alignment && params.pseudo_aligner == 'salmon') { process { withName: '.*:QUANTIFY_SALMON:SALMON_QUANT' { - ext.args = params.extra_salmon_quant_args ?: '' + ext.args = { params.extra_salmon_quant_args ?: '' } publishDir = [ path: { "${params.outdir}/${params.pseudo_aligner}" }, mode: params.publish_dir_mode, @@ -1168,13 +1114,13 @@ if (!params.skip_pseudo_alignment && params.pseudo_aligner == 'salmon') { if (!params.skip_qc & !params.skip_deseq2_qc) { process { withName: 'DESEQ2_QC_SALMON' { - ext.args = [ + ext.args = { [ "--id_col 1", "--sample_suffix ''", "--outprefix deseq2", "--count_col 3", params.deseq2_vst ? '--vst TRUE' : '' - ].join(' ').trim() + ].join(' ').trim() } ext.args2 = 'salmon' publishDir = [ path: { "${params.outdir}/${params.pseudo_aligner}/deseq2_qc" },