-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathpicard.wdl
1222 lines (1075 loc) · 54 KB
/
picard.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
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
version 1.0
# Copyright (c) 2017 Leiden University Medical Center
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
task BedToIntervalList {
input {
File bedFile
File dict
String outputPath = "regions.interval_list"
String javaXmx = "3G"
String memory = "4GiB"
Int timeMinutes = 5
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "$(dirname ~{outputPath})"
picard -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
BedToIntervalList \
I=~{bedFile} \
O=~{outputPath} \
SD=~{dict}
}
output {
File intervalList = outputPath
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
bedFile: {description: "A bed file.", category: "required"}
dict: {description: "A sequence dict file.", category: "required"}
outputPath: {description: "The location the output interval list should be written to.", category: "advanced"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
intervalList: {description: "Picard Interval List from a BED file."}
}
}
task CollectHsMetrics {
input {
File inputBam
File inputBamIndex
File referenceFasta
File referenceFastaDict
File referenceFastaFai
File targets
String basename
File? baits
# Use the targets file as baits as a fallback, since often the baits
# for a certain capture kit are not available.
File baitsFile = select_first([baits, targets])
File targetsFile = targets
Int javaXmxMb = 3072
Int memoryMb = javaXmxMb + 512
# Additional * 2 because picard multiple metrics reads the
# reference fasta twice.
Int timeMinutes = 1 + ceil(size(referenceFasta, "GiB") * 3 * 2) + ceil(size(inputBam, "GiB") * 6)
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "$(dirname ~{basename})"
picard -Xmx~{javaXmxMb}M -XX:ParallelGCThreads=1 \
CollectHsMetrics \
I=~{inputBam} \
R=~{referenceFasta} \
BAIT_INTERVALS=~{baitsFile} \
TARGET_INTERVALS=~{targetsFile} \
O="~{basename}.hs_metrics.txt"
}
output {
File HsMetrics = basename + ".hs_metrics.txt"
}
runtime {
memory: "~{memoryMb}MiB"
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputBam: {description: "The input BAM file for which metrics will be collected.", category: "required"}
inputBamIndex: {description: "The index of the input BAM file.", category: "required"}
referenceFasta: {description: "The reference fasta file which was also used for mapping.", category: "required"}
referenceFastaDict: {description: "The sequence dictionary associated with the reference fasta file.", category: "required"}
referenceFastaFai: {description: "The index for the reference fasta file.", category: "required"}
targets: {description: "Picard interval file of the capture targets.", category: "required"}
targetsFile: {description: "Picard interval file of the capture targets, the same as targets.", category: "advanced"}
basename: {description: "The basename/prefix of the output files (may include directories).", category: "required"}
baits: {description: "Picard interval file of the capture bait set.", category: "advanced"}
baitsFile: {description: "Picard interval file of the bait set. Uses targets as a fallback when baits is not set.", category: "advanced"}
javaXmxMb: {description: "The maximum memory available to the program in megabytes. Should be lower than `memoryMb` to accommodate JVM overhead.", category: "advanced"}
memoryMb: {description: "The amount of memory this job will use in megabytes.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
HsMetrics: {description: "Hybrid-selection (HS) metrics for the input BAM file."}
}
}
task CollectInsertSizeMetrics {
input {
File inputBam
File inputBamIndex
Float? minimumPercentage
String basename = "./insertSize_metrics"
String memory = "5GiB"
String javaXmx = "4G"
Int timeMinutes = 1 + ceil(size(inputBam, "GiB") * 6)
String dockerImage = "quay.io/biocontainers/picard:2.23.2--0"
}
command {
set -e
mkdir -p "$(dirname ~{basename})"
picard -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
CollectInsertSizeMetrics \
I=~{inputBam} \
O=~{basename}.txt \
H=~{basename}.pdf \
~{"M=" + minimumPercentage}
}
output {
File metricsTxt = "~{basename}.txt"
File metricsPdf = "~{basename}.pdf"
}
runtime {
docker: dockerImage
time_minutes: timeMinutes
memory: memory
}
parameter_meta {
# inputs
inputBam: {description: "The input BAM file for which metrics will be collected.", category: "required"}
inputBamIndex: {description: "The index of the input BAM file.", category: "required"}
minimumPercentage: {description: "Equivalent to picard CollectInsertSizeMetrics' `M` option.", category: "advanced"}
basename: {description: "The basename for the output files.", category: "common"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.",
category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.",
category: "advanced"}
}
}
task CollectMultipleMetrics {
input {
File inputBam
File inputBamIndex
File referenceFasta
File referenceFastaDict
File referenceFastaFai
String basename
Boolean collectAlignmentSummaryMetrics = true
Boolean collectInsertSizeMetrics = true
Boolean qualityScoreDistribution = true
Boolean meanQualityByCycle = true
Boolean collectBaseDistributionByCycle = true
Boolean collectGcBiasMetrics = true
#FIXME: Boolean rnaSeqMetrics = false # There is a bug in picard https://github.com/broadinstitute/picard/issues/999
Boolean collectSequencingArtifactMetrics = true
Boolean collectQualityYieldMetrics = true
Int javaXmxMb = 3072
Int memoryMb = javaXmxMb + 512
# Additional * 2 because picard multiple metrics reads the reference fasta twice.
Int timeMinutes = 1 + ceil(size(referenceFasta, "GiB") * 3 * 2) + ceil(size(inputBam, "GiB") * 6)
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "$(dirname ~{basename})"
picard -Xmx~{javaXmxMb}M -XX:ParallelGCThreads=1 \
CollectMultipleMetrics \
I=~{inputBam} \
R=~{referenceFasta} \
O=~{basename} \
PROGRAM=null \
~{true="PROGRAM=CollectAlignmentSummaryMetrics" false="" collectAlignmentSummaryMetrics} \
~{true="PROGRAM=CollectInsertSizeMetrics" false="" collectInsertSizeMetrics} \
~{true="PROGRAM=QualityScoreDistribution" false="" qualityScoreDistribution} \
~{true="PROGRAM=MeanQualityByCycle" false="" meanQualityByCycle} \
~{true="PROGRAM=CollectBaseDistributionByCycle" false="" collectBaseDistributionByCycle} \
~{true="PROGRAM=CollectGcBiasMetrics" false="" collectGcBiasMetrics} \
~{true="PROGRAM=CollectSequencingArtifactMetrics" false="" collectSequencingArtifactMetrics} \
~{true="PROGRAM=CollectQualityYieldMetrics" false="" collectQualityYieldMetrics}
}
output {
File? alignmentSummary = basename + ".alignment_summary_metrics"
File? baitBiasDetail = basename + ".bait_bias_detail_metrics"
File? baitBiasSummary = basename + ".bait_bias_summary_metrics"
File? baseDistributionByCycle = basename + ".base_distribution_by_cycle_metrics"
File? baseDistributionByCyclePdf = basename + ".base_distribution_by_cycle.pdf"
File? errorSummary = basename + ".error_summary_metrics"
File? gcBiasDetail = basename + ".gc_bias.detail_metrics"
File? gcBiasPdf = basename + ".gc_bias.pdf"
File? gcBiasSummary = basename + ".gc_bias.summary_metrics"
File? insertSizeHistogramPdf = basename + ".insert_size_histogram.pdf"
File? insertSize = basename + ".insert_size_metrics"
File? preAdapterDetail = basename + ".pre_adapter_detail_metrics"
File? preAdapterSummary = basename + ".pre_adapter_summary_metrics"
File? qualityByCycle = basename + ".quality_by_cycle_metrics"
File? qualityByCyclePdf = basename + ".quality_by_cycle.pdf"
File? qualityDistribution = basename + ".quality_distribution_metrics"
File? qualityDistributionPdf = basename + ".quality_distribution.pdf"
File? qualityYield = basename + ".quality_yield_metrics"
# Using a glob is easier. But will lead to very ugly output directories.
Array[File] allStats = select_all([
alignmentSummary,
baitBiasDetail,
baitBiasSummary,
baseDistributionByCycle,
baseDistributionByCyclePdf,
errorSummary,
gcBiasDetail,
gcBiasPdf,
gcBiasSummary,
insertSizeHistogramPdf,
insertSize,
preAdapterDetail,
preAdapterSummary,
qualityByCycle,
qualityByCyclePdf,
qualityDistribution,
qualityDistributionPdf,
qualityYield
])
}
runtime {
memory: "~{memoryMb}MiB"
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputBam: {description: "The input BAM file for which metrics will be collected.", category: "required"}
inputBamIndex: {description: "The index of the input BAM file.", category: "required"}
referenceFasta: {description: "The reference fasta file which was also used for mapping.", category: "required"}
referenceFastaDict: {description: "The sequence dictionary associated with the reference fasta file.", category: "required"}
referenceFastaFai: {description: "The index for the reference fasta file.", category: "required"}
basename: {description: "The basename/prefix of the output files (may include directories).", category: "required"}
collectAlignmentSummaryMetrics: {description: "Equivalent to the `PROGRAM=CollectAlignmentSummaryMetrics` argument.", category: "advanced"}
collectInsertSizeMetrics: {description: "Equivalent to the `PROGRAM=CollectInsertSizeMetrics` argument.", category: "advanced"}
qualityScoreDistribution: {description: "Equivalent to the `PROGRAM=QualityScoreDistribution` argument.", category: "advanced"}
meanQualityByCycle: {description: "Equivalent to the `PROGRAM=MeanQualityByCycle` argument.", category: "advanced"}
collectBaseDistributionByCycle: {description: "Equivalent to the `PROGRAM=CollectBaseDistributionByCycle` argument.", category: "advanced"}
collectGcBiasMetrics: {description: "Equivalent to the `PROGRAM=CollectGcBiasMetrics` argument.", category: "advanced"}
collectSequencingArtifactMetrics: {description: "Equivalent to the `PROGRAM=CollectSequencingArtifactMetrics` argument.", category: "advanced"}
collectQualityYieldMetrics: {description: "Equivalent to the `PROGRAM=CollectQualityYieldMetrics` argument.", category: "advanced"}
javaXmxMb: {description: "The maximum memory available to the program in megabytes. Should be lower than `memoryMb` to accommodate JVM overhead.", category: "advanced"}
memoryMb: {description: "The amount of memory this job will use in megabytes.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
alignmentSummary: {description: ""}
baitBiasDetail: {description: ""}
baitBiasSummary: {description: ""}
baseDistributionByCycle: {description: ""}
baseDistributionByCyclePdf: {description: ""}
errorSummary: {description: ""}
gcBiasDetail: {description: ""}
gcBiasPdf: {description: ""}
gcBiasSummary: {description: ""}
insertSizeHistogramPdf: {description: ""}
insertSize: {description: ""}
preAdapterDetail: {description: ""}
preAdapterSummary: {description: ""}
qualityByCycle: {description: ""}
qualityByCyclePdf: {description: ""}
qualityDistribution: {description: ""}
qualityDistributionPdf: {description: ""}
qualityYield: {description: ""}
allStats: {description: ""}
}
}
task CollectRnaSeqMetrics {
input {
File inputBam
File inputBamIndex
File refRefflat
String basename
String strandSpecificity = "NONE"
String javaXmx = "8G"
String memory = "9GiB"
# With 6 minutes per G there were several timeouts.
Int timeMinutes = 1 + ceil(size(inputBam, "GiB") * 12)
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "$(dirname ~{basename})"
picard -Xmx~{javaXmx} \
CollectRnaSeqMetrics -XX:ParallelGCThreads=1 \
I=~{inputBam} \
O=~{basename}.RNA_Metrics \
CHART_OUTPUT=~{basename}.RNA_Metrics.pdf \
STRAND_SPECIFICITY=~{strandSpecificity} \
REF_FLAT=~{refRefflat}
}
output {
File metrics = basename + ".RNA_Metrics"
File? chart = basename + ".RNA_Metrics.pdf"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputBam: {description: "The input BAM file for which metrics will be collected.", category: "required"}
inputBamIndex: {description: "The index of the input BAM file.", category: "required"}
refRefflat: {description: "A refflat file containing gene annotations.", catehory: "required"}
basename: {description: "The basename/prefix of the output files (may include directories).", category: "required"}
strandSpecificity: {description: "Equivalent to the `STRAND_SPECIFICITY` option of picard's CollectRnaSeqMetrics.", category: "common"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
metrics: {description: "Metrics describing the distribution of bases within the transcripts."}
chart: {description: "Plot of normalized position vs. coverage."}
}
}
task CollectTargetedPcrMetrics {
input {
File inputBam
File inputBamIndex
File referenceFasta
File referenceFastaDict
File referenceFastaFai
File ampliconIntervals
Array[File]+ targetIntervals
String basename
String javaXmx = "3G"
String memory = "4GiB"
Int timeMinutes = 1 + ceil(size(inputBam, "GiB") * 6)
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "$(dirname ~{basename})"
picard -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
CollectTargetedPcrMetrics \
I=~{inputBam} \
R=~{referenceFasta} \
AMPLICON_INTERVALS=~{ampliconIntervals} \
TARGET_INTERVALS=~{sep=" TARGET_INTERVALS=" targetIntervals} \
O=~{basename}.targetPcrMetrics \
PER_BASE_COVERAGE=~{basename}.targetPcrPerBaseCoverage \
PER_TARGET_COVERAGE=~{basename}.targetPcrPerTargetCoverage
}
output {
File perTargetCoverage = basename + ".targetPcrPerTargetCoverage"
File perBaseCoverage = basename + ".targetPcrPerBaseCoverage"
File metrics = basename + ".targetPcrMetrics"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputBam: {description: "The input BAM file for which metrics will be collected.", category: "required"}
inputBamIndex: {description: "The index of the input BAM file.", category: "required"}
referenceFasta: {description: "The reference fasta file which was also used for mapping.", category: "required"}
referenceFastaDict: {description: "The sequence dictionary associated with the reference fasta file.", category: "required"}
referenceFastaFai: {description: "The index for the reference fasta file.", category: "required"}
ampliconIntervals: {description: "An interval list describinig the coordinates of the amplicons sequenced.", category: "required"}
targetIntervals: {description: "An interval list describing the coordinates of the targets sequenced.", category: "required"}
basename: {description: "The basename/prefix of the output files (may include directories).", category: "required"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
perTargetCoverage: {description: "Per target coverage information."}
perBaseCoverage: {description: "Per base coverage information to."}
metrics: {description: "File containing metrics."}
}
}
task CollectVariantCallingMetrics {
input {
File dbsnp
File dbsnpIndex
File inputVCF
File inputVCFIndex
String basename
String javaXmx = "8G"
String memory = "9GiB"
Int timeMinutes = 1440
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "$(dirname ~{basename})"
picard -Xmx~{javaXmx} \
CollectVariantCallingMetrics -XX:ParallelGCThreads=1 \
DBSNP=~{dbsnp} \
INPUT=~{inputVCF} \
OUTPUT=~{basename}
}
output {
File details = basename + ".variant_calling_detail_metrics"
File summary = basename + ".variant_calling_summary_metrics"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
dbsnp: {description: "DBSNP vcf file to use with CollectVariantCallingMetrics.", category: "required"}
dbsnpIndex: {description: "Index file for the DBSNP VCF.", category: "required"}
inputVCF: {description: "Input VCF file.", category: "required"}
inputVCFIndex: {description: "Index file for the input VCF.", category: "required"}
basename: {description: "The basename/prefix of the output files (may include directories).", category: "required"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
details: {description: ""}
summary: {description: ""}
}
}
task CollectWgsMetrics {
input {
File inputBam
File inputBamIndex
File referenceFasta
File referenceFastaDict
File referenceFastaFai
String outputPath = "./wgs_metrics.txt"
Int? minimumMappingQuality
Int? minimumBaseQuality
Int? coverageCap
String memory = "5GiB"
String javaXmx = "4G"
Int timeMinutes = 1 + ceil(size(inputBam, "GiB") * 6)
String dockerImage = "quay.io/biocontainers/picard:2.23.2--0"
}
command {
set -e
mkdir -p "$(dirname ~{outputPath})"
picard -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
CollectWgsMetrics \
REFERENCE_SEQUENCE=~{referenceFasta} \
INPUT=~{inputBam} \
OUTPUT=~{outputPath} \
~{"MINIMUM_MAPPING_QUALITY=" + minimumMappingQuality} \
~{"MINIMUM_BASE_QUALITY=" + minimumBaseQuality} \
~{"COVERAGE_CAP=" + coverageCap}
}
output {
File metrics = outputPath
}
runtime {
docker: dockerImage
time_minutes: timeMinutes
memory: memory
}
parameter_meta {
# inputs
inputBam: {description: "The input BAM file for which metrics will be collected.", category: "required"}
inputBamIndex: {description: "The index of the input BAM file.", category: "required"}
referenceFasta: {description: "The reference fasta file which was also used for mapping.", category: "required"}
referenceFastaDict: {description: "The sequence dictionary associated with the reference fasta file.",
category: "required"}
referenceFastaFai: {description: "The index for the reference fasta file.", category: "required"}
outputPath: {description: "The path picard CollectWgsMetrics' output should be written to.", category: "common"}
minimumMappingQuality: {description: "Equivalent to picard CollectWgsMetrics' MINIMUM_MAPPING_QUALITY option.", category: "advanced"}
minimumBaseQuality: {description: "Equivalent to picard CollectWgsMetrics' MINIMUM_BASE_QUALITY option.", category: "advanced"}
coverageCap: {description: "Equivalent to picard CollectWgsMetrics' OVERAGE_CAP option.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.",
category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.",
category: "advanced"}
}
}
task CreateSequenceDictionary {
input {
File inputFile
String outputDir
String javaXmx = "2G"
String memory = "3GiB"
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "~{outputDir}"
picard -Xmx~{javaXmx} \
-XX:ParallelGCThreads=1 \
CreateSequenceDictionary \
REFERENCE=~{inputFile} \
OUTPUT="~{outputDir}/$(basename ~{inputFile}).dict"
}
output {
File outputDict = outputDir + "/" + basename(inputFile) + ".dict"
}
runtime {
memory: memory
docker: dockerImage
}
parameter_meta {
# inputs
inputFile: {description: "The input fasta file.", category: "required"}
outputDir: {description: "Output directory path.", category: "required"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
outputDict: {description: "Dictionary of the input fasta file."}
}
}
# Combine multiple recalibrated BAM files from scattered
# ApplyRecalibration runs.
task GatherBamFiles {
input {
Array[File]+ inputBams
Array[File]+ inputBamsIndex
String outputBamPath
Boolean createMd5File = false
Int compressionLevel = 1
Boolean useJdkInflater = false
Boolean useJdkDeflater = true # Achieves much better compression rates than the intel deflater
Int javaXmxMb = 1024
Int memoryMb = javaXmxMb + 512
# One minute per input gigabyte.
Int timeMinutes = 1 + ceil(size(inputBams, "GiB") * 1)
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "$(dirname ~{outputBamPath})"
picard -Xmx~{javaXmxMb}M -XX:ParallelGCThreads=1 \
GatherBamFiles \
INPUT=~{sep=' INPUT=' inputBams} \
OUTPUT=~{outputBamPath} \
COMPRESSION_LEVEL=~{compressionLevel} \
USE_JDK_INFLATER=~{true="true" false="false" useJdkInflater} \
USE_JDK_DEFLATER=~{true="true" false="false" useJdkDeflater} \
CREATE_INDEX=true \
CREATE_MD5_FILE=~{true="true" false="false" createMd5File}
}
output {
File outputBam = outputBamPath
File outputBamIndex = sub(outputBamPath, "\.bam$", ".bai")
File? outputBamMd5 = outputBamPath + ".md5"
}
runtime {
memory: "~{memoryMb}MiB"
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputBams: {description: "The BAM files to be merged together.", category: "required"}
inputBamsIndex: {description: "The indexes of the input BAM files.", category: "required"}
outputBamPath: {description: "The path where the merged BAM file will be written.", caregory: "required"}
createMd5File: {decription: "Whether to create an md5 file of the output BAM.", category: "advanced"}
compressionLevel: {description: "The compression level at which the BAM files are written.", category: "advanced"}
useJdkInflater: {description: "True, uses the java inflater. False, uses the optimized intel inflater.", category: "advanced"}
useJdkDeflater: {description: "True, uses the java deflator to compress the BAM files. False uses the optimized intel deflater.", category: "advanced"}
javaXmxMb: {description: "The maximum memory available to the program in megabytes. Should be lower than `memoryMb` to accommodate JVM overhead.", category: "advanced"}
memoryMb: {description: "The amount of memory this job will use in megabytes.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
outputBam: {description: "Concatenated BAM files."}
outputBamIndex: {description: "Index of the output `outputBam`."}
outputBamMd5: {description: "MD5 of the output `outputBam`."}
}
}
task GatherVcfs {
input {
Array[File]+ inputVcfs
Array[File]+ inputVcfIndexes
String outputVcfPath = "out.vcf.gz"
Int compressionLevel = 1
Boolean useJdkInflater = false
Boolean useJdkDeflater = true # Achieves much better compression rates than the intel deflater
String javaXmx = "4G"
String memory = "5GiB"
Int timeMinutes = 1 + ceil(size(inputVcfs, "GiB") * 2)
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir -p "$(dirname ~{outputVcfPath})"
picard -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
GatherVcfs \
COMPRESSION_LEVEL=~{compressionLevel} \
USE_JDK_INFLATER=~{true="true" false="false" useJdkInflater} \
USE_JDK_DEFLATER=~{true="true" false="false" useJdkDeflater} \
CREATE_INDEX=true \
INPUT=~{sep=' INPUT=' inputVcfs} \
OUTPUT=~{outputVcfPath}
}
output {
File outputVcf = outputVcfPath
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputVcfs: {description: "The VCF files to be merged together.", category: "required"}
inputVcfIndexes: {description: "The indexes of the input VCF files.", category: "required"}
outputVcfPath: {description: "The path where the merged VCF file will be written.", caregory: "required"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
compressionLevel: {description: "The compression level at which the BAM files are written.", category: "advanced"}
useJdkInflater: {description: "True, uses the java inflater. False, uses the optimized intel inflater.", category: "advanced"}
useJdkDeflater: {description: "True, uses the java deflator to compress the BAM files. False uses the optimized intel deflater.", category: "advanced"}
# outputs
outputVcf: {description: "Multiple VCF files gathered into one file."}
}
}
# Mark duplicate reads to avoid counting non-independent observations.
task MarkDuplicates {
input {
Array[File]+ inputBams
String outputBamPath
String metricsPath
Boolean createMd5File = false
Int compressionLevel = 1
Boolean useJdkInflater = false
Boolean useJdkDeflater = true # Achieves much better compression rates than the intel deflater
# The program default for READ_NAME_REGEX is appropriate in nearly every case.
# Sometimes we wish to supply "null" in order to turn off optical duplicate detection.
# This can be desirable if you don't mind the estimated library size
# being wrong and optical duplicate detection is taking >7 days and failing.
String? read_name_regex
# In GATK Best practices pipeline MarkDuplicates is given a 7G VM.
# https://github.com/gatk-workflows/broad-prod-wgs-germline-snps-indels/blob/d2934ed656ade44801f9cfe1c0e78d4f80684b7b/PairedEndSingleSampleWf-fc-hg38.wdl#L1040
Int javaXmxMb = 6656 # 6.5G
String memoryMb = javaXmxMb + 512
Int timeMinutes = 1 + ceil(size(inputBams, "GiB") * 8)
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
# Task is assuming query-sorted input so that the Secondary and Supplementary reads get
# marked correctly. This works because the output of BWA is query-grouped and therefore,
# so is the output of MergeBamAlignment. While query-grouped isn't actually query-sorted,
# it's good enough for MarkDuplicates with ASSUME_SORT_ORDER="queryname".
command {
set -e
mkdir -p "$(dirname ~{outputBamPath})"
picard -Xmx~{javaXmxMb}M -XX:ParallelGCThreads=1 \
MarkDuplicates \
INPUT=~{sep=' INPUT=' inputBams} \
OUTPUT=~{outputBamPath} \
METRICS_FILE=~{metricsPath} \
COMPRESSION_LEVEL=~{compressionLevel} \
USE_JDK_INFLATER=~{true="true" false="false" useJdkInflater} \
USE_JDK_DEFLATER=~{true="true" false="false" useJdkDeflater} \
VALIDATION_STRINGENCY=SILENT \
~{"READ_NAME_REGEX=" + read_name_regex} \
OPTICAL_DUPLICATE_PIXEL_DISTANCE=2500 \
CLEAR_DT="false" \
CREATE_INDEX=true \
ADD_PG_TAG_TO_READS=false \
CREATE_MD5_FILE=~{true="true" false="false" createMd5File} \
}
output {
File outputBam = outputBamPath
File outputBamIndex = sub(outputBamPath, "\.bam$", ".bai")
File? outputBamMd5 = outputBamPath + ".md5"
File metricsFile = metricsPath
}
runtime {
memory: "~{memoryMb}MiB"
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputBams: {description: "The BAM files for which the duplicate reads should be marked.", category: "required"}
outputBamPath: {description: "The location where the ouptut BAM file should be written.", category: "required"}
metricsPath: {description: "The location where the output metrics file should be written.", category: "required"}
compressionLevel: {description: "The compression level at which the BAM files are written.", category: "advanced"}
useJdkInflater: {description: "True, uses the java inflater. False, uses the optimized intel inflater.", category: "advanced"}
useJdkDeflater: {description: "True, uses the java deflator to compress the BAM files. False uses the optimized intel deflater.", category: "advanced"}
createMd5File: {description: "Whether to create a md5 file for the created BAM file.", category: "advanced"}
read_name_regex: {description: "Equivalent to the `READ_NAME_REGEX` option of MarkDuplicates.", category: "advanced"}
javaXmxMb: {description: "The maximum memory available to the program in megabytes. Should be lower than `memoryMb` to accommodate JVM overhead.", category: "advanced"}
memoryMb: {description: "The amount of memory this job will use in megabytes.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
outputBam: {description: ""}
outputBamIndex: {description: ""}
outputBamMd5: {description: ""}
metricsFile: {description: ""}
}
}
# Combine multiple VCFs or GVCFs from scattered HaplotypeCaller runs.
task MergeVCFs {
input {
Array[File]+ inputVCFs
Array[File]+ inputVCFsIndexes
String outputVcfPath
Int compressionLevel = 1
Boolean useJdkInflater = false
# Better results for compression level 1 (much smaller).
# Higher compression levels similar to intel deflater.
# NOTE: this might change in the future when the intel deflater is updated!
# Second NOTE: No it did not change. Only the fastest algorithm with
# worse compression is wrapped in the intel GKL. Instead of using
# one of the slightly slower but better compressing alternatives from ISA-L.
# (Which are also faster than zlib.)
Boolean useJdkDeflater = true # Achieves much better compression rates than the intel deflater
String javaXmx = "4G"
String memory = "5GiB"
Int timeMinutes = 1 + ceil(size(inputVCFs, "GiB")) * 2
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
# Using MergeVcfs instead of GatherVcfs so we can create indices.
# See https://github.com/broadinstitute/picard/issues/789 for relevant GatherVcfs ticket.
command {
set -e
mkdir -p "$(dirname ~{outputVcfPath})"
picard -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
MergeVcfs \
INPUT=~{sep=' INPUT=' inputVCFs} \
OUTPUT=~{outputVcfPath} \
COMPRESSION_LEVEL=~{compressionLevel} \
USE_JDK_INFLATER=~{true="true" false="false" useJdkInflater} \
USE_JDK_DEFLATER=~{true="true" false="false" useJdkDeflater}
}
output {
File outputVcf = outputVcfPath
File outputVcfIndex = outputVcfPath + ".tbi"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputVCFs: {description: "The VCF files to be merged.", category: "required"}
inputVCFsIndexes: {description: "The indexes of the VCF files.", category: "required"}
outputVcfPath: {description: "The location the output VCF file should be written to.", category: "required"}
compressionLevel: {description: "The compression level at which the BAM files are written.", category: "advanced"}
useJdkInflater: {description: "True, uses the java inflater. False, uses the optimized intel inflater.", category: "advanced"}
useJdkDeflater: {description: "True, uses the java deflator to compress the BAM files. False uses the optimized intel deflater.", category: "advanced"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
outputVcf: {description: "Multiple variant files combined into a single variant file."}
outputVcfIndex: {description: "Index of `outputVcf`."}
}
}
task SamToFastq {
input {
File inputBam
File inputBamIndex
Boolean paired = true
String javaXmx = "16G" # High memory default to avoid crashes.
String memory = "17GiB"
Int timeMinutes = 30
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
File? noneFile
}
String outputRead1 = basename(inputBam, "\.[bs]am") + "_R1.fastq.gz"
String outputRead2 = basename(inputBam, "\.[bs]am") + "_R2.fastq.gz"
String outputUnpaired = basename(inputBam, "\.[bs]am") + "_unpaired.fastq.gz"
command {
set -e
picard -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
SamToFastq \
I=~{inputBam} \
~{"FASTQ=" + outputRead1} \
~{if paired then "SECOND_END_FASTQ=" + outputRead2 else ""} \
~{if paired then "UNPAIRED_FASTQ=" + outputUnpaired else ""}
}
output {
File read1 = outputRead1
File? read2 = if paired then outputRead2 else noneFile
File? unpairedRead = if paired then outputUnpaired else noneFile
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputBam: {description: "Input BAM file to extract reads from.", category: "required"}
inputBamIndex: {description: "Input BAM index file.", category: "required"}
paired: {description: "Set to false when input data is single-end.", category: "common"}
javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
read1: {description: "Fastq file containing reads from the first pair."}
read2: {description: "Fastq file containing reads from the second pair."}
unpairedRead: {description: "Fastq file containing unpaired reads."}
}
meta {
WDL_AID: {
exclude: ["noneFile"]
}
}
}
task ScatterIntervalList {
input {
File interval_list
Int scatter_count
String javaXmx = "3G"
String memory = "4GiB"
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}
command {
set -e
mkdir scatter_list
picard -Xmx~{javaXmx} -XX:ParallelGCThreads=1 \
IntervalListTools \
SCATTER_COUNT=~{scatter_count} \
SUBDIVISION_MODE=BALANCING_WITHOUT_INTERVAL_SUBDIVISION_WITH_OVERFLOW \
UNIQUE=true \
SORT=true \
INPUT=~{interval_list} \
OUTPUT=scatter_list
}
output {
Array[File] out = glob("scatter_list/*/*.interval_list")
Int interval_count = read_int(stdout())
}
runtime {
memory: memory
docker: dockerImage
}
}
task SortSam {
input {
File inputBam
String outputPath
Boolean sortByName = false
Boolean createMd5File = false
Int maxRecordsInRam = 500000
Int compressionLevel = 1
Boolean useJdkInflater = false
Boolean useJdkDeflater = true # Achieves much better compression rates than the intel deflater
# Default ram of 4 GB. Using 125001.0 to prevent an answer of
# 4.000000001 which gets rounded to 5.
# GATK Best practices uses 75000 here: https://github.com/gatk-workflows/broad-prod-wgs-germline-snps-indels/blob/d2934ed656ade44801f9cfe1c0e78d4f80684b7b/PairedEndSingleSampleWf-fc-hg38.wdl#L778
Int XmxGb = ceil(maxRecordsInRam / 125001.0)
Int timeMinutes = 1 + ceil(size(inputBam, "GiB") * 3)
String dockerImage = "quay.io/biocontainers/picard:2.26.10--hdfd78af_0"
}