forked from dufeiyu/cle-gatewayseq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGatewayseqAnalysis.wdl
executable file
·333 lines (291 loc) · 8.86 KB
/
GatewayseqAnalysis.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
version 1.0
workflow GatewayseqAnalysis {
input {
String Name
String DragenCram
String DragenCramIndex
String DragenVcf
String DragenVcfIndex
String DragenSvVcf
String DragenSvVcfIndex
String refFasta
String ReferenceDict
String Vepcache
String CivicCachePath
String? VariantDB
String GWSeqRepo
String CoverageBed = GWSeqRepo + "/accessory_files/GWSeq.all.hg38.bed"
String CustomAnnotationVcf = GWSeqRepo + "/accessory_files/GWSeq.custom_annotations.vcf.gz"
String CustomAnnotationIndex = CustomAnnotationVcf + ".tbi"
String QcMetrics = GWSeqRepo + "/accessory_files/GWSeq.QCMetrics.json"
String HaplotectBed = GWSeqRepo + "/accessory_files/GWSeq.haplotect.bed"
String SVGeneList = GWSeqRepo + "/accessory_files/GWSeq.gene_fusions.txt"
# this is a static parameter. Shouldnt need to change
String CustomAnnotationParameters = "GWSEQ,vcf,exact,0,BLACKLIST"
String MakeReportPy = GWSeqRepo + "/scripts/make_gwseq_report.py"
String SubDir
String OutputDir
String Queue
String JobGroup
}
Int MinSVReads = 10
call run_civic {
input: CivicCachePath=CivicCachePath,
Vcf=DragenVcf,
VcfIndex=DragenVcfIndex,
Name=Name,
queue=Queue,
jobGroup=JobGroup
}
call run_vep {
input: Vcf=run_civic.vcf,
refFasta=refFasta,
Vepcache=Vepcache,
CustomAnnotationVcf=CustomAnnotationVcf,
CustomAnnotationIndex=CustomAnnotationIndex,
CustomAnnotationParameters=CustomAnnotationParameters,
Name=Name,
queue=Queue,
jobGroup=JobGroup
}
call filter_sv {
input: Vcf=DragenSvVcf,
VcfIndex=DragenSvVcfIndex,
Name=Name,
MinReads=MinSVReads,
queue=Queue,
jobGroup=JobGroup
}
call annotate_sv {
input: Vcf=filter_sv.vcf,
refFasta=refFasta,
Vepcache=Vepcache,
Name=Name,
queue=Queue,
jobGroup=JobGroup
}
call run_haplotect {
input: refFasta=refFasta,
refDict=ReferenceDict,
Cram=DragenCram,
CramIndex=DragenCramIndex,
Bed=HaplotectBed,
Name=Name,
queue=Queue,
jobGroup=JobGroup
}
call gather_files {
input: OutputFiles=[run_haplotect.out_file,
run_haplotect.sites_file,
run_vep.vcf,
run_vep.index,
annotate_sv.vcf,
annotate_sv.index],
OutputDir=OutputDir,
SubDir=SubDir,
queue=Queue,
jobGroup=JobGroup
}
call make_report {
input: order_by=gather_files.done,
Name=Name,
VariantDB=VariantDB,
MakeReportPy=MakeReportPy,
OutputDir=OutputDir,
SubDir=SubDir,
queue=Queue,
jobGroup=JobGroup
}
output {
String all_done = make_report.done
}
}
task run_civic {
input {
File Vcf
File VcfIndex
String CivicCachePath
String Name
String jobGroup
String queue
}
command {
export CIVICPY_CACHE_FILE=${CivicCachePath} && \
/usr/local/bin/civicpy annotate-vcf --input-vcf ${Vcf} --output-vcf ${Name}.civic.vcf.gz --reference GRCh38 -i accepted
}
runtime {
docker_image: "docker1(griffithlab/civicpy:3.0.0)"
cpu: "1"
memory: "10 G"
queue: queue
job_group: jobGroup
}
output {
File vcf = "${Name}.civic.vcf.gz"
}
}
task run_vep {
input {
File Vcf
String refFasta
String Vepcache
String CustomAnnotationVcf
String CustomAnnotationIndex
String CustomAnnotationParameters
Float? maxAF
String Name
String jobGroup
String queue
}
command {
/usr/local/bin/tabix -p vcf ${Vcf} && \
/usr/bin/perl -I /opt/vep/lib/perl/VEP/Plugins /opt/vep/src/ensembl-vep/vep --format vcf \
--vcf --plugin Downstream --fasta ${refFasta} --hgvs --symbol --term SO --flag_pick \
-i ${Vcf} --custom ${CustomAnnotationVcf},${CustomAnnotationParameters} --offline --cache --max_af --dir ${Vepcache} -o ${Name}.annotated.vcf && \
/usr/local/bin/bgzip ${Name}.annotated.vcf && /usr/local/bin/tabix -p vcf ${Name}.annotated.vcf.gz
}
runtime {
docker_image: "docker1(registry.gsc.wustl.edu/mgi-cle/vep105-htslib1.9:1)"
cpu: "1"
memory: "10 G"
queue: queue
job_group: jobGroup
}
output {
File vcf = "${Name}.annotated.vcf.gz"
File index = "${Name}.annotated.vcf.gz.tbi"
}
}
task filter_sv {
input {
File Vcf
File VcfIndex
String Name
Int MinReads
String jobGroup
String queue
}
command {
bcftools view -i 'FMT/SR[0:1]>=${MinReads}' -Oz -o ${Name}.sv.filtered.vcf.gz ${Vcf} && \
tabix -p vcf ${Name}.sv.filtered.vcf.gz
}
runtime {
docker_image: "docker1(ghcr.io/dhslab/docker-baseimage:latest)"
cpu: "1"
memory: "10 G"
queue: queue
job_group: jobGroup
}
output {
File vcf = "${Name}.sv.filtered.vcf.gz"
File index = "${Name}.sv.filtered.vcf.gz.tbi"
}
}
task annotate_sv {
input {
String Vcf
String Name
String refFasta
String Vepcache
String jobGroup
String queue
}
command {
/usr/bin/perl -I /opt/vep/lib/perl/VEP/Plugins /opt/vep/src/ensembl-vep/vep --format vcf --vcf --fasta ${refFasta} \
--flag_pick --symbol --term SO -o ${Name}.sv_annotated.vcf -i ${Vcf} --offline --cache --dir ${Vepcache} && \
/usr/local/bin/bgzip ${Name}.sv_annotated.vcf && /usr/local/bin/tabix -p vcf ${Name}.sv_annotated.vcf.gz
}
runtime {
docker_image: "docker1(registry.gsc.wustl.edu/mgi-cle/vep105-htslib1.9:1)"
cpu: "1"
memory: "10 G"
queue: queue
job_group: jobGroup
}
output {
File vcf = "${Name}.sv_annotated.vcf.gz"
File index = "${Name}.sv_annotated.vcf.gz.tbi"
}
}
task run_haplotect {
input {
String Cram
String CramIndex
String Bed
String Name
String refDict
String refFasta
String queue
String jobGroup
Int? MinReads
}
command <<<
/usr/bin/awk -v OFS="\t" '{ $2=$2-1; print; }' ~{Bed} > /tmp/pos.bed && \
/usr/local/openjdk-8/bin/java -Xmx6g \
-jar /opt/hall-lab/gatk-package-4.1.8.1-18-ge2f02f1-SNAPSHOT-local.jar Haplotect \
-I ~{Cram} -R ~{refFasta} --sequence-dictionary ~{refDict} \
-mmq 20 -mbq 20 -max-depth-per-sample 10000 -gstol 0.001 -mr ~{default=10 MinReads} \
-htp ~{Bed} -L /tmp/pos.bed -outPrefix ~{Name}
>>>
runtime {
docker_image: "docker1(registry.gsc.wustl.edu/mgi-cle/haplotect:0.3)"
cpu: "1"
memory: "8 G"
queue: queue
job_group: jobGroup
}
output {
File out_file = "${Name}.haplotect.txt"
File sites_file = "${Name}.haplotectloci.txt"
}
}
task gather_files {
input {
Array[String] OutputFiles
String OutputDir
String? SubDir
String jobGroup
String queue
}
command {
if [[ ${SubDir} != "" ]] && [[ ! -e ${OutputDir}/${SubDir} ]]; then
mkdir ${OutputDir}/${SubDir}
fi
/bin/mv -f -t ${OutputDir}/${SubDir} ${sep=" " OutputFiles}
}
runtime {
docker_image: "docker1(registry.gsc.wustl.edu/genome/lims-compute-xenial:1)"
queue: queue
job_group: jobGroup
}
output {
String done = stdout()
}
}
task make_report {
input {
String order_by
String Name
String? VariantDB
String MakeReportPy
String OutputDir
String SubDir
String queue
String jobGroup
}
String SampleOutDir = OutputDir + "/" + SubDir
command {
/usr/bin/python3 ${MakeReportPy} -n ${Name} -d ${SampleOutDir} ${'--variantdb ' + VariantDB} && \
/bin/mv ./*.report.txt ./*.report.json ${SampleOutDir}
}
runtime {
docker_image: "docker1(registry.gsc.wustl.edu/mgi-cle/myeloseqhd:v2)"
cpu: "1"
memory: "16 G"
queue: queue
job_group: jobGroup
}
output {
String done = stdout()
}
}