44 * Proof of concept of a RNAseq pipeline implemented with Nextflow
55 */
66
7- nextflow. preview. output = true
8-
9- /*
10- * Default pipeline parameters. They can be overriden on the command line eg.
11- * given `params.reads` specify on the run command line `--reads some_value`.
12- */
13-
14- params. reads = null
15- params. transcriptome = null
16- params. outdir = " results"
17- params. multiqc = " $projectDir /multiqc"
7+ // enable v2 operators (required for static type checking)
8+ nextflow. preview. operators = true
189
10+ // enable static type checking
11+ nextflow. preview. typeChecking = true
1912
2013// import modules
2114include { RNASEQ } from ' ./modules/rnaseq'
15+ include { FastqPair ; Sample } from ' ./modules/rnaseq'
2216include { MULTIQC } from ' ./modules/multiqc'
2317
18+ /*
19+ * Pipeline parameters. They can be overridden on the command line, e.g.
20+ * `params.reads` can be specified as `--reads '...'`.
21+ */
22+ params {
23+ // The input read-pair files
24+ reads : List<FastqPair >
25+
26+ // The input transcriptome file
27+ transcriptome : Path
28+
29+ // Directory containing multiqc configuration
30+ multiqc : Path = " ${ projectDir} /multiqc"
31+ }
32+
2433/*
25- * main script flow
34+ * Entry workflow
2635 */
2736workflow {
2837 main :
2938 log. info """ \
3039 R N A S E Q - N F P I P E L I N E
3140 ===================================
41+ reads : ${ params.reads*.id.join(',')}
3242 transcriptome: ${ params.transcriptome}
33- reads : ${ params.reads}
34- outdir : ${ params.outdir}
43+ outdir : ${ workflow.outputDir}
3544 """ . stripIndent()
3645
37- inputs_ch = channel. fromPath(params. reads)
38- .splitCsv()
39- .map { id, fastq_1, fastq_2 ->
40- tuple(id, file(fastq_1, checkIfExists : true ), file(fastq_2, checkIfExists : true ))
41- }
42-
43- samples_ch = RNASEQ ( params. transcriptome, inputs_ch )
44- .map { id, fastqc, quant ->
45- [id : id, fastqc : fastqc, quant : quant]
46- }
46+ (samples_ch, index) = RNASEQ ( channel. fromList(params. reads), params. transcriptome )
4747
4848 multiqc_files_ch = samples_ch
4949 .flatMap { sample -> [sample. fastqc, sample. quant] }
5050 .collect()
51+
5152 multiqc_report = MULTIQC ( multiqc_files_ch, params. multiqc )
5253
5354 publish :
55+ index = index
5456 samples = samples_ch
5557 multiqc_report = multiqc_report
58+
59+ onComplete :
60+ log. info(
61+ workflow. success
62+ ? " \n Done! Open the following report in your browser --> ${ workflow.outputDir} /multiqc_report.html\n "
63+ : " Oops .. something went wrong"
64+ )
5665}
5766
67+ /*
68+ * Pipeline outputs. By default they will be saved to the 'results' directory.
69+ */
5870output {
59- samples {
71+ index : Path {
72+ path ' .'
73+ }
74+
75+ samples : Channel<Sample > {
6076 path { sample ->
6177 sample. fastqc >> " fastqc/${ sample.id} "
6278 sample. quant >> " quant/${ sample.id} "
@@ -67,6 +83,7 @@ output {
6783 }
6884 }
6985
70- multiqc_report {
86+ multiqc_report : Path {
87+ path ' .'
7188 }
7289}
0 commit comments