Skip to content
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
166 changes: 92 additions & 74 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
----------------------------------------------------------------------------------------
*/

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GENOME PARAMETER VALUES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
nextflow.preview.output = true

params.fasta = getGenomeAttribute('fasta')
params.additional_fasta = getGenomeAttribute('additional_fasta')
Expand All @@ -29,32 +25,25 @@ params.hisat2_index = getGenomeAttribute('hisat2')
params.salmon_index = getGenomeAttribute('salmon')
params.kallisto_index = getGenomeAttribute('kallisto')

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

include { RNASEQ } from './workflows/rnaseq'
include { PREPARE_GENOME } from './subworkflows/local/prepare_genome'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_rnaseq_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_rnaseq_pipeline'
include { checkMaxContigSize } from './subworkflows/local/utils_nfcore_rnaseq_pipeline'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NAMED WORKFLOWS FOR PIPELINE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

//
// WORKFLOW: Run main analysis pipeline
//
workflow NFCORE_RNASEQ {
workflow {

main:

ch_versions = Channel.empty()
//
// SUBWORKFLOW: Run initialisation tasks
//
PIPELINE_INITIALISATION (
params.version,
params.validate_params,
params.monochrome_logs,
args,
params.outdir
)

//
// SUBWORKFLOW: Prepare reference genome files
Expand Down Expand Up @@ -86,7 +75,6 @@ workflow NFCORE_RNASEQ {
params.skip_alignment,
params.skip_pseudo_alignment
)
ch_versions = ch_versions.mix(PREPARE_GENOME.out.versions)

// Check if contigs in genome fasta file > 512 Mbp
if (!params.skip_alignment && !params.bam_csi_index) {
Expand All @@ -96,13 +84,33 @@ workflow NFCORE_RNASEQ {
.map { checkMaxContigSize(it) }
}

ch_genome = Channel.empty().mix(
PREPARE_GENOME.out.fasta,
PREPARE_GENOME.out.gtf,
PREPARE_GENOME.out.gff,
PREPARE_GENOME.out.add_fasta,
PREPARE_GENOME.out.gene_bed,
PREPARE_GENOME.out.transcript_fasta,
PREPARE_GENOME.out.fai,
PREPARE_GENOME.out.chrom_sizes,
)

ch_genome_index = Channel.empty().mix(
PREPARE_GENOME.out.splicesites,
PREPARE_GENOME.out.bbsplit_index,
PREPARE_GENOME.out.star_index,
PREPARE_GENOME.out.rsem_index,
PREPARE_GENOME.out.hisat2_index,
PREPARE_GENOME.out.salmon_index,
PREPARE_GENOME.out.kallisto_index,
)

//
// WORKFLOW: Run nf-core/rnaseq workflow
//
ch_samplesheet = Channel.value(file(params.input, checkIfExists: true))
RNASEQ (
ch_samplesheet,
ch_versions,
PREPARE_GENOME.out.fasta,
PREPARE_GENOME.out.gtf,
PREPARE_GENOME.out.fai,
Expand All @@ -119,40 +127,6 @@ workflow NFCORE_RNASEQ {
PREPARE_GENOME.out.sortmerna_index,
PREPARE_GENOME.out.splicesites
)
ch_versions = ch_versions.mix(RNASEQ.out.versions)

emit:
trim_status = RNASEQ.out.trim_status // channel: [id, boolean]
map_status = RNASEQ.out.map_status // channel: [id, boolean]
strand_status = RNASEQ.out.strand_status // channel: [id, boolean]
multiqc_report = RNASEQ.out.multiqc_report // channel: /path/to/multiqc_report.html
versions = ch_versions // channel: [version1, version2, ...]
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

workflow {

main:
//
// SUBWORKFLOW: Run initialisation tasks
//
PIPELINE_INITIALISATION (
params.version,
params.validate_params,
params.monochrome_logs,
args,
params.outdir
)

//
// WORKFLOW: Run main workflow
//
NFCORE_RNASEQ ()

//
// SUBWORKFLOW: Run completion tasks
Expand All @@ -164,18 +138,68 @@ workflow {
params.outdir,
params.monochrome_logs,
params.hook_url,
NFCORE_RNASEQ.out.multiqc_report,
NFCORE_RNASEQ.out.trim_status,
NFCORE_RNASEQ.out.map_status,
NFCORE_RNASEQ.out.strand_status
RNASEQ.out.multiqc_report,
RNASEQ.out.trim_status,
RNASEQ.out.map_status,
RNASEQ.out.strand_status
)

publish:
genome = ch_genome
genome_index = ch_genome_index
star_salmon = RNASEQ.out.star_salmon
star_salmon_deseq_qc = RNASEQ.out.star_salmon_deseq_qc
star_rsem = RNASEQ.out.star_rsem
star_rsem_deseq_qc = RNASEQ.out.star_rsem_deseq_qc
hisat2 = RNASEQ.out.hisat2
multiqc_report = RNASEQ.out.multiqc_report
multiqc_data = RNASEQ.out.multiqc_data
multiqc_plots = RNASEQ.out.multiqc_plots
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
output {
genome {
enabled params.save_reference
path 'genome'
}

genome_index {
enabled params.save_reference
path 'genome/index'
}

star_salmon {
path 'star_salmon'
}

star_salmon_deseq_qc {
path 'star_salmon/deseq2_qc'
}

star_rsem {
path 'star_rsem'
}

star_rsem_deseq_qc {
path 'star_rsem/deseq2_qc'
}

hisat2 {
path 'hisat2'
}

multiqc_report {
path params.skip_alignment ? 'multiqc' : "multiqc/${params.aligner}"
}

multiqc_data {
path params.skip_alignment ? 'multiqc' : "multiqc/${params.aligner}"
}

multiqc_plots {
path params.skip_alignment ? 'multiqc' : "multiqc/${params.aligner}"
}
}

//
// Get attribute from genome config file e.g. fasta
Expand All @@ -189,9 +213,3 @@ def getGenomeAttribute(attribute) {
}
return null
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
13 changes: 2 additions & 11 deletions modules/nf-core/multiqc/main.nf

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

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.

9 changes: 2 additions & 7 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,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
6 changes: 0 additions & 6 deletions subworkflows/local/align_star/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ workflow ALIGN_STAR {

main:

ch_versions = Channel.empty()

//
// Map reads with STAR
//
Expand All @@ -42,7 +40,6 @@ workflow ALIGN_STAR {
ch_bam_transcript = STAR_ALIGN_IGENOMES.out.bam_transcript
ch_fastq = STAR_ALIGN_IGENOMES.out.fastq
ch_tab = STAR_ALIGN_IGENOMES.out.tab
ch_versions = ch_versions.mix(STAR_ALIGN_IGENOMES.out.versions.first())
} else {
STAR_ALIGN ( reads, index, gtf, star_ignore_sjdbgtf, seq_platform, seq_center )
ch_orig_bam = STAR_ALIGN.out.bam
Expand All @@ -53,14 +50,12 @@ workflow ALIGN_STAR {
ch_bam_transcript = STAR_ALIGN.out.bam_transcript
ch_fastq = STAR_ALIGN.out.fastq
ch_tab = STAR_ALIGN.out.tab
ch_versions = ch_versions.mix(STAR_ALIGN.out.versions.first())
}

//
// Sort, index BAM file and run samtools stats, flagstat and idxstats
//
BAM_SORT_STATS_SAMTOOLS ( ch_orig_bam, fasta )
ch_versions = ch_versions.mix(BAM_SORT_STATS_SAMTOOLS.out.versions)

emit:
orig_bam = ch_orig_bam // channel: [ val(meta), bam ]
Expand All @@ -79,5 +74,4 @@ workflow ALIGN_STAR {
flagstat = BAM_SORT_STATS_SAMTOOLS.out.flagstat // channel: [ val(meta), [ flagstat ] ]
idxstats = BAM_SORT_STATS_SAMTOOLS.out.idxstats // channel: [ val(meta), [ idxstats ] ]

versions = ch_versions // channel: [ versions.yml ]
}
Loading
Loading