diff --git a/main.nf b/main.nf index ab37c81..8ce4333 100755 --- a/main.nf +++ b/main.nf @@ -37,14 +37,6 @@ params.transcriptome = "$baseDir/data/ggal/ggal_1_48850000_49020000.Ggal71.500bp params.outdir = "results" params.multiqc = "$baseDir/multiqc" -log.info """\ - R N A S E Q - N F P I P E L I N E - =================================== - transcriptome: ${params.transcriptome} - reads : ${params.reads} - outdir : ${params.outdir} - """ - // import modules include { RNASEQ } from './modules/rnaseq' include { MULTIQC } from './modules/multiqc' @@ -53,17 +45,40 @@ include { MULTIQC } from './modules/multiqc' * main script flow */ workflow { - read_pairs_ch = channel.fromFilePairs( params.reads, checkIfExists: true ) + main: + log.info """\ + R N A S E Q - N F P I P E L I N E + =================================== + transcriptome: ${params.transcriptome} + reads : ${params.reads} + outdir : ${params.outdir} + """ + + read_pairs_ch = channel.fromFilePairs( params.reads, checkIfExists: true, flat: true ) RNASEQ( params.transcriptome, read_pairs_ch ) - MULTIQC( RNASEQ.out, params.multiqc ) + + samples_ch = RNASEQ.out.quant + | join(RNASEQ.out.fastqc) + + multiqc_ch = RNASEQ.out.quant + | concat(RNASEQ.out.fastqc) + | map { _id, file -> file } + | collect + MULTIQC( multiqc_ch, params.multiqc ) + + publish: + samples_ch >> 'samples' + MULTIQC.out >> 'multiqc' } output { - directory params.outdir - mode 'copy' - fastqc { + samples { + path '.' index { - path 'index.csv' + path 'index.json' + mapper { id, quant, fastqc -> + [id: id, quant: quant, fastqc: fastqc] + } } } } diff --git a/modules/fastqc/main.nf b/modules/fastqc/main.nf index d53d396..cb960be 100644 --- a/modules/fastqc/main.nf +++ b/modules/fastqc/main.nf @@ -1,19 +1,16 @@ process FASTQC { - tag "FASTQC on $sample_id" + tag "$sample_id" conda 'fastqc=0.12.1' input: - tuple val(sample_id), path(reads) + tuple val(sample_id), path(fastq_1), path(fastq_2) output: - path "fastqc_${sample_id}_logs", emit: logs - - publish: - logs >> 'fastqc' + tuple val(sample_id), path("fastqc_${sample_id}_logs"), emit: logs script: """ - fastqc.sh "$sample_id" "$reads" + fastqc.sh "$sample_id" "$fastq_1 $fastq_2" """ } diff --git a/modules/multiqc/main.nf b/modules/multiqc/main.nf index f7c0463..55f811d 100644 --- a/modules/multiqc/main.nf +++ b/modules/multiqc/main.nf @@ -9,9 +9,6 @@ process MULTIQC { output: path('multiqc_report.html'), emit: report - publish: - report >> 'multiqc' - script: """ cp $config/* . diff --git a/modules/quant/main.nf b/modules/quant/main.nf index 8459597..027f9d5 100644 --- a/modules/quant/main.nf +++ b/modules/quant/main.nf @@ -1,17 +1,17 @@ process QUANT { - tag "$pair_id" + tag "$sample_id" conda 'salmon=1.10.2' input: - path index - tuple val(pair_id), path(reads) + path index + tuple val(sample_id), path(fastq_1), path(fastq_2) output: - path pair_id + tuple val(sample_id), path(sample_id) script: """ - salmon quant --threads $task.cpus --libType=U -i $index -1 ${reads[0]} -2 ${reads[1]} -o $pair_id + salmon quant --threads $task.cpus --libType=U -i $index -1 ${fastq_1} -2 ${fastq_2} -o $sample_id """ } diff --git a/modules/rnaseq.nf b/modules/rnaseq.nf index b8f45df..6ccad42 100644 --- a/modules/rnaseq.nf +++ b/modules/rnaseq.nf @@ -8,12 +8,13 @@ workflow RNASEQ { take: transcriptome read_pairs_ch - - main: + + main: INDEX(transcriptome) FASTQC(read_pairs_ch) QUANT(INDEX.out, read_pairs_ch) - emit: - QUANT.out | concat(FASTQC.out) | collect + emit: + quant = QUANT.out + fastqc = FASTQC.out }