Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow output definition #1227

Draft
wants to merge 17 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

nextflow.enable.dsl = 2
nextflow.preview.output = true

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
3 changes: 0 additions & 3 deletions modules/local/bedtools_genomecov/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ if (!params.skip_alignment && !params.skip_bigwig) {
process {
withName: 'BEDTOOLS_GENOMECOV' {
ext.args = '-split -du'
publishDir = [
enabled: false
]
}
}
}
35 changes: 0 additions & 35 deletions modules/local/dupradar/nextflow.config

This file was deleted.

13 changes: 0 additions & 13 deletions modules/local/multiqc_custom_biotype/nextflow.config

This file was deleted.

13 changes: 0 additions & 13 deletions modules/nf-core/bbmap/bbsplit/nextflow.config

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions modules/nf-core/cat/fastq/nextflow.config

This file was deleted.

8 changes: 0 additions & 8 deletions modules/nf-core/multiqc/nextflow.config

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions modules/nf-core/preseq/lcextrap/nextflow.config

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions modules/nf-core/qualimap/rnaseq/nextflow.config

This file was deleted.

13 changes: 0 additions & 13 deletions modules/nf-core/sortmerna/nextflow.config

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions modules/nf-core/stringtie/stringtie/nextflow.config

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions modules/nf-core/subread/featurecounts/nextflow.config

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 10 additions & 0 deletions subworkflows/local/align_star/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
19 changes: 0 additions & 19 deletions subworkflows/local/align_star/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
]
]
}
}
}
29 changes: 29 additions & 0 deletions subworkflows/local/prepare_genome/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Comment on lines +371 to +373
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's one way to shorten the publish section -- gather related channels for each publish target in the main body

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was going to suggest this for align_star, quantify_rsem etc, think that's the right thing to do.

But it does feel a bit like we're doing something publishing-specific in the main body of the workflow.

Could we do like:

    publish:
        Channel.empty().mix(
            ch_splicesites,
            ch_bbsplit_index,
            ch_star_index,
            ch_rsem_index,
            ch_hisat2_index,
            ch_salmon_index,
            ch_kallisto_index,
        ) >>  (params.save_reference ? 'genome/index' : null)

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that also works

}
Loading