forked from nextflow-io/rnaseq-nf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
executable file
·131 lines (100 loc) · 3.16 KB
/
main.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
* Copyright (c) 2013-2018, Centre for Genomic Regulation (CRG) and the authors.
*
* This file is part of 'RNASEQ-NF'.
*
* RNASEQ-NF is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RNASEQ-NF is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RNASEQ-NF. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Proof of concept of a RNAseq pipeline implemented with Nextflow
*
* Authors:
* - Paolo Di Tommaso <[email protected]>
* - Emilio Palumbo <[email protected]>
* - Evan Floden <[email protected]>
*/
/*
* Default pipeline parameters. They can be overriden on the command line eg.
* given `params.foo` specify on the run command line `--foo some_value`.
*/
params.reads = "$baseDir/data/ggal/*_{1,2}.fq"
params.transcriptome = "$baseDir/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"
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}
"""
transcriptome_file = file(params.transcriptome)
multiqc_file = file(params.multiqc)
Channel
.fromFilePairs( params.reads )
.ifEmpty { error "Cannot find any reads matching: ${params.reads}" }
.into { read_pairs_ch; read_pairs2_ch }
process index {
tag "$transcriptome_file.simpleName"
input:
file transcriptome from transcriptome_file
output:
file 'index' into index_ch
script:
"""
salmon index --threads $task.cpus -t $transcriptome -i index
"""
}
process quant {
tag "$pair_id"
input:
file index from index_ch
set pair_id, file(reads) from read_pairs_ch
output:
file(pair_id) into quant_ch
script:
"""
salmon quant --threads $task.cpus --libType=U -i $index -1 ${reads[0]} -2 ${reads[1]} -o $pair_id
"""
}
process fastqc {
tag "FASTQC on $sample_id"
publishDir params.outdir
input:
set sample_id, file(reads) from read_pairs2_ch
output:
file("fastqc_${sample_id}_logs") into fastqc_ch
script:
"""
mkdir fastqc_${sample_id}_logs
fastqc -o fastqc_${sample_id}_logs -f fastq -q ${reads}
"""
}
process multiqc {
publishDir params.outdir, mode:'copy'
input:
file('*') from quant_ch.mix(fastqc_ch).collect()
file(config) from multiqc_file
output:
file('multiqc_report.html')
script:
"""
cp $config/* .
echo "custom_logo: \$PWD/logo.png" >> multiqc_config.yaml
multiqc .
"""
}
workflow.onComplete {
println ( workflow.success ? "\nDone! Open the following report in your browser --> $params.outdir/multiqc_report.html\n" : "Oops .. something went wrong" )
}