diff --git a/main.nf b/main.nf index 59001a4f1..fe86d24f6 100755 --- a/main.nf +++ b/main.nf @@ -10,6 +10,7 @@ */ nextflow.enable.dsl = 2 +nextflow.preview.output = true /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/modules/local/bedtools_genomecov/nextflow.config b/modules/local/bedtools_genomecov/nextflow.config index 85f3d34ae..f49fe8468 100644 --- a/modules/local/bedtools_genomecov/nextflow.config +++ b/modules/local/bedtools_genomecov/nextflow.config @@ -3,9 +3,6 @@ if (!params.skip_alignment && !params.skip_bigwig) { process { withName: 'BEDTOOLS_GENOMECOV' { ext.args = '-split -du' - publishDir = [ - enabled: false - ] } } } diff --git a/modules/local/dupradar/nextflow.config b/modules/local/dupradar/nextflow.config deleted file mode 100644 index 3ade56ad5..000000000 --- a/modules/local/dupradar/nextflow.config +++ /dev/null @@ -1,35 +0,0 @@ -if (!params.skip_alignment && !params.skip_qc) { - if (!params.skip_dupradar) { - process { - withName: 'DUPRADAR' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/dupradar/scatter_plot" }, - mode: params.publish_dir_mode, - pattern: "*Dens.pdf" - ], - [ - path: { "${params.outdir}/${params.aligner}/dupradar/box_plot" }, - mode: params.publish_dir_mode, - pattern: "*Boxplot.pdf" - ], - [ - path: { "${params.outdir}/${params.aligner}/dupradar/histogram" }, - mode: params.publish_dir_mode, - pattern: "*Hist.pdf" - ], - [ - path: { "${params.outdir}/${params.aligner}/dupradar/gene_data" }, - mode: params.publish_dir_mode, - pattern: "*Matrix.txt" - ], - [ - path: { "${params.outdir}/${params.aligner}/dupradar/intercepts_slope" }, - mode: params.publish_dir_mode, - pattern: "*slope.txt" - ] - ] - } - } - } -} diff --git a/modules/local/multiqc_custom_biotype/nextflow.config b/modules/local/multiqc_custom_biotype/nextflow.config deleted file mode 100644 index 68fecaa66..000000000 --- a/modules/local/multiqc_custom_biotype/nextflow.config +++ /dev/null @@ -1,13 +0,0 @@ -if (!params.skip_alignment && !params.skip_qc) { - if (!params.skip_biotype_qc && params.featurecounts_group_type) { - process { - withName: 'MULTIQC_CUSTOM_BIOTYPE' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/featurecounts" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } -} diff --git a/modules/nf-core/bbmap/bbsplit/nextflow.config b/modules/nf-core/bbmap/bbsplit/nextflow.config index da3ddaf31..0c37662da 100644 --- a/modules/nf-core/bbmap/bbsplit/nextflow.config +++ b/modules/nf-core/bbmap/bbsplit/nextflow.config @@ -2,19 +2,6 @@ if (!params.skip_bbsplit) { process { withName: 'BBMAP_BBSPLIT' { ext.args = 'build=1 ambiguous2=all maxindel=150000' - publishDir = [ - [ - path: { "${params.outdir}/bbsplit" }, - mode: params.publish_dir_mode, - pattern: '*.txt' - ], - [ - path: { params.save_bbsplit_reads ? "${params.outdir}/bbsplit" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.fastq.gz', - saveAs: { params.save_bbsplit_reads ? it : null } - ] - ] } } } \ No newline at end of file diff --git a/modules/nf-core/cat/fastq/nextflow.config b/modules/nf-core/cat/fastq/nextflow.config deleted file mode 100644 index 64de2e49c..000000000 --- a/modules/nf-core/cat/fastq/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - withName: 'CAT_FASTQ' { - publishDir = [ - path: { params.save_merged_fastq ? "${params.outdir}/fastq" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename.endsWith('.fastq.gz') && params.save_merged_fastq) ? filename : null } - ] - } -} diff --git a/modules/nf-core/multiqc/nextflow.config b/modules/nf-core/multiqc/nextflow.config index ac178787c..0f1fffdda 100644 --- a/modules/nf-core/multiqc/nextflow.config +++ b/modules/nf-core/multiqc/nextflow.config @@ -3,14 +3,6 @@ if (!params.skip_multiqc) { withName: 'MULTIQC' { ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' } ext.prefix = "multiqc_report" - publishDir = [ - path: { [ - "${params.outdir}/multiqc", - params.skip_alignment? '' : "/${params.aligner}" - ].join('') }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } } } \ No newline at end of file diff --git a/modules/nf-core/preseq/lcextrap/nextflow.config b/modules/nf-core/preseq/lcextrap/nextflow.config index e203e87e7..fdb888749 100644 --- a/modules/nf-core/preseq/lcextrap/nextflow.config +++ b/modules/nf-core/preseq/lcextrap/nextflow.config @@ -3,18 +3,6 @@ if (!params.skip_alignment && !params.skip_qc) { process { withName: 'PRESEQ_LCEXTRAP' { ext.args = '-verbose -bam -seed 1 -seg_len 100000000' - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/preseq" }, - mode: params.publish_dir_mode, - pattern: "*.txt" - ], - [ - path: { "${params.outdir}/${params.aligner}/preseq/log" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ] - ] } } } diff --git a/modules/nf-core/qualimap/rnaseq/nextflow.config b/modules/nf-core/qualimap/rnaseq/nextflow.config deleted file mode 100644 index 9c05fb25a..000000000 --- a/modules/nf-core/qualimap/rnaseq/nextflow.config +++ /dev/null @@ -1,13 +0,0 @@ -if (!params.skip_alignment && !params.skip_qc) { - if (!params.skip_qualimap) { - process { - withName: 'QUALIMAP_RNASEQ' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/qualimap" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } -} diff --git a/modules/nf-core/sortmerna/nextflow.config b/modules/nf-core/sortmerna/nextflow.config index 8771660ce..2f60c9b7b 100644 --- a/modules/nf-core/sortmerna/nextflow.config +++ b/modules/nf-core/sortmerna/nextflow.config @@ -2,19 +2,6 @@ if (params.remove_ribo_rna) { process { withName: 'SORTMERNA' { ext.args = '--num_alignments 1 -v' - publishDir = [ - [ - path: { "${params.outdir}/sortmerna" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ], - [ - path: { params.save_non_ribo_reads ? "${params.outdir}/sortmerna" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fastq.gz", - saveAs: { params.save_non_ribo_reads ? it : null } - ] - ] } } } \ No newline at end of file diff --git a/modules/nf-core/stringtie/stringtie/nextflow.config b/modules/nf-core/stringtie/stringtie/nextflow.config index dc0651458..03518ca96 100644 --- a/modules/nf-core/stringtie/stringtie/nextflow.config +++ b/modules/nf-core/stringtie/stringtie/nextflow.config @@ -6,11 +6,6 @@ if (!params.skip_alignment) { '-v', params.stringtie_ignore_gtf ? '' : '-e' ].join(' ').trim() } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/stringtie" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } } } diff --git a/modules/nf-core/subread/featurecounts/nextflow.config b/modules/nf-core/subread/featurecounts/nextflow.config index 3a796d101..c75038ca9 100644 --- a/modules/nf-core/subread/featurecounts/nextflow.config +++ b/modules/nf-core/subread/featurecounts/nextflow.config @@ -7,19 +7,6 @@ if (!params.skip_alignment && !params.skip_qc) { params.gencode ? "-g gene_type" : "-g $params.featurecounts_group_type", "-t $params.featurecounts_feature_type" ].join(' ').trim() } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/featurecounts" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: 'MULTIQC_CUSTOM_BIOTYPE' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/featurecounts" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } } } diff --git a/nextflow.config b/nextflow.config index 74108e825..9664eabdf 100644 --- a/nextflow.config +++ b/nextflow.config @@ -135,14 +135,8 @@ params { } -// Default publishing logic for pipeline -process { - publishDir = [ - path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] -} +outputDir = params.outdir +workflow.output.mode = params.publish_dir_mode // Load base.config by default for all pipelines includeConfig 'conf/base.config' diff --git a/subworkflows/local/align_star/main.nf b/subworkflows/local/align_star/main.nf index 4f516e8e0..a3c6c52db 100644 --- a/subworkflows/local/align_star/main.nf +++ b/subworkflows/local/align_star/main.nf @@ -80,4 +80,14 @@ workflow ALIGN_STAR { idxstats = BAM_SORT_STATS_SAMTOOLS.out.idxstats // channel: [ val(meta), [ idxstats ] ] versions = ch_versions // channel: [ versions.yml ] + + publish: + ch_orig_bam >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + ch_log_final >> 'star_salmon/log' + ch_log_out >> 'star_salmon/log' + ch_log_progress >> 'star_salmon/log' + ch_bam_sorted >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + ch_bam_transcript >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + ch_fastq >> (params.save_unaligned ? 'star_salmon/unmapped' : null) + ch_tab >> 'star_salmon/log' } diff --git a/subworkflows/local/align_star/nextflow.config b/subworkflows/local/align_star/nextflow.config index 68bfef562..beeadc15a 100644 --- a/subworkflows/local/align_star/nextflow.config +++ b/subworkflows/local/align_star/nextflow.config @@ -15,25 +15,6 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { params.save_unaligned ? '--outReadsUnmapped Fastx' : '', params.extra_star_align_args ? params.extra_star_align_args.split("\\s(?=--)") : '' ].flatten().unique(false).join(' ').trim() } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/log" }, - mode: params.publish_dir_mode, - pattern: '*.{out,tab}' - ], - [ - path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds ? it : null } - ], - [ - path: { params.save_unaligned ? "${params.outdir}/${params.aligner}/unmapped" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.fastq.gz', - saveAs: { params.save_unaligned ? it : null } - ] - ] } } } diff --git a/subworkflows/local/prepare_genome/main.nf b/subworkflows/local/prepare_genome/main.nf index 58a9b293c..701630d9d 100644 --- a/subworkflows/local/prepare_genome/main.nf +++ b/subworkflows/local/prepare_genome/main.nf @@ -76,6 +76,7 @@ workflow PREPARE_GENOME { // if (gtf || gff) { if (gtf) { + ch_gff = Channel.empty() if (gtf.endsWith('.gz')) { ch_gtf = GUNZIP_GTF ( [ [:], gtf ] ).gunzip.map { it[1] } ch_versions = ch_versions.mix(GUNZIP_GTF.out.versions) @@ -327,6 +328,30 @@ workflow PREPARE_GENOME { } } + // + // Collect channels for publishing + // + ch_genome = Channel.empty().mix( + ch_fasta, + ch_gtf, + ch_gff, + ch_add_fasta, + ch_gene_bed, + ch_transcript_fasta, + ch_fai, + ch_chrom_sizes, + ) + + ch_genome_index = Channel.empty().mix( + ch_splicesites, + ch_bbsplit_index, + ch_star_index, + ch_rsem_index, + ch_hisat2_index, + ch_salmon_index, + ch_kallisto_index, + ) + emit: fasta = ch_fasta // channel: path(genome.fasta) gtf = ch_gtf // channel: path(genome.gtf) @@ -342,4 +367,8 @@ workflow PREPARE_GENOME { salmon_index = ch_salmon_index // channel: path(salmon/index/) kallisto_index = ch_kallisto_index // channel: [ meta, path(kallisto/index/) ] versions = ch_versions.ifEmpty(null) // channel: [ versions.yml ] + + publish: + ch_genome >> (params.save_reference ? 'genome' : null) + ch_genome_index >> (params.save_reference ? 'genome/index' : null) } diff --git a/subworkflows/local/prepare_genome/nextflow.config b/subworkflows/local/prepare_genome/nextflow.config index 98a4b64fd..62d84f340 100644 --- a/subworkflows/local/prepare_genome/nextflow.config +++ b/subworkflows/local/prepare_genome/nextflow.config @@ -1,39 +1,10 @@ process { - withName: 'GUNZIP_.*|MAKE_TRANSCRIPTS_FASTA' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - withName: 'UNTAR_.*' { ext.args2 = '--no-same-owner' } - withName: 'UNTAR_.*|STAR_GENOMEGENERATE|STAR_GENOMEGENERATE_IGENOMES|HISAT2_BUILD' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - withName: 'GFFREAD' { ext.args = '--keep-exon-attrs -F -T' - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'HISAT2_EXTRACTSPLICESITES' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] } withName: 'SALMON_INDEX' { @@ -41,62 +12,18 @@ process { params.gencode ? '--gencode' : '', params.pseudo_aligner_kmer_size ? "-k ${params.pseudo_aligner_kmer_size}": '' ].join(' ').trim() } - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] } withName: 'KALLISTO_INDEX' { ext.args = params.pseudo_aligner_kmer_size ? "-k ${params.pseudo_aligner_kmer_size}" : '' - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] } withName: 'RSEM_PREPAREREFERENCE_GENOME' { ext.args = '--star' - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'GTF2BED' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'CAT_ADDITIONAL_FASTA|PREPROCESS_TRANSCRIPTS_FASTA_GENCODE' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] } withName: 'GTF_FILTER' { ext.args = { params.skip_gtf_transcript_filter ?: '--skip_transcript_id_check' } - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'CUSTOM_GETCHROMSIZES' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] } } @@ -104,11 +31,6 @@ if (!params.skip_bbsplit && params.bbsplit_fasta_list) { process { withName: 'PREPARE_GENOME:BBMAP_BBSPLIT' { ext.args = 'build=1' - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] } } } diff --git a/subworkflows/local/quantify_rsem/main.nf b/subworkflows/local/quantify_rsem/main.nf index 4b7473634..577b76589 100644 --- a/subworkflows/local/quantify_rsem/main.nf +++ b/subworkflows/local/quantify_rsem/main.nf @@ -59,4 +59,15 @@ workflow QUANTIFY_RSEM { merged_tpm_transcript = RSEM_MERGE_COUNTS.out.tpm_transcript // path: *.transcript_tpm.tsv versions = ch_versions // channel: [ versions.yml ] + + publish: + RSEM_CALCULATEEXPRESSION.out.counts_gene >> 'star_rsem' + RSEM_CALCULATEEXPRESSION.out.counts_transcript >> 'star_rsem' + RSEM_CALCULATEEXPRESSION.out.stat >> 'star_rsem' + RSEM_CALCULATEEXPRESSION.out.logs >> 'star_rsem/log' + RSEM_CALCULATEEXPRESSION.out.bam_star >> (params.save_align_intermeds ? 'star_rsem' : null) + RSEM_CALCULATEEXPRESSION.out.bam_genome >> (params.save_align_intermeds ? 'star_rsem' : null) + RSEM_CALCULATEEXPRESSION.out.bam_transcript >> (params.save_align_intermeds ? 'star_rsem' : null) + RSEM_MERGE_COUNTS.out >> 'star_rsem' + RSEM_MERGE_COUNTS.out.versions >> null } diff --git a/subworkflows/local/quantify_rsem/nextflow.config b/subworkflows/local/quantify_rsem/nextflow.config index 7b50b86c0..5a03a5576 100644 --- a/subworkflows/local/quantify_rsem/nextflow.config +++ b/subworkflows/local/quantify_rsem/nextflow.config @@ -8,32 +8,6 @@ if (!params.skip_alignment && params.aligner == 'star_rsem') { '--estimate-rspd', '--seed 1' ].join(' ').trim() - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - pattern: "*.{stat,results}" - ], - [ - path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.bam", - saveAs: { params.save_align_intermeds ? it : null } - ], - [ - path: { "${params.outdir}/${params.aligner}/log" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ] - ] - } - - withName: '.*:QUANTIFY_RSEM:RSEM_MERGE_COUNTS' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } } } diff --git a/subworkflows/nf-core/bam_dedup_stats_samtools_umitools/main.nf b/subworkflows/nf-core/bam_dedup_stats_samtools_umitools/main.nf index 7c07084ff..783332f2f 100644 --- a/subworkflows/nf-core/bam_dedup_stats_samtools_umitools/main.nf +++ b/subworkflows/nf-core/bam_dedup_stats_samtools_umitools/main.nf @@ -52,4 +52,13 @@ workflow BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS { idxstats = BAM_STATS_SAMTOOLS.out.idxstats // channel: [ val(meta), path(idxstats) ] versions = ch_versions // channel: [ path(versions.yml) ] + + publish: + UMITOOLS_DEDUP.out.bam >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + UMITOOLS_DEDUP.out.tsv_edit_distance >> 'star_salmon/umitools' + UMITOOLS_DEDUP.out.tsv_per_umi >> 'star_salmon/umitools' + UMITOOLS_DEDUP.out.tsv_umi_per_position >> 'star_salmon/umitools' + SAMTOOLS_INDEX.out.bai >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + BAM_STATS_SAMTOOLS.out >> 'star_salmon/samtools_stats' + BAM_STATS_SAMTOOLS.out.versions >> null } diff --git a/subworkflows/nf-core/bam_markduplicates_picard/main.nf b/subworkflows/nf-core/bam_markduplicates_picard/main.nf index de8130fb5..ca7bbe674 100644 --- a/subworkflows/nf-core/bam_markduplicates_picard/main.nf +++ b/subworkflows/nf-core/bam_markduplicates_picard/main.nf @@ -46,3 +46,21 @@ workflow BAM_MARKDUPLICATES_PICARD { versions = ch_versions // channel: [ versions.yml ] } + +workflow { + main: + def ch_bam = Channel.empty() + def ch_fasta = Channel.empty() + def ch_fai = Channel.empty() + + BAM_MARKDUPLICATES_PICARD( ch_bam, ch_fasta, ch_fai ) + + publish: + BAM_MARKDUPLICATES_PICARD.out.bam >> 'picard' + BAM_MARKDUPLICATES_PICARD.out.metrics >> 'picard/metrics' + BAM_MARKDUPLICATES_PICARD.out.bai >> 'picard' + BAM_MARKDUPLICATES_PICARD.out.csi >> 'picard' + BAM_MARKDUPLICATES_PICARD.out.stats >> 'picard/samtools_stats' + BAM_MARKDUPLICATES_PICARD.out.flagstat >> 'picard/samtools_stats' + BAM_MARKDUPLICATES_PICARD.out.idxstats >> 'picard/samtools_stats' +} diff --git a/subworkflows/nf-core/bam_markduplicates_picard/nextflow.config b/subworkflows/nf-core/bam_markduplicates_picard/nextflow.config index 2778db78d..f8f3061e7 100644 --- a/subworkflows/nf-core/bam_markduplicates_picard/nextflow.config +++ b/subworkflows/nf-core/bam_markduplicates_picard/nextflow.config @@ -4,37 +4,15 @@ if (!params.skip_alignment) { withName: '.*:BAM_MARKDUPLICATES_PICARD:PICARD_MARKDUPLICATES' { ext.args = '--ASSUME_SORTED true --REMOVE_DUPLICATES false --VALIDATION_STRINGENCY LENIENT --TMP_DIR tmp' ext.prefix = { "${meta.id}.markdup.sorted" } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/picard_metrics" }, - mode: params.publish_dir_mode, - pattern: '*metrics.txt' - ], - [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - pattern: '*.bam' - ] - ] } withName: '.*:BAM_MARKDUPLICATES_PICARD:SAMTOOLS_INDEX' { ext.args = { params.bam_csi_index ? '-c' : '' } ext.prefix = { "${meta.id}.markdup.sorted" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - pattern: '*.{bai,csi}' - ] } withName: '.*:BAM_MARKDUPLICATES_PICARD:BAM_STATS_SAMTOOLS:.*' { ext.prefix = { "${meta.id}.markdup.sorted.bam" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/samtools_stats" }, - mode: params.publish_dir_mode, - pattern: '*.{stats,flagstat,idxstats}' - ] } } } diff --git a/subworkflows/nf-core/bam_rseqc/main.nf b/subworkflows/nf-core/bam_rseqc/main.nf index 043321a13..de674f2a9 100644 --- a/subworkflows/nf-core/bam_rseqc/main.nf +++ b/subworkflows/nf-core/bam_rseqc/main.nf @@ -183,3 +183,35 @@ workflow BAM_RSEQC { versions // channel: [ versions.yml ] } + +workflow { + main: + def bam_bai = Channel.empty() + def bed = Channel.empty() + def rseqc_modules = Channel.empty() + BAM_RSEQC(bam_bai, bed, rseqc_modules) + + publish: + BAM_RSEQC.out.bamstat_txt >> 'rseqc/bam_stat' + BAM_RSEQC.out.inferexperiment_txt >> 'rseqc/infer_experiment' + BAM_RSEQC.out.junctionannotation_pdf >> 'rseqc/junction_annotation' + BAM_RSEQC.out.junctionannotation_events_pdf >> 'rseqc/junction_annotation' + BAM_RSEQC.out.junctionannotation_bed >> 'rseqc/junction_annotation' + BAM_RSEQC.out.junctionannotation_interact_bed >> 'rseqc/junction_annotation' + BAM_RSEQC.out.junctionannotation_xls >> 'rseqc/junction_annotation' + BAM_RSEQC.out.junctionannotation_log >> 'rseqc/junction_annotation' + BAM_RSEQC.out.junctionannotation_rscript >> 'rseqc/junction_annotation' + BAM_RSEQC.out.junctionsaturation_pdf >> 'rseqc/junction_saturation' + BAM_RSEQC.out.junctionsaturation_rscript >> 'rseqc/junction_saturation' + BAM_RSEQC.out.readduplication_pdf >> 'rseqc/read_duplication' + BAM_RSEQC.out.readduplication_seq_xls >> 'rseqc/read_duplication' + BAM_RSEQC.out.readduplication_pos_xls >> 'rseqc/read_duplication' + BAM_RSEQC.out.readduplication_rscript >> 'rseqc/read_duplication' + BAM_RSEQC.out.readdistribution_txt >> 'rseqc/read_distribution' + BAM_RSEQC.out.innerdistance_distance >> 'rseqc/inner_distance' + BAM_RSEQC.out.innerdistance_freq >> 'rseqc/inner_distance' + BAM_RSEQC.out.innerdistance_mean >> 'rseqc/inner_distance' + BAM_RSEQC.out.innerdistance_pdf >> 'rseqc/inner_distance' + BAM_RSEQC.out.innerdistance_rscript >> 'rseqc/inner_distance' + BAM_RSEQC.out.tin_txt >> 'rseqc/tin' +} diff --git a/subworkflows/nf-core/bam_rseqc/nextflow.config b/subworkflows/nf-core/bam_rseqc/nextflow.config deleted file mode 100644 index 4fabc8e99..000000000 --- a/subworkflows/nf-core/bam_rseqc/nextflow.config +++ /dev/null @@ -1,153 +0,0 @@ -def rseqc_modules = params.rseqc_modules ? params.rseqc_modules.split(',').collect{ it.trim().toLowerCase() } : [] - -if (!params.skip_alignment && !params.skip_qc && !params.skip_rseqc) { - if ('bam_stat' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_BAMSTAT' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/rseqc/bam_stat" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if ('infer_experiment' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_INFEREXPERIMENT' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/rseqc/infer_experiment" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if ('junction_annotation' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_JUNCTIONANNOTATION' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/pdf" }, - mode: params.publish_dir_mode, - pattern: '*.pdf' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/bed" }, - mode: params.publish_dir_mode, - pattern: '*.bed' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/xls" }, - mode: params.publish_dir_mode, - pattern: '*.xls' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/log" }, - mode: params.publish_dir_mode, - pattern: '*.log' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/rscript" }, - mode: params.publish_dir_mode, - pattern: '*.r' - ] - ] - } - } - } - - if ('junction_saturation' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_JUNCTIONSATURATION' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_saturation/pdf" }, - mode: params.publish_dir_mode, - pattern: '*.pdf' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_saturation/rscript" }, - mode: params.publish_dir_mode, - pattern: '*.r' - ] - ] - } - } - } - - if ('read_duplication' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_READDUPLICATION' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/pdf" }, - mode: params.publish_dir_mode, - pattern: '*.pdf' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/xls" }, - mode: params.publish_dir_mode, - pattern: '*.xls' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/rscript" }, - mode: params.publish_dir_mode, - pattern: '*.r' - ] - ] - } - } - } - - if ('read_distribution' in rseqc_modules && !params.bam_csi_index) { - process { - withName: '.*:BAM_RSEQC:RSEQC_READDISTRIBUTION' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/rseqc/read_distribution" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if ('inner_distance' in rseqc_modules && !params.bam_csi_index) { - process { - withName: '.*:BAM_RSEQC:RSEQC_INNERDISTANCE' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/txt" }, - mode: params.publish_dir_mode, - pattern: '*.txt', - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/pdf" }, - mode: params.publish_dir_mode, - pattern: '*.pdf' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/rscript" }, - mode: params.publish_dir_mode, - pattern: '*.r' - ] - ] - } - } - } - - if ('tin' in rseqc_modules && !params.bam_csi_index) { - process { - withName: '.*:BAM_RSEQC:RSEQC_TIN' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/rseqc/tin" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } -} diff --git a/subworkflows/nf-core/bedgraph_bedclip_bedgraphtobigwig/main.nf b/subworkflows/nf-core/bedgraph_bedclip_bedgraphtobigwig/main.nf index 6c3b7b0cb..688db1f6b 100644 --- a/subworkflows/nf-core/bedgraph_bedclip_bedgraphtobigwig/main.nf +++ b/subworkflows/nf-core/bedgraph_bedclip_bedgraphtobigwig/main.nf @@ -32,3 +32,13 @@ workflow BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG { versions = ch_versions // channel: [ versions.yml ] } + +workflow { + main: + def bedgraph = Channel.empty() + def sizes = Channel.empty() + BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG(bedgraph, sizes) + + publish: + BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG.out.bigwig >> 'bigwig' +} diff --git a/subworkflows/nf-core/fastq_align_hisat2/main.nf b/subworkflows/nf-core/fastq_align_hisat2/main.nf index a2ec1cf5e..554be9432 100644 --- a/subworkflows/nf-core/fastq_align_hisat2/main.nf +++ b/subworkflows/nf-core/fastq_align_hisat2/main.nf @@ -40,5 +40,10 @@ workflow FASTQ_ALIGN_HISAT2 { idxstats = BAM_SORT_STATS_SAMTOOLS.out.idxstats // channel: [ val(meta), [ idxstats ] ] versions = ch_versions // channel: [ versions.yml ] + + publish: + HISAT2_ALIGN.out.bam >> (params.save_align_intermeds ? 'hisat2' : null) + HISAT2_ALIGN.out.summary >> 'hisat2/log' + HISAT2_ALIGN.out.fastq >> (params.save_unaligned ? 'hisat2/unmapped' : null) } diff --git a/subworkflows/nf-core/fastq_align_hisat2/nextflow.config b/subworkflows/nf-core/fastq_align_hisat2/nextflow.config index 0f6d1abdc..f358884a5 100644 --- a/subworkflows/nf-core/fastq_align_hisat2/nextflow.config +++ b/subworkflows/nf-core/fastq_align_hisat2/nextflow.config @@ -2,25 +2,6 @@ if (!params.skip_alignment && params.aligner == 'hisat2') { process { withName: '.*:FASTQ_ALIGN_HISAT2:HISAT2_ALIGN' { ext.args = '--met-stderr --new-summary --dta' - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/log" }, - mode: params.publish_dir_mode, - pattern: '*.log' - ], - [ - path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds ? it : null } - ], - [ - path: { params.save_unaligned ? "${params.outdir}/${params.aligner}/unmapped" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.fastq.gz', - saveAs: { params.save_unaligned ? it : null } - ] - ] } } } diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf index 764ce013f..966bdaa6a 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf @@ -154,4 +154,17 @@ workflow FASTQ_FASTQC_UMITOOLS_FASTP { fastqc_trim_zip // channel: [ val(meta), [ zip ] ] versions = ch_versions.ifEmpty(null) // channel: [ versions.yml ] + + publish: + // TODO: need to recover trim_reads and umi_reads + // trim_reads >> (params.save_trimmed ? 'fastp/intermeds' : null) + // umi_reads >> (params.save_umi_intermeds ? 'umitools' : null) + umi_log >> 'umitools' + trim_json >> 'fastp' + trim_html >> 'fastp' + trim_log >> 'fastp/log' + trim_reads_fail >> (params.save_trimmed ? 'fastp/intermeds' : null) + trim_reads_merged >> (params.save_trimmed ? 'fastp/intermeds' : null) + fastqc_trim_html >> 'fastp/fastqc' + fastqc_trim_zip >> 'fastp/fastqc' } diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config index 061689d5f..e17897297 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config @@ -7,11 +7,6 @@ if (!(params.skip_fastqc || params.skip_qc)) { withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTQC_TRIM' { ext.args = '--quiet' - publishDir = [ - path: { "${params.outdir}/${params.trimmer}/fastqc" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } } } @@ -22,24 +17,6 @@ if (!params.skip_trimming) { process { withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTP' { ext.args = { params.extra_fastp_args ?: '' } - publishDir = [ - [ - path: { "${params.outdir}/${params.trimmer}" }, - mode: params.publish_dir_mode, - pattern: "*.{json,html}" - ], - [ - path: { "${params.outdir}/${params.trimmer}/log" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ], - [ - path: { params.save_trimmed ? "${params.outdir}/${params.trimmer}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fastq.gz", - saveAs: { params.save_trimmed ? it : null } - ] - ] } } } @@ -54,19 +31,6 @@ if (params.with_umi && !params.skip_umi_extract) { params.umitools_bc_pattern2 ? "--bc-pattern2='${params.umitools_bc_pattern2}'" : '', params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' ].join(' ').trim() } - publishDir = [ - [ - path: { "${params.outdir}/umitools" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ], - [ - path: { params.save_umi_intermeds ? "${params.outdir}/umitools" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fastq.gz", - saveAs: { params.save_umi_intermeds ? it : null } - ] - ] } } } diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/main.nf b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/main.nf index db2e5b329..fc257f969 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/main.nf +++ b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/main.nf @@ -120,4 +120,13 @@ workflow FASTQ_FASTQC_UMITOOLS_TRIMGALORE { trim_read_count // channel: [ val(meta), val(count) ] versions = ch_versions.ifEmpty(null) // channel: [ versions.yml ] + + publish: + // TODO: need to recover trim_reads and umi_reads + // trim_reads >> (params.save_trimmed ? 'trimgalore' : null) + // umi_reads >> (params.save_umi_intermeds ? 'umitools' : null) + umi_log >> 'umitools' + trim_html >> 'trimgalore/fastqc' + trim_zip >> 'trimgalore/fastqc' + trim_log >> 'trimgalore' } diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config index 7279111e5..48181b085 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config +++ b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config @@ -18,24 +18,6 @@ if (!params.skip_trimming) { params.extra_trimgalore_args ? params.extra_trimgalore_args.split("\\s(?=--)") : '' ].flatten().unique(false).join(' ').trim() } - publishDir = [ - [ - path: { "${params.outdir}/${params.trimmer}/fastqc" }, - mode: params.publish_dir_mode, - pattern: "*.{html,zip}" - ], - [ - path: { params.save_trimmed ? "${params.outdir}/${params.trimmer}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fq.gz", - saveAs: { params.save_trimmed ? it : null } - ], - [ - path: { "${params.outdir}/${params.trimmer}" }, - mode: params.publish_dir_mode, - pattern: "*.txt" - ] - ] } } } @@ -50,19 +32,6 @@ if (params.with_umi && !params.skip_umi_extract) { params.umitools_bc_pattern2 ? "--bc-pattern2='${params.umitools_bc_pattern2}'" : '', params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' ].join(' ').trim() } - publishDir = [ - [ - path: { "${params.outdir}/umitools" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ], - [ - path: { params.save_umi_intermeds ? "${params.outdir}/umitools" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fastq.gz", - saveAs: { params.save_umi_intermeds ? it : null } - ] - ] } } } diff --git a/subworkflows/nf-core/fastq_subsample_fq_salmon/nextflow.config b/subworkflows/nf-core/fastq_subsample_fq_salmon/nextflow.config index 36a8c5d7a..685b68bd5 100644 --- a/subworkflows/nf-core/fastq_subsample_fq_salmon/nextflow.config +++ b/subworkflows/nf-core/fastq_subsample_fq_salmon/nextflow.config @@ -2,15 +2,9 @@ process { withName: '.*:FASTQ_SUBSAMPLE_FQ_SALMON:FQ_SUBSAMPLE' { ext.args = '--record-count 1000000 --seed 1' ext.prefix = { "${meta.id}.subsampled" } - publishDir = [ - enabled: false - ] } withName: '.*:FASTQ_SUBSAMPLE_FQ_SALMON:SALMON_QUANT' { ext.args = '--skipQuant' - publishDir = [ - enabled: false - ] } } diff --git a/workflows/rnaseq/main.nf b/workflows/rnaseq/main.nf index 5c7c2b964..6a80cc6d0 100755 --- a/workflows/rnaseq/main.nf +++ b/workflows/rnaseq/main.nf @@ -785,6 +785,105 @@ workflow RNASEQ { emit: multiqc_report = ch_multiqc_report // channel: /path/to/multiqc_report.html versions = ch_versions // channel: [ path(versions.yml) ] + + publish: + QUANTIFY_STAR_SALMON.out >> 'star_salmon' + QUANTIFY_STAR_SALMON.out.multiqc >> null + QUANTIFY_STAR_SALMON.out.merged_counts_transcript >> null + QUANTIFY_STAR_SALMON.out.merged_tpm_transcript >> null + QUANTIFY_STAR_SALMON.out.versions >> null + + // TODO: !params.skip_alignment && params.aligner == 'star_salmon' && params.with_umi + // BAM_SORT_STATS_SAMTOOLS.out.bam >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + // BAM_SORT_STATS_SAMTOOLS.out.bai >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + // BAM_SORT_STATS_SAMTOOLS.out.stats >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon/samtools_stats' : null) + // BAM_SORT_STATS_SAMTOOLS.out.flagstat >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon/samtools_stats' : null) + // BAM_SORT_STATS_SAMTOOLS.out.idxstats >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon/samtools_stats' : null) + // SAMTOOLS_SORT.out.bam >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + // UMITOOLS_PREPAREFORSALMON.out.bam >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon' : null) + // UMITOOLS_PREPAREFORSALMON.out.log >> (params.save_align_intermeds || params.save_umi_intermeds ? 'star_salmon/umitools/log' : null) + + // TODO: !params.skip_alignment && params.aligner == 'star_salmon' + DESEQ2_QC_STAR_SALMON.out >> 'star_salmon/deseq2_qc' + DESEQ2_QC_STAR_SALMON.out.pca_multiqc >> null + DESEQ2_QC_STAR_SALMON.out.dists_multiqc >> null + DESEQ2_QC_STAR_SALMON.out.versions >> null + + // TODO: !params.skip_alignment && params.aligner == 'star_rsem' + // DESEQ2_QC_RSEM.out >> 'star_rsem/deseq2_qc' + // DESEQ2_QC_RSEM.out.pca_multiqc >> null + // DESEQ2_QC_RSEM.out.dists_multiqc >> null + // DESEQ2_QC_RSEM.out.versions >> null + + QUANTIFY_PSEUDO_ALIGNMENT.out >> params.pseudo_aligner + QUANTIFY_PSEUDO_ALIGNMENT.out.results >> null + QUANTIFY_PSEUDO_ALIGNMENT.out.multiqc >> null + QUANTIFY_PSEUDO_ALIGNMENT.out.merged_counts_transcript >> null + QUANTIFY_PSEUDO_ALIGNMENT.out.merged_tpm_transcript >> null + QUANTIFY_PSEUDO_ALIGNMENT.out.versions >> null + // TODO: process 'QUANTIFY_PSEUDO_ALIGNMENT:CUSTOM_TX2GENE' + + DESEQ2_QC_PSEUDO.out >> "${params.pseudo_aligner}/deseq2_qc" + DESEQ2_QC_PSEUDO.out.pca_multiqc >> null + DESEQ2_QC_PSEUDO.out.dists_multiqc >> null + DESEQ2_QC_PSEUDO.out.versions >> null + + BBMAP_BBSPLIT.out.stats >> 'bbsplit' + BBMAP_BBSPLIT.out.all_fastq >> (params.save_bbsplit_reads ? 'bbsplit' : null) + CAT_FASTQ.out.reads >> (params.save_merged_fastq ? 'fastq' : null) + + // TODO: params.remove_ribo_rna + // SORTMERNA.out.reads >> (params.save_non_ribo_reads ? 'sortmerna' : null) + + BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_FORWARD.out.bigwig >> "${params.aligner}/bigwig" + BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_REVERSE.out.bigwig >> "${params.aligner}/bigwig" + DUPRADAR.out.pdf >> "${params.aligner}/dupradar" + DUPRADAR.out.txt >> "${params.aligner}/dupradar" + MULTIQC.out.report >> (params.skip_alignment ? 'multiqc' : "multiqc/${params.aligner}") + MULTIQC.out.data >> (params.skip_alignment ? 'multiqc' : "multiqc/${params.aligner}") + MULTIQC.out.plots >> (params.skip_alignment ? 'multiqc' : "multiqc/${params.aligner}") + + // TODO: !params.skip_alignment && !params.skip_qc && !params.skip_preseq + // PRESEQ_LCEXTRAP.out.lc_extrap >> "${params.aligner}/preseq" + // PRESEQ_LCEXTRAP.out.log >> "${params.aligner}/preseq/log" + + QUALIMAP_RNASEQ.out.results >> "${params.aligner}/qualimap" + STRINGTIE_STRINGTIE.out >> "${params.aligner}/stringtie" + STRINGTIE_STRINGTIE.out.versions >> null + MULTIQC_CUSTOM_BIOTYPE.out.tsv >> "${params.aligner}/featurecounts" + SUBREAD_FEATURECOUNTS.out >> "${params.aligner}/featurecounts" + SUBREAD_FEATURECOUNTS.out.versions >> null + + BAM_MARKDUPLICATES_PICARD.out.bam >> "${params.aligner}" + BAM_MARKDUPLICATES_PICARD.out.bai >> "${params.aligner}" + BAM_MARKDUPLICATES_PICARD.out.csi >> "${params.aligner}" + BAM_MARKDUPLICATES_PICARD.out.metrics >> "${params.aligner}/picard_metrics" + BAM_MARKDUPLICATES_PICARD.out.stats >> "${params.aligner}/samtools_stats" + BAM_MARKDUPLICATES_PICARD.out.flagstat >> "${params.aligner}/samtools_stats" + BAM_MARKDUPLICATES_PICARD.out.idxstats >> "${params.aligner}/samtools_stats" + + BAM_RSEQC.out.bamstat_txt >> "${params.aligner}/rseqc/bam_stat" + BAM_RSEQC.out.inferexperiment_txt >> "${params.aligner}/rseqc/infer_experiment" + BAM_RSEQC.out.junctionannotation_pdf >> "${params.aligner}/rseqc/junction_annotation" + BAM_RSEQC.out.junctionannotation_events_pdf >> "${params.aligner}/rseqc/junction_annotation" + BAM_RSEQC.out.junctionannotation_bed >> "${params.aligner}/rseqc/junction_annotation" + BAM_RSEQC.out.junctionannotation_interact_bed >> "${params.aligner}/rseqc/junction_annotation" + BAM_RSEQC.out.junctionannotation_xls >> "${params.aligner}/rseqc/junction_annotation" + BAM_RSEQC.out.junctionannotation_log >> "${params.aligner}/rseqc/junction_annotation" + BAM_RSEQC.out.junctionannotation_rscript >> "${params.aligner}/rseqc/junction_annotation" + BAM_RSEQC.out.junctionsaturation_pdf >> "${params.aligner}/rseqc/junction_saturation" + BAM_RSEQC.out.junctionsaturation_rscript >> "${params.aligner}/rseqc/junction_saturation" + BAM_RSEQC.out.readduplication_pdf >> "${params.aligner}/rseqc/read_duplication" + BAM_RSEQC.out.readduplication_seq_xls >> "${params.aligner}/rseqc/read_duplication" + BAM_RSEQC.out.readduplication_pos_xls >> "${params.aligner}/rseqc/read_duplication" + BAM_RSEQC.out.readduplication_rscript >> "${params.aligner}/rseqc/read_duplication" + BAM_RSEQC.out.readdistribution_txt >> "${params.aligner}/rseqc/read_distribution" + BAM_RSEQC.out.innerdistance_distance >> "${params.aligner}/rseqc/inner_distance" + BAM_RSEQC.out.innerdistance_freq >> "${params.aligner}/rseqc/inner_distance" + BAM_RSEQC.out.innerdistance_mean >> "${params.aligner}/rseqc/inner_distance" + BAM_RSEQC.out.innerdistance_pdf >> "${params.aligner}/rseqc/inner_distance" + BAM_RSEQC.out.innerdistance_rscript >> "${params.aligner}/rseqc/inner_distance" + BAM_RSEQC.out.tin_txt >> "${params.aligner}/rseqc/tin" } /* diff --git a/workflows/rnaseq/nextflow.config b/workflows/rnaseq/nextflow.config index f988d3d7c..487c172b6 100644 --- a/workflows/rnaseq/nextflow.config +++ b/workflows/rnaseq/nextflow.config @@ -1,18 +1,13 @@ includeConfig "../../modules/local/bedtools_genomecov/nextflow.config" -includeConfig "../../modules/local/dupradar/nextflow.config" -includeConfig "../../modules/local/multiqc_custom_biotype/nextflow.config" includeConfig "../../modules/nf-core/bbmap/bbsplit/nextflow.config" -includeConfig "../../modules/nf-core/cat/fastq/nextflow.config" includeConfig "../../modules/nf-core/multiqc/nextflow.config" includeConfig "../../modules/nf-core/preseq/lcextrap/nextflow.config" -includeConfig "../../modules/nf-core/qualimap/rnaseq/nextflow.config" includeConfig "../../modules/nf-core/sortmerna/nextflow.config" includeConfig "../../modules/nf-core/stringtie/stringtie/nextflow.config" includeConfig "../../modules/nf-core/subread/featurecounts/nextflow.config" includeConfig "../../subworkflows/local/align_star/nextflow.config" includeConfig "../../subworkflows/local/quantify_rsem/nextflow.config" includeConfig "../../subworkflows/nf-core/bam_markduplicates_picard/nextflow.config" -includeConfig "../../subworkflows/nf-core/bam_rseqc/nextflow.config" includeConfig "../../subworkflows/nf-core/fastq_align_hisat2/nextflow.config" includeConfig "../../subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config" includeConfig "../../subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config" @@ -26,37 +21,12 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { process { withName: '.*:QUANTIFY_STAR_SALMON:SALMON_QUANT' { ext.args = { params.extra_salmon_quant_args ?: '' } - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_meta_info.json') ? null : filename } - ] } - - withName: '.*:QUANTIFY_STAR_SALMON:CUSTOM_TX2GENE' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - withName: '.*:QUANTIFY_STAR_SALMON:TXIMETA_TXIMPORT' { ext.prefix = { "${quant_type}.merged" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } - withName: '.*:QUANTIFY_STAR_SALMON:SE_.*' { ext.prefix = { "${params.pseudo_aligner}.merged" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('.log') ? null : filename } - ] } withName: '.*:QUANTIFY_STAR_SALMON:SE_GENE' { ext.prefix = { "${params.pseudo_aligner}.merged.gene_counts" } @@ -77,58 +47,18 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { withName: 'NFCORE_RNASEQ:RNASEQ:SAMTOOLS_SORT' { ext.args = '-n' ext.prefix = { "${meta.id}.umi_dedup.transcriptome" } - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] } withName: 'NFCORE_RNASEQ:RNASEQ:UMITOOLS_PREPAREFORSALMON' { ext.prefix = { "${meta.id}.umi_dedup.transcriptome.filtered" } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/umitools/log" }, - mode: params.publish_dir_mode, - pattern: '*.log' - ], - [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - ] } withName: 'NFCORE_RNASEQ:RNASEQ:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' { ext.prefix = { "${meta.id}.transcriptome.sorted" } - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - } - - withName: 'NFCORE_RNASEQ:RNASEQ:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX' { - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bai', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] } withName: 'NFCORE_RNASEQ:RNASEQ:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' { ext.prefix = { "${meta.id}.transcriptome.sorted.bam" } - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}/samtools_stats" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.{stats,flagstat,idxstats}', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] } withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:UMITOOLS_DEDUP' { @@ -138,37 +68,10 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' ].join(' ').trim() } ext.prefix = { "${meta.id}.umi_dedup.transcriptome.sorted" } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/umitools" }, - mode: params.publish_dir_mode, - pattern: '*.tsv' - ], - [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - ] - } - - withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:SAMTOOLS_INDEX' { - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bai', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] } withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:BAM_STATS_SAMTOOLS:.*' { ext.prefix = { "${meta.id}.umi_dedup.transcriptome.sorted.bam" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/samtools_stats" }, - mode: params.publish_dir_mode, - pattern: '*.{stats,flagstat,idxstats}' - ] } } } @@ -182,39 +85,14 @@ if (!params.skip_alignment) { process { withName: 'NFCORE_RNASEQ:RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' { ext.prefix = { "${meta.id}.sorted.bam" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/samtools_stats" }, - mode: params.publish_dir_mode, - pattern: "*.{stats,flagstat,idxstats}" - ] } withName: 'NFCORE_RNASEQ:RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' { ext.prefix = { "${meta.id}.sorted" } - publishDir = [ - path: { ( ['star_salmon','hisat2'].contains(params.aligner) && - ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) - ) || params.save_align_intermeds || params.skip_markduplicates ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.bam", - 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' : '' } - publishDir = [ - path: { ( ['star_salmon','hisat2'].contains(params.aligner) && - ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) - ) || params.save_align_intermeds || params.skip_markduplicates ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.{bai,csi}", - 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 } - ] } } @@ -227,39 +105,15 @@ if (!params.skip_alignment) { params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' ].join(' ').trim() } ext.prefix = { "${meta.id}.umi_dedup.sorted" } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/umitools" }, - mode: params.publish_dir_mode, - pattern: '*.tsv' - ], - [ - path: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - 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.prefix = { "${meta.id}.umi_dedup.sorted" } - publishDir = [ - path: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.{bai,csi}', - saveAs: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? it : null } - ] } withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_GENOME:BAM_STATS_SAMTOOLS:.*' { ext.prefix = { "${meta.id}.umi_dedup.sorted.bam" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/samtools_stats" }, - mode: params.publish_dir_mode, - pattern: '*.{stats,flagstat,idxstats}' - ] } } } @@ -273,34 +127,18 @@ if (!params.skip_alignment && !params.skip_bigwig) { process { withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_FORWARD:UCSC_BEDCLIP' { ext.prefix = { "${meta.id}.clip.forward" } - publishDir = [ - enabled: false - ] } withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_FORWARD:UCSC_BEDGRAPHTOBIGWIG' { ext.prefix = { "${meta.id}.forward" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/bigwig" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_REVERSE:UCSC_BEDCLIP' { ext.prefix = { "${meta.id}.clip.reverse" } - publishDir = [ - enabled: false - ] } withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_REVERSE:UCSC_BEDGRAPHTOBIGWIG' { ext.prefix = { "${meta.id}.reverse" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/bigwig" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } } } @@ -320,11 +158,6 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { params.deseq2_vst ? '--vst TRUE' : '' ].join(' ').trim() } ext.args2 = 'star_salmon' - publishDir = [ - path: { "${params.outdir}/${params.aligner}/deseq2_qc" }, - mode: params.publish_dir_mode, - pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" - ] } } } @@ -341,11 +174,6 @@ if (!params.skip_alignment && params.aligner == 'star_rsem') { params.deseq2_vst ? '--vst TRUE' : '' ].join(' ').trim() } ext.args2 = 'star_rsem' - publishDir = [ - path: { "${params.outdir}/${params.aligner}/deseq2_qc" }, - mode: params.publish_dir_mode, - pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" - ] } } } @@ -357,30 +185,12 @@ if (!params.skip_alignment && params.aligner == 'star_rsem') { if (!params.skip_pseudo_alignment && params.pseudo_aligner) { process { - withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:CUSTOM_TX2GENE' { - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:TXIMETA_TXIMPORT' { ext.prefix = { "${quant_type}.merged" } - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] } withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:SE_.*' { ext.args = '--assay_names counts,abundance' - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('.log') ? null : filename } - ] } withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:SE_GENE' { ext.prefix = { "${params.pseudo_aligner}.merged.gene_counts" } @@ -406,11 +216,6 @@ if (!params.skip_pseudo_alignment && params.pseudo_aligner) { params.deseq2_vst ? '--vst TRUE' : '' ].join(' ').trim() } ext.args2 = { params.pseudo_aligner } - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}/deseq2_qc" }, - mode: params.publish_dir_mode, - pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" - ] } } }