4
4
* Proof of concept of a RNAseq pipeline implemented with Nextflow
5
5
*/
6
6
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
18
9
10
+ // enable static type checking
11
+ nextflow. preview. typeChecking = true
19
12
20
13
// import modules
21
14
include { RNASEQ } from ' ./modules/rnaseq'
15
+ include { FastqPair ; Sample } from ' ./modules/rnaseq'
22
16
include { MULTIQC } from ' ./modules/multiqc'
23
17
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
+
24
33
/*
25
- * main script flow
34
+ * Entry workflow
26
35
*/
27
36
workflow {
28
37
main :
29
38
log. info """ \
30
39
R N A S E Q - N F P I P E L I N E
31
40
===================================
41
+ reads : ${ params.reads*.id.join(',')}
32
42
transcriptome: ${ params.transcriptome}
33
- reads : ${ params.reads}
34
- outdir : ${ params.outdir}
43
+ outdir : ${ workflow.outputDir}
35
44
""" . stripIndent()
36
45
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 )
47
47
48
48
multiqc_files_ch = samples_ch
49
49
.flatMap { sample -> [sample. fastqc, sample. quant] }
50
50
.collect()
51
+
51
52
multiqc_report = MULTIQC ( multiqc_files_ch, params. multiqc )
52
53
53
54
publish :
55
+ index = index
54
56
samples = samples_ch
55
57
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
+ )
56
65
}
57
66
67
+ /*
68
+ * Pipeline outputs. By default they will be saved to the 'results' directory.
69
+ */
58
70
output {
59
- samples {
71
+ index : Path {
72
+ path ' .'
73
+ }
74
+
75
+ samples : Channel<Sample > {
60
76
path { sample ->
61
77
sample. fastqc >> " fastqc/${ sample.id} "
62
78
sample. quant >> " quant/${ sample.id} "
@@ -67,6 +83,7 @@ output {
67
83
}
68
84
}
69
85
70
- multiqc_report {
86
+ multiqc_report : Path {
87
+ path ' .'
71
88
}
72
89
}
0 commit comments