-
Notifications
You must be signed in to change notification settings - Fork 6
/
ReadbasedAnalysisTasks.wdl
executable file
·197 lines (174 loc) · 4.44 KB
/
ReadbasedAnalysisTasks.wdl
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
version 1.0
task profilerGottcha2 {
input {
Array[File] READS
String DB
String PREFIX
String? RELABD_COL = "ROLLUP_DOC"
String DOCKER
Int? CPU = 4
}
command <<<
set -euo pipefail
. /opt/conda/etc/profile.d/conda.sh
conda activate gottcha2
gottcha2.py -r ~{RELABD_COL} \
-i ~{sep=' ' READS} \
-t ~{CPU} \
-o . \
-p ~{PREFIX} \
--database ~{DB}
grep "^species" ~{PREFIX}.tsv | ktImportTaxonomy -t 3 -m 9 -o ~{PREFIX}.krona.html - || true
gottcha2.py --version > ~{PREFIX}.info
>>>
output {
File report_tsv = "~{PREFIX}.tsv"
File full_tsv = "~{PREFIX}.full.tsv"
File krona_html = "~{PREFIX}.krona.html"
File info = "~{PREFIX}.info"
}
runtime {
docker: DOCKER
cpu: CPU
node: 1
nwpn: 1
memory: "45G"
time: "04:00:00"
}
meta {
author: "Po-E Li, B10, LANL"
email: "[email protected]"
}
}
task profilerCentrifuge {
input {
Array[File] READS
String DB
String PREFIX
Int? CPU = 4
String DOCKER
}
command <<<
set -euo pipefail
. /opt/conda/etc/profile.d/conda.sh
conda activate centrifuge
centrifuge -x ~{DB} \
-p ~{CPU} \
-U ~{sep=',' READS} \
-S ~{PREFIX}.classification.tsv \
--report-file ~{PREFIX}.report.tsv
ktImportTaxonomy -m 5 -t 2 -o ~{PREFIX}.krona.html ~{PREFIX}.report.tsv
centrifuge --version | head -1 | cut -d ' ' -f3 > ~{PREFIX}.info
>>>
output {
File classification_tsv="~{PREFIX}.classification.tsv"
File report_tsv="~{PREFIX}.report.tsv"
File krona_html="~{PREFIX}.krona.html"
File info = "~{PREFIX}.info"
}
runtime {
docker: DOCKER
cpu: CPU
node: 1
nwpn: 1
memory: "45G"
time: "04:00:00"
}
meta {
author: "Po-E Li, B10, LANL"
email: "[email protected]"
}
}
task profilerKraken2 {
input {
Array[File] READS
String DB
String PREFIX
Boolean? PAIRED = false
Int? CPU = 4
String DOCKER
}
command <<<
set -euo pipefail
. /opt/conda/etc/profile.d/conda.sh
conda activate kraken2
kraken2 ~{true="--paired" false='' PAIRED} \
--threads ~{CPU} \
--db ~{DB} \
--output ~{PREFIX}.classification.tsv \
--report ~{PREFIX}.report.tsv \
~{sep=' ' READS}
kraken2 --version | head -1 | cut -d ' ' -f3 > ~{PREFIX}.info
conda deactivate
ktImportTaxonomy -m 3 -t 5 -o ~{PREFIX}.krona.html ~{PREFIX}.report.tsv
>>>
output {
File classification_tsv = "~{PREFIX}.classification.tsv"
File report_tsv = "~{PREFIX}.report.tsv"
File krona_html = "~{PREFIX}.krona.html"
File info = "~{PREFIX}.info"
}
runtime {
docker: DOCKER
cpu: CPU
node: 1
nwpn: 1
memory: "45G"
time: "04:00:00"
}
meta {
author: "Po-E Li, B10, LANL"
email: "[email protected]"
}
}
task generateSummaryJson {
input {
Array[Map[String, String]?] TSV_META_JSON
String PREFIX
String DOCKER
}
command {
outputTsv2json.py --meta ~{write_json(TSV_META_JSON)} > ~{PREFIX}.json
}
output {
File summary_json = "~{PREFIX}.json"
}
runtime {
docker: DOCKER
node: 1
nwpn: 1
memory: "45G"
time: "04:00:00"
}
meta {
author: "Po-E Li, B10, LANL"
email: "[email protected]"
}
}
task stage {
input {
String container
String target="raw.fastq.gz"
String input_file
}
command <<<
set -oeu pipefail
if [ ~( echo ~{input_file}|egrep -c "https*:") -gt 0 ] ; then
wget ~{input_file} -O ~{target}
else
ln ~{input_file} ~{target} || cp ~{input_file} ~{target}
fi
# Capture the start time
date --iso-8601=seconds > start.txt
>>>
output {
File read = "~{target}"
String start = read_string("start.txt")
}
runtime {
memory: "1 GiB"
cpu: 2
maxRetries: 1
docker: container
}
}