-
Notifications
You must be signed in to change notification settings - Fork 20
/
Post_Merge_SV.wdl
263 lines (229 loc) · 7.67 KB
/
Post_Merge_SV.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
version 1.0
import "SV_Tasks.wdl" as SV
workflow Post_Merge_SV {
# data inputs
input {
Array[File] aligned_crams
Array[File] aligned_cram_indices
Array[File] cn_hist_roots
Array[File] manta_vcfs
String aligned_cram_suffix
File merged_vcf
String cohort_name
String final_vcf_name
# reference inputs
File ref_fasta
File ref_fasta_index
File ref_cache
File mei_annotation_bed
# system inputs
Int preemptible_tries
}
call SV.Split_By_Type {
input:
input_vcf = merged_vcf,
output_vcf_prefix = cohort_name + ".merged",
preemptible_tries = preemptible_tries
}
# Re-genotype and call copy number for each sample on the merged SV VCF
scatter (i in range(length(aligned_crams))) {
File aligned_cram = aligned_crams[i]
File aligned_cram_index = aligned_cram_indices[i]
File cn_hist_root = cn_hist_roots[i]
String basename = sub(sub(aligned_cram, "^.*/", ""), aligned_cram_suffix + "$", "")
call SV.Get_Sample_Name {
input:
input_cram = aligned_cram,
preemptible_tries = preemptible_tries
}
call SV.Get_Sex {
input:
input_cn_hist_root = cn_hist_root,
ref_fasta_index = ref_fasta_index,
preemptible_tries = preemptible_tries
}
call SV.Genotype as Genotype_Merged_BND {
input:
basename = basename + ".bnd",
input_cram = aligned_cram,
input_cram_index = aligned_cram_index,
input_vcf = Split_By_Type.bnd_vcf,
ref_cache = ref_cache,
preemptible_tries = preemptible_tries
}
call SV.Genotype as Genotype_Merged_DEL {
input:
basename = basename + ".del",
input_cram = aligned_cram,
input_cram_index = aligned_cram_index,
input_vcf = Split_By_Type.del_vcf,
ref_cache = ref_cache,
preemptible_tries = preemptible_tries
}
call SV.Take_Original_Genotypes as Genotype_Merged_INS {
input:
sample_name = Get_Sample_Name.sample,
original_per_sample_vcf = manta_vcfs[i],
basename = basename + ".ins",
input_vcf = Split_By_Type.ins_vcf,
input_variant_to_sname_mapping = Split_By_Type.ins_split,
preemptible_tries = preemptible_tries
}
call SV.Genotype as Genotype_Merged_OTHER {
input:
basename = basename + ".other",
input_cram = aligned_cram,
input_cram_index = aligned_cram_index,
input_vcf = Split_By_Type.other_vcf,
ref_cache = ref_cache,
preemptible_tries = preemptible_tries
}
call SV.Copy_Number as Copy_Number_DEL {
input:
basename = basename + ".del",
sample = Get_Sample_Name.sample,
input_vcf = Genotype_Merged_DEL.output_vcf,
input_cn_hist_root = cn_hist_root,
ref_cache = ref_cache,
preemptible_tries = preemptible_tries
}
call SV.Copy_Number as Copy_Number_OTHER {
input:
basename = basename + ".other",
sample = Get_Sample_Name.sample,
input_vcf = Genotype_Merged_OTHER.output_vcf,
input_cn_hist_root = cn_hist_root,
ref_cache = ref_cache,
preemptible_tries = preemptible_tries
}
}
call SV.Make_Pedigree_File {
input:
sample_array = Get_Sample_Name.sample,
sex_array = Get_Sex.sex,
output_ped_basename = cohort_name,
}
call SV.Paste_VCF as Paste_VCF_BND {
input:
input_vcfs = Genotype_Merged_BND.output_vcf,
output_vcf_basename = cohort_name + ".merged.gt.bnd",
preemptible_tries = preemptible_tries
}
call SV.Paste_VCF as Paste_VCF_DEL {
input:
input_vcfs = Copy_Number_DEL.output_vcf,
output_vcf_basename = cohort_name + ".merged.gt.cn.del",
preemptible_tries = preemptible_tries
}
call SV.Paste_VCF as Paste_VCF_INS {
input:
input_vcfs = Genotype_Merged_INS.output_vcf,
output_vcf_basename = cohort_name + ".merged.gt.ins",
preemptible_tries = preemptible_tries
}
call SV.Paste_VCF as Paste_VCF_OTHER {
input:
input_vcfs = Copy_Number_OTHER.output_vcf,
output_vcf_basename = cohort_name + ".merged.gt.cn.other",
preemptible_tries = preemptible_tries
}
call SV.Prune_VCF as Prune_VCF_BND{
input:
input_vcf_gz = Paste_VCF_BND.output_vcf_gz,
output_vcf_basename = cohort_name + ".merged.gt.pruned.bnd",
preemptible_tries = preemptible_tries
}
call SV.Prune_VCF as Prune_VCF_DEL{
input:
input_vcf_gz = Paste_VCF_DEL.output_vcf_gz,
output_vcf_basename = cohort_name + ".merged.gt.cn.pruned.del",
preemptible_tries = preemptible_tries
}
call SV.Prune_VCF as Prune_VCF_INS{
input:
input_vcf_gz = Paste_VCF_INS.output_vcf_gz,
output_vcf_basename = cohort_name + ".merged.gt.pruned.ins",
preemptible_tries = preemptible_tries
}
call SV.Prune_VCF as Prune_VCF_OTHER{
input:
input_vcf_gz = Paste_VCF_OTHER.output_vcf_gz,
output_vcf_basename = cohort_name + ".merged.gt.cn.pruned.other",
preemptible_tries = preemptible_tries
}
call SV.Classify as Classify_DEL{
input:
input_vcf_gz = Prune_VCF_DEL.output_vcf_gz,
input_ped = Make_Pedigree_File.output_ped,
mei_annotation_bed = mei_annotation_bed,
output_vcf_basename = cohort_name + ".merged.gt.cn.pruned.class.del",
preemptible_tries = preemptible_tries
}
call SV.Classify as Classify_OTHER{
input:
input_vcf_gz = Prune_VCF_OTHER.output_vcf_gz,
input_ped = Make_Pedigree_File.output_ped,
mei_annotation_bed = mei_annotation_bed,
output_vcf_basename = cohort_name + ".merged.gt.cn.pruned.class.other",
preemptible_tries = preemptible_tries
}
call SV.Sort_Index_VCF as Sort_Index_VCF_BND {
input:
input_vcf_gz = Prune_VCF_BND.output_vcf_gz,
output_vcf_name = final_vcf_name + ".bnd.vcf.gz",
preemptible_tries = preemptible_tries
}
call SV.Sort_Index_VCF as Sort_Index_VCF_DEL {
input:
input_vcf_gz = Classify_DEL.output_vcf_gz,
output_vcf_name = final_vcf_name + ".del.vcf.gz",
preemptible_tries = preemptible_tries
}
call SV.Sort_Index_VCF as Sort_Index_VCF_INS {
input:
input_vcf_gz = Prune_VCF_INS.output_vcf_gz,
output_vcf_name = final_vcf_name + ".ins.vcf.gz",
preemptible_tries = preemptible_tries
}
call SV.Sort_Index_VCF as Sort_Index_VCF_OTHER {
input:
input_vcf_gz = Classify_OTHER.output_vcf_gz,
output_vcf_name = final_vcf_name + ".other.vcf.gz",
preemptible_tries = preemptible_tries
}
call SV.Filter_Index as Filter_Index_BND {
input:
input_vcf_gz = Sort_Index_VCF_BND.output_vcf_gz,
output_vcf_name = final_vcf_name + ".bnd.vcf.gz",
preemptible_tries = preemptible_tries
}
call SV.Filter_Index as Filter_Index_DEL {
input:
input_vcf_gz = Sort_Index_VCF_DEL.output_vcf_gz,
output_vcf_name = final_vcf_name + ".del.vcf.gz",
preemptible_tries = preemptible_tries
}
call SV.Filter_Index as Filter_Index_INS {
input:
input_vcf_gz = Sort_Index_VCF_INS.output_vcf_gz,
output_vcf_name = final_vcf_name + ".ins.vcf.gz",
preemptible_tries = preemptible_tries
}
call SV.Filter_Index as Filter_Index_OTHER {
input:
input_vcf_gz = Sort_Index_VCF_OTHER.output_vcf_gz,
output_vcf_name = final_vcf_name + ".other.vcf.gz",
preemptible_tries = preemptible_tries
}
output {
File output_ped = Make_Pedigree_File.output_ped
File output_vcf_bnd = Filter_Index_BND.output_vcf_gz
File output_vcf_index_bnd = Filter_Index_BND.output_vcf_gz_index
File output_vcf_del = Filter_Index_DEL.output_vcf_gz
File output_vcf_ins = Filter_Index_INS.output_vcf_gz
File output_vcf_index_other = Filter_Index_OTHER.output_vcf_gz_index
File output_vcf_other = Filter_Index_OTHER.output_vcf_gz
File output_vcf_index_del = Filter_Index_DEL.output_vcf_gz_index
File output_vcf_index_ins = Filter_Index_INS.output_vcf_gz_index
}
}