-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
132 lines (106 loc) · 2.56 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
132
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
params.reads = "$baseDir/00_fastq_raw/*.fq"
params.outdir = "$baseDir/results"
params.gentrome = "$baseDir/ref_fasta/gentrome.fa.gz"
params.decoys = "$baseDir/ref_fasta/decoys.txt"
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
gentrome : ${params.gentrome}
reads : ${params.reads}
outdir : ${params.outdir}
"""
process FASTQC {
tag "FASTQC on $sample_id"
conda 'bioconda::fastqc=0.12.1'
publishDir "$params.outdir/01_fastq_raw_FastQC/", mode:'copy'
cpus 2
input:
tuple val(sample_id), path(reads)
output:
path "fastqc_${sample_id}"
script:
"""
mkdir -p fastqc_${sample_id}
fastqc \\
-t ${task.cpus} \\
-o fastqc_${sample_id} \\
${reads}
"""
}
process INDEX {
tag "$gentrome.simpleName"
conda 'bioconda::salmon=1.10.2'
cpus 28
input:
path gentrome
path decoys
output:
path 'index'
script:
"""
salmon index \\
--threads $task.cpus \\
--gencode \\
-t $gentrome \\
-d $decoys \\
-i index
"""
}
process TRIMGALORE {
tag "TRIMGALORE on $sample_id"
conda "bioconda::trim-galore=0.6.10"
publishDir "$params.outdir/02_fastq_trimmed/", mode:'copy'
cpus 12
input:
tuple val(sample_id), path(reads)
output:
tuple val(sample_id), path("trimgalore_${sample_id}/${sample_id}_trimmed.fq")
script:
"""
trim_galore \\
--fastqc \\
--cores 8 \\
--output_dir trimgalore_${sample_id} \\
${reads}
"""
}
process QUANT {
tag "QUANT on $sample_id"
conda 'bioconda::salmon=1.10.2'
publishDir "$params.outdir/03_salmon_quant/", mode:'copy'
cpus 28
input:
path index
tuple val(sample_id), path(reads)
output:
path "quant_${sample_id}"
script:
"""
salmon quant \\
--threads $task.cpus \\
--libType A \\
-i $index \\
--validateMappings \\
--gcBias \\
--numGibbsSamples 20 \\
-r ${reads} \\
-o quant_${sample_id}
"""
}
workflow {
reads_ch = Channel
.fromPath(params.reads, checkIfExists: true)
.map{tuple(it.baseName, it)}
FASTQC(reads_ch)
INDEX(params.gentrome, params.decoys)
TRIMGALORE(reads_ch)
QUANT(INDEX.out, TRIMGALORE.out)
}
/*
* completion handler
*/
workflow.onComplete {
log.info ( workflow.success ? "\nSuccessfully completed!\n" : "\nOops .. something went wrong\n" )
}