forked from mobidic/MobiDL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpanelCaptureDuo.wdl
531 lines (522 loc) · 14 KB
/
panelCaptureDuo.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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
import "modules/preparePanelCaptureTmpDirs.wdl" as runPreparePanelCaptureTmpDirs
import "modules/fastqcDuo.wdl" as runFastqcDuo
import "modules/gatkBedToPicardIntervalList.wdl" as runGatkBedToPicardIntervalList
import "modules/gatkHaplotypeCallerDuo.wdl" as runGatkHaplotypeCallerDuo
import "modules/gatkGatherVcfs.wdl" as runGatkGatherVcfs
import "modules/qualimapBamQc.wdl" as runQualimapBamQc
import "modules/jvarkitVcfPolyX.wdl" as runJvarkitVcfPolyX
import "modules/gatkSplitVcfs.wdl" as runGatkSplitVcfs
import "modules/gatkVariantFiltrationSnp.wdl" as runGatkVariantFiltrationSnp
import "modules/gatkVariantFiltrationIndel.wdl" as runGatkVariantFiltrationIndel
import "modules/gatkMergeVcfs.wdl" as runGatkMergeVcfs
import "modules/gatkSortVcf.wdl" as runGatkSortVcf
import "modules/bcftoolsNorm.wdl" as runBcftoolsNorm
import "modules/compressIndexVcf.wdl" as runCompressIndexVcf
#import "modules/deepVariant.wdl" as runDeepVariant
import "modules/refcallFiltration.wdl" as runRefCallFiltration
import "modules/gatkHardFilteringVcf.wdl" as runGatkHardFilteringVcf
import "modules/bcftoolsStats.wdl" as runBcftoolsStats
# import "modules/gatkVariantEval.wdl" as runGatkVariantEval
# import "modules/gatkCombineVariants.wdl" as runGatkCombineVariants
# import "modules/rtgMergeVcfs.wdl" as runRtgMerge
# import "modules/fixVcfHeaders.wdl" as runFixVcfHeaders
#import "modules/crumble.wdl" as runCrumble
#import "modules/anacoreUtilsMergeVCFCallers.wdl" as runAnacoreUtilsMergeVCFCallers
import "modules/gatkUpdateVCFSequenceDictionary.wdl" as runGatkUpdateVCFSequenceDictionary
import "modules/cleanUpPanelCaptureDuoTmpDirs.wdl" as runCleanUpPanelCaptureDuoTmpDirs
import "modules/multiqc.wdl" as runMultiqc
import "modules/toolVersions.wdl" as runToolVersions
import "modules/alignement.wdl" as alignDNA
workflow panelCaptureDuo {
meta {
author: "Olivier Ardouin"
email: "o-ardouin(at)chu-montpellier.fr"
version: "0.0.2"
date: "2021-05-29"
}
# variables declarations
## Resources
Int cpuHigh
Int cpuLow
Int memoryLow
Int memoryHigh
# memoryLow = scattered tasks =~ mem_per_cpu in HPC or not
# memoryHigh = one cpu tasks => high mem ex 10Gb
## Global
String sampleID
String FatherSampleID
String suffix1
String suffix2
File fastqR1
File FatherFastqR1
File fastqR2
File FatherFastqR2
String genomeVersion
File refFasta
File refFai
File refDict
File intervalBedFile
String intervalBaitBed =""
File intervalBaitBedFile = if intervalBaitBed == "" then intervalBedFile else intervalBaitBed
String workflowType
String outDir
Boolean debug = false
## Bioinfo execs
String fastqcExe
String bwaExe
String samtoolsExe
String sambambaExe
String bedToolsExe
String qualimapExe
String bcfToolsExe
String bgZipExe
String tabixExe
String multiqcExe
String gatkExe
## Standard execs
String awkExe
String sedExe
String sortExe
String javaExe
## bwaSamtools
String platform
File refAmb
File refAnn
File refBwt
File refPac
File refSa
## sambambaIndex
## gatk splitintervals
String subdivisionMode
## gatk Base recal
File knownSites1
File knownSites1Index
File knownSites2
File knownSites2Index
File knownSites3
File knownSites3Index
## cram conversion
File refFastaGz
File refFaiGz
File refFaiGzi
## gatk-picard
String variantEvalEV = "MetricsCollection"
## computePoorCoverage
Int bedtoolsLowCoverage
Int bedToolsSmallInterval
## computeCoverage
Int minCovBamQual
## haplotypeCaller
String swMode
String emitRefConfidence = "NONE"
## jvarkit
String vcfPolyXJar
## ConvertCramtoCrumble
String crumbleExe
String ldLibraryPath
## DeepVariant
String referenceFasta
String modelType
String bedFile
String data
String refData
String dvOut
String outputMnt
String deepExe
String singularity
String singularityImg
## RefCallFiltration
String vcftoolsExe
## VcSuffix
String dvSuffix = ".dv"
String hcSuffix = ".hc"
## Anacore-Utils mcustom mergeVCF script
File mergeVCFMobiDL
# Tasks calls
call runPreparePanelCaptureTmpDirs.preparePanelCaptureTmpDirs {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType
}
# RunFastqc on all FASTQs
call runFastqcDuo.fastqc {
input:
Cpu = cpuHigh,
Memory = memoryLow,
SampleID = sampleID,
FatherSampleID = FatherSampleID,
OutDir = outDir,
WorkflowType = workflowType,
FastqcExe = fastqcExe,
FastqR1 = fastqR1,
FatherFastqR1 = FatherFastqR1,
FastqR2 = fastqR2,
FatherFastqR2 = FatherFastqR2,
Suffix1 = suffix1,
Suffix2 = suffix2,
DirsPrepared = preparePanelCaptureTmpDirs.dirsPrepared
}
call runGatkBedToPicardIntervalList.gatkBedToPicardIntervalList as gatkBedToPicardIntervalListTarget {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
IntervalBedFile = intervalBedFile,
RefDict = refDict,
GatkExe = gatkExe,
DirsPrepared = preparePanelCaptureTmpDirs.dirsPrepared
}
call runGatkBedToPicardIntervalList.gatkBedToPicardIntervalList as gatkBedToPicardIntervalListBait {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
Bait = true,
IntervalBedFile = intervalBaitBedFile,
RefDict = refDict,
GatkExe = gatkExe,
DirsPrepared = preparePanelCaptureTmpDirs.dirsPrepared
}
#Call alignement SubWorkflow
call alignDNA.alignDNA as alignCI {
input:
## Resources
CpuHigh = cpuHigh,
CpuLow = cpuLow,
memoryLow = memoryLow,
memoryHigh = memoryHigh,
## Global
sampleID = sampleID,
CIsDIR = sampleID,
fastqR1 = fastqR1,
fastqR2 = fastqR2,
refFasta = refFasta,
refFai = refFai,
refDict = refDict,
intervalBedFile = intervalBedFile,
workflowType = workflowType,
outDir = outDir,
genomeVersion = genomeVersion,
## Bioinfo execs,
bwaExe = bwaExe,
samtoolsExe = samtoolsExe,
sambambaExe = sambambaExe,
bedToolsExe = bedToolsExe,
## Standard execs
sortExe = sortExe,
awkExe = awkExe,
gatkExe = gatkExe,
## bwaSamtools
platform = platform,
refAmb = refAmb,
refAnn = refAnn,
refBwt = refBwt,
refPac = refPac,
refSa = refSa,
# CRAM conversion
refFastaGz = refFastaGz,
refFaiGz = refFaiGz,
refFaiGzi = refFaiGzi,
#Comvert Cram to CrumbleExe
crumbleExe = crumbleExe,
ldLibraryPath = ldLibraryPath,
## sambambaIndex
## gatk splitintervals
subdivisionMode = subdivisionMode,
## gatk Base recal
knownSites1 = knownSites1,
knownSites1Index = knownSites1Index,
knownSites2 = knownSites2,
knownSites2Index = knownSites2Index,
knownSites3 = knownSites3,
knownSites3Index = knownSites3Index,
DirsPrepared = preparePanelCaptureTmpDirs.dirsPrepared,
## compute LowCoverage
minCovBamQual = minCovBamQual,
## computePoorCoverage
bedtoolsLowCoverage = bedtoolsLowCoverage,
bedToolsSmallInterval = bedToolsSmallInterval,
## Picard HSmetrix
BaitIntervals = gatkBedToPicardIntervalListBait.picardIntervals,
TargetIntervals = gatkBedToPicardIntervalListTarget.picardIntervals
}
call alignDNA.alignDNA as alignFather {
input:
## Resources
CpuHigh = cpuHigh,
CpuLow = cpuLow,
memoryLow = memoryLow,
memoryHigh = memoryHigh,
## Global
sampleID = FatherSampleID,
CIsDIR = sampleID,
fastqR1 = FatherFastqR1,
fastqR2 = FatherFastqR2,
refFasta = refFasta,
refFai = refFai,
refDict = refDict,
intervalBedFile = intervalBedFile,
workflowType = workflowType,
outDir = outDir,
genomeVersion = genomeVersion,
## Bioinfo execs,
bwaExe = bwaExe,
samtoolsExe = samtoolsExe,
sambambaExe = sambambaExe,
bedToolsExe = bedToolsExe,
## Standard execs
sortExe = sortExe,
awkExe = awkExe,
gatkExe = gatkExe,
## bwaSamtools
platform = platform,
refAmb = refAmb,
refAnn = refAnn,
refBwt = refBwt,
refPac = refPac,
refSa = refSa,
## sambambaIndex
# CRAM conversion
refFastaGz = refFastaGz,
refFaiGz = refFaiGz,
refFaiGzi = refFaiGzi,
#Comvert Cram to CrumbleExe
crumbleExe = crumbleExe,
ldLibraryPath = ldLibraryPath,
## gatk splitintervals
subdivisionMode = subdivisionMode,
## gatk Base recal
knownSites1 = knownSites1,
knownSites1Index = knownSites1Index,
knownSites2 = knownSites2,
knownSites2Index = knownSites2Index,
knownSites3 = knownSites3,
knownSites3Index = knownSites3Index,
DirsPrepared = preparePanelCaptureTmpDirs.dirsPrepared,
## compute LowCoverage
minCovBamQual = minCovBamQual,
## computePoorCoverage
bedtoolsLowCoverage = bedtoolsLowCoverage,
bedToolsSmallInterval = bedToolsSmallInterval,
## Picard HSmetrix
BaitIntervals = gatkBedToPicardIntervalListBait.picardIntervals,
TargetIntervals = gatkBedToPicardIntervalListTarget.picardIntervals
}
##############################################HaplotypeCaller######################@
scatter (interval in alignCI.splittedIntervals) {
call runGatkHaplotypeCallerDuo.gatkHaplotypeCallerDuo {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
GatkExe = gatkExe,
RefFasta = refFasta,
RefFai = refFai,
RefDict = refDict,
DbSNP = knownSites3,
DbSNPIndex = knownSites3Index,
GatkInterval = interval,
BamFile = alignCI.bam,
BamIndex = alignCI.idx,
BamFileFather = alignFather.bam,
BamIndexFather = alignFather.idx,
SwMode = swMode,
EmitRefConfidence = emitRefConfidence
}
}
output {
Array[File] hcVcfs = gatkHaplotypeCallerDuo.hcVcf
}
call runGatkGatherVcfs.gatkGatherVcfs {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
GatkExe = gatkExe,
HcVcfs = hcVcfs,
VcSuffix = hcSuffix
}
call runJvarkitVcfPolyX.jvarkitVcfPolyX as jvarkitVcfPolyxHc {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
RefFasta = refFasta,
RefFai = refFai,
RefDict = refDict,
JavaExe = javaExe,
VcfPolyXJar = vcfPolyXJar,
VcSuffix = hcSuffix,
Vcf = gatkGatherVcfs.gatheredHcVcf,
VcfIndex = gatkGatherVcfs.gatheredHcVcfIndex
}
call runGatkSplitVcfs.gatkSplitVcfs {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
VcSuffix = hcSuffix,
GatkExe = gatkExe,
Vcf = jvarkitVcfPolyxHc.polyxedVcf,
VcfIndex = jvarkitVcfPolyxHc.polyxedVcfIndex
}
call runGatkVariantFiltrationSnp.gatkVariantFiltrationSnp {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
GatkExe = gatkExe,
RefFasta = refFasta,
RefFai = refFai,
RefDict = refDict,
Vcf = gatkSplitVcfs.snpVcf,
VcfIndex = gatkSplitVcfs.snpVcfIndex,
LowCoverage = bedtoolsLowCoverage
}
call runGatkVariantFiltrationIndel.gatkVariantFiltrationIndel {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
GatkExe = gatkExe,
RefFasta = refFasta,
RefFai = refFai,
RefDict = refDict,
Vcf = gatkSplitVcfs.indelVcf,
VcfIndex = gatkSplitVcfs.indelVcfIndex,
LowCoverage = bedtoolsLowCoverage
}
call runGatkMergeVcfs.gatkMergeVcfs {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
GatkExe = gatkExe,
Vcfs = [gatkVariantFiltrationSnp.filteredSnpVcf, gatkVariantFiltrationIndel.filteredIndelVcf],
VcSuffix = hcSuffix
}
call runGatkSortVcf.gatkSortVcf as gatkSortVcfHc {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
GatkExe = gatkExe,
VcSuffix = hcSuffix,
UnsortedVcf = gatkMergeVcfs.mergedVcf
}
call runBcftoolsNorm.bcftoolsNorm as bcftoolsNormHc {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
BcfToolsExe = bcfToolsExe,
VcSuffix = hcSuffix,
SortedVcf = gatkSortVcfHc.sortedVcf
}
call runCompressIndexVcf.compressIndexVcf as compressIndexVcfHc {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
BgZipExe = bgZipExe,
TabixExe = tabixExe,
VcSuffix = hcSuffix,
# NormVcf = bcftoolsNormHc.normVcf
VcfFile = gatkSortVcfHc.sortedVcf
}
call runBcftoolsStats.bcftoolsStats as bcftoolsStatsHc {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
BcfToolsExe = bcfToolsExe,
VcSuffix = hcSuffix,
VcfFile = compressIndexVcfHc.bgZippedVcf,
VcfFileIndex = compressIndexVcfHc.bgZippedVcfIndex
}
if (!debug) {
String dataPath = "${outDir}${sampleID}/${workflowType}/"
call runCleanUpPanelCaptureDuoTmpDirs.cleanUpPanelCaptureDuoTmpDirs {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
FinalFile1 = compressIndexVcfHc.bgZippedVcf,
FinalFile2 = alignCI.CrumbleIndex,
FinalFile3 = alignFather.CrumbleIndex,
}
call runMultiqc.multiqc {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
MultiqcExe = multiqcExe,
Vcf = cleanUpPanelCaptureDuoTmpDirs.finalFile1
}
}
call runToolVersions.toolVersions {
input:
Cpu = cpuLow,
Memory = memoryHigh,
SampleID = sampleID,
OutDir = outDir,
WorkflowType = workflowType,
GenomeVersion = genomeVersion,
FastqcExe = fastqcExe,
BwaExe = bwaExe,
SamtoolsExe = samtoolsExe,
SambambaExe = sambambaExe,
BedToolsExe = bedToolsExe,
QualimapExe = qualimapExe,
BcfToolsExe = bcfToolsExe,
BgZipExe = bgZipExe,
CrumbleExe = crumbleExe,
TabixExe = tabixExe,
MultiqcExe = multiqcExe,
GatkExe = gatkExe,
JavaExe= javaExe,
VcfPolyXJar = vcfPolyXJar,
Vcf = cleanUpPanelCaptureDuoTmpDirs.finalFile1
}
output {
File? FinalVcf = cleanUpPanelCaptureDuoTmpDirs.finalFile1
File FinalCram = alignCI.Crumble
File FinalCramIndex = alignCI.CrumbleIndex
File FinalCramFather = alignFather.Crumble
File FinalCramIndexFather = alignFather.CrumbleIndex
File VersionFile = toolVersions.versionFile
}
}