-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGATK4.wdl
3513 lines (3124 loc) · 104 KB
/
GATK4.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
# MobiDL 2.0 - MobiDL 2 is a collection of tools wrapped in WDL to be used in any WDL pipelines.
# Copyright (C) 2021 MoBiDiC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
task get_version {
meta {
author: "Charles VAN GOETHEM"
email: "c-vangoethem(at)chu-montpellier.fr"
version: "0.0.1"
date: "2020-11-20"
}
input {
String path_exe = "gatk"
Int threads = 1
Int memoryByThreads = 768
String? memory
}
String totalMem = if defined(memory) then memory else memoryByThreads*threads + "M"
Boolean inGiga = (sub(totalMem,"([0-9]+)(M|G)", "$2") == "G")
Int memoryValue = sub(totalMem,"([0-9]+)(M|G)", "$1")
Int totalMemMb = if inGiga then memoryValue*1024 else memoryValue
Int memoryByThreadsMb = floor(totalMemMb/threads)
command <<<
~{path_exe} --version
>>>
output {
String version = read_string(stdout())
}
runtime {
cpu: "~{threads}"
requested_memory_mb_per_core: "${memoryByThreadsMb}"
}
parameter_meta {
path_exe: {
description: 'Path used as executable [default: "gatk"]',
category: 'System'
}
threads: {
description: 'Sets the number of threads [default: 1]',
category: 'System'
}
memory: {
description: 'Sets the total memory to use ; with suffix M/G [default: (memoryByThreads*threads)M]',
category: 'System'
}
memoryByThreads: {
description: 'Sets the total memory to use (in M) [default: 768]',
category: 'System'
}
}
}
task reorderSam {
meta {
author: "Charles VAN GOETHEM"
email: "c-vangoethem(at)chu-montpellier.fr"
version: "0.0.1"
date: "2020-07-27"
}
input {
String path_exe = "gatk"
Array[String]? javaOptions
File in
String? outputPath
String? prefix
String ext = ".bam"
String suffix = "reorder"
File sequenceDict
Boolean allowIncompleteLengthDiscordance = false
Boolean allowIncompleteDictDiscordance = false
Int compressionLevel = 6
Boolean createIndex = false
Boolean createMD5 = false
File? GA4GHClientSecrets
Int maxRecordsInRam = 500000
File? referenceSequence
Boolean quiet = false
File? tmpDir
Boolean useJDKDeflater = false
Boolean useJDKInflater = false
String validationStringency = "STRICT"
String verbosity = "INFO"
Boolean showHidden = false
Int threads = 1
Int memoryByThreads = 768
String? memory
}
String totalMem = if defined(memory) then memory else memoryByThreads*threads + "M"
Boolean inGiga = (sub(totalMem,"([0-9]+)(M|G)", "$2") == "G")
Int memoryValue = sub(totalMem,"([0-9]+)(M|G)", "$1")
Int totalMemMb = if inGiga then memoryValue*1024 else memoryValue
Int memoryByThreadsMb = floor(totalMemMb/threads)
String GA4GHClientSecretsOpt = if defined(GA4GHClientSecrets) then "--GA4GH_CLIENT_SECRETS ~{GA4GHClientSecrets} " else ""
String referenceSequenceOpt = if defined(referenceSequence) then "--REFERENCE_SEQUENCE ~{referenceSequence} " else ""
String outputName = if defined(prefix) then "~{prefix}.~{suffix}~{ext}" else basename(in,ext) + ".~{suffix}~{ext}"
String outputFile = if defined(outputPath) then "~{outputPath}/~{outputName}" else "~{outputName}"
command <<<
if [[ ! -f ~{outputFile} ]]; then
mkdir -p $(dirname ~{outputFile})
fi
~{path_exe} ReorderSam ~{GA4GHClientSecrets}~{referenceSequenceOpt} \
--java-options '~{sep=" " javaOptions}' \
--ALLOW_CONTIG_LENGTH_DISCORDANCE '~{allowIncompleteLengthDiscordance}' \
--ALLOW_INCOMPLETE_DICT_CONCORDANCE '~{allowIncompleteDictDiscordance}' \
--COMPRESSION_LEVEL ~{compressionLevel} \
--CREATE_INDEX '~{createIndex}' \
--CREATE_MD5_FILE '~{createMD5}' \
--MAX_RECORDS_IN_RAM ~{maxRecordsInRam} \
--QUIET '~{quiet}' \
--TMP_DIR ~{default='null' tmpDir} \
--USE_JDK_DEFLATER '~{useJDKDeflater}' \
--USE_JDK_INFLATER '~{useJDKInflater}' \
--VALIDATION_STRINGENCY '~{validationStringency}' \
--VERBOSITY ~{verbosity} \
--showHidden ~{showHidden} \
--INPUT ~{in} \
--SEQUENCE_DICTIONARY ~{sequenceDict} \
--OUTPUT ~{outputFile}
>>>
output {
File outputFile = "~{outputFile}"
}
runtime {
cpu: "~{threads}"
requested_memory_mb_per_core: "${memoryByThreadsMb}"
}
parameter_meta {
path_exe: {
description: 'Path used as executable [default: "gatk"]',
category: 'System'
}
in: {
description: 'Input file (SAM or BAM) to extract reads from..',
category: 'Required'
}
outputPath: {
description: 'Output path where file (SAM or BAM) were generated.',
category: 'Output path/name option'
}
ext: {
description: 'Extension of the input file (".sam" or ".bam") [default: ".bam"]',
category: 'Tool option'
}
prefix: {
description: 'Prefix for the output file [default: basename(in, ext)]',
category: 'Output path/name option'
}
suffix: {
description: 'Suffix for the output file (e.g. sample.suffix.bam) [default: "reorder"]',
category: 'Output path/name option'
}
sequenceDict: {
description: 'Sequence Dictionary for the OUTPUT file (can be read from one of the following file types (SAM, BAM, VCF, BCF, Interval List, Fasta, or Dict)',
category: 'Required'
}
allowIncompleteLengthDiscordance: {
description: 'If true, then permits mapping from a read contig to a new reference contig with the same name but a different length. Highly dangerous, only use if you know what you are doing. [Default: false]',
category: 'Tool option'
}
allowIncompleteDictDiscordance: {
description: 'If true, allows only a partial overlap of the original contigs with the new reference sequence contigs. By default, this tool requires a corresponding contig in the new reference for each read contig. [Default: false]',
category: 'Tool option'
}
compressionLevel: {
description: 'Compression level for all compressed files created (e.g. BAM and VCF). [default: 6]',
category: 'Tool option'
}
createIndex: {
description: 'Whether to create a BAM index when writing a coordinate-sorted BAM file. [Default: false]',
category: 'Tool option'
}
createMD5: {
description: 'Whether to create an MD5 digest for any BAM or FASTQ files created. [Default: false]',
category: 'Tool option'
}
GA4GHClientSecrets: {
description: 'Google Genomics API client_secrets.json file path. [Default: null]',
category: 'Tool option'
}
maxRecordsInRam: {
description: 'When writing files that need to be sorted, this will specify the number of records stored in RAM before spilling to disk. Increasing this number reduces the number of file handles needed to sort the file, and increases the amount of RAM needed. [Default: 500000]',
category: 'Tool option'
}
referenceSequence: {
description: 'Reference sequence file. [Default: null]',
category: 'Tool option'
}
quiet: {
description: 'Whether to suppress job-summary info on System.err. [Default: false]',
category: 'Tool option'
}
tmpDir: {
description: 'Path to a directory with space available to be used by this program for temporary storage of working files. [Default: null]',
category: 'Tool option'
}
useJDKDeflater: {
description: 'Use the JDK Deflater instead of the Intel Deflater for writing compressed output. [Default: false]',
category: 'Tool option'
}
useJDKInflater: {
description: 'Use the JDK Inflater instead of the Intel Inflater for reading compressed input. [Default: false]',
category: 'Tool option'
}
validationStringency: {
description: ' Validation stringency for all SAM files read by this program. Setting stringency to SILENT can improve performance when processing a BAM file in which variable-length data (read, qualities, tags) do not otherwise need to be decoded. [Default: "STRIC"]',
category: 'Tool option'
}
verbosity: {
description: 'Control verbosity of logging. [Default: "INFO"]',
category: 'Tool option'
}
showHidden: {
description: 'Display hidden arguments. [Default: false]',
category: 'Tool option'
}
threads: {
description: 'Sets the number of threads [default: 1]',
category: 'System'
}
memory: {
description: 'Sets the total memory to use ; with suffix M/G [default: (memoryByThreads*threads)M]',
category: 'System'
}
memoryByThreads: {
description: 'Sets the total memory to use (in M) [default: 768]',
category: 'System'
}
}
}
### WARNING : depthOfCoverage is on BETA
## --calculate-coverage-over-genes,-gene-list: option seems not working
## properly : https://github.com/broadinstitute/gatk/issues/6714
## --count-type: only "COUNT_READS" is supported
task depthOfCoverage {
meta {
author: "Charles VAN GOETHEM"
email: "c-vangoethem(at)chu-montpellier.fr"
version: "0.0.1b"
date: "2020-07-27"
}
input {
String path_exe = "gatk"
Array[String]? javaOptions
File in
File bamIndex
File intervals
String? outputPath
String? prefix
String ext = ".bam"
String suffix = "DoC"
File referenceFasta
File referenceFai
File referenceDict
File? geneList
String countType = "COUNT_READS"
Boolean disableBamIndexCaching = false
Boolean disableSequenceDictionaryValidation = false
String intervalMergingRule = "ALL"
Int maxBaseQuality = 127
Int minBaseQuality = 0
Int maxDepthPerSample = 0
String outputFormat = "CSV"
String partitionType = "sample"
Boolean printBaseCounts = false
Boolean quiet = false
File? tmpDir
Boolean useJDKDeflater = false
Boolean useJDKInflater = false
String validationStringency = "SILENT"
String verbosity = "INFO"
Boolean showHidden = false
Array[Int] summaryCoverageThreshold = [5]
Int threads = 1
Int memoryByThreads = 768
String? memory
}
String totalMem = if defined(memory) then memory else memoryByThreads*threads + "M"
Boolean inGiga = (sub(totalMem,"([0-9]+)(M|G)", "$2") == "G")
Int memoryValue = sub(totalMem,"([0-9]+)(M|G)", "$1")
Int totalMemMb = if inGiga then memoryValue*1024 else memoryValue
Int memoryByThreadsMb = floor(totalMemMb/threads)
Array[String] summaryCoverageThresholdOpt = prefix("--summary-coverage-threshold ", summaryCoverageThreshold)
String outputName = if defined(prefix) then "~{prefix}.~{suffix}" else basename(in,ext) + ".~{suffix}"
String outputFile = if defined(outputPath) then "~{outputPath}/~{outputName}" else "~{outputName}"
command <<<
if [[ ! -f ~{outputFile} ]]; then
mkdir -p $(dirname ~{outputFile})
fi
~{path_exe} DepthOfCoverage \
--java-options '~{sep=" " javaOptions}' \
--calculate-coverage-over-genes ~{default='null' geneList} \
--count-type ~{countType} \
--disable-bam-index-caching ~{disableBamIndexCaching} \
--disable-sequence-dictionary-validation ~{disableSequenceDictionaryValidation} \
--interval-merging-rule ~{intervalMergingRule} \
--max-base-quality ~{maxBaseQuality} \
--max-depth-per-sample ~{maxDepthPerSample} \
--min-base-quality ~{minBaseQuality} \
--output-format ~{outputFormat} \
--partition-type ~{partitionType} \
--print-base-counts ~{printBaseCounts} \
--QUIET '~{quiet}' \
--use-jdk-deflater '~{useJDKDeflater}' \
--use-jdk-inflater '~{useJDKInflater}' \
--read-validation-stringency '~{validationStringency}' \
--verbosity ~{verbosity} \
--showHidden ~{showHidden} \
--input ~{in} \
--intervals ~{intervals} \
--reference ~{referenceFasta} \
--output ~{outputFile} \
~{sep=" " summaryCoverageThresholdOpt}
>>>
output {
File outputFile = "~{outputFile}"
}
runtime {
cpu: "~{threads}"
requested_memory_mb_per_core: "${memoryByThreadsMb}"
}
parameter_meta {
path_exe: {
description: 'Path used as executable [default: "gatk"]',
category: 'System'
}
in: {
description: 'BAM/SAM/CRAM file containing reads.',
category: 'Required'
}
intervals: {
description: 'Path to a file containing genomic intervals over which to operate. (format intervals list: chr1:1000-2000)',
category: 'Required'
}
outputPath: {
description: 'Output path where files were generated.',
category: 'Output path/name option'
}
ext: {
description: 'Extension of the input file (".sam" or ".bam") [default: ".bam"]',
category: 'Tool option'
}
prefix: {
description: 'Prefix for the output file [default: basename(in, ext)]',
category: 'Output path/name option'
}
suffix: {
description: 'Suffix for the output file (e.g. prefix.suffix.bam) [default: "DoC"]',
category: 'Output path/name option'
}
referenceFasta: {
description: 'Path to the reference file (format: fasta)',
category: 'Required'
}
referenceFai: {
description: 'Path to the reference file index (format: fai)',
category: 'Required'
}
referenceDict: {
description: 'Path to the reference file dict (format: dict)',
category: 'Required'
}
geneList: {
description: 'Calculate coverage statistics over this list of genes. (refseq format)',
category: 'Tool option'
}
countType: {
description: 'How should overlapping reads from the same fragment be handled? (Possible values: {COUNT_READS, COUNT_FRAGMENTS, COUNT_FRAGMENTS_REQUIRE_SAME_BASE}) [default: COUNT_READS]',
category: 'Tool option'
}
disableBamIndexCaching: {
description: "If true, don't cache bam indexes, this will reduce memory requirements but may harm performance if many intervals are specified. Caching is automatically disabled if there are no intervals specified. [default: false]",
category: 'Tool option'
}
disableSequenceDictionaryValidation: {
description: 'If specified, do not check the sequence dictionaries from our inputs for compatibility. Use at your own risk! [default: false]',
category: 'Tool option'
}
intervalMergingRule: {
description: 'Interval merging rule for abutting intervals. (possible values: ALL, OVERLAPPING_ONLY) [default: ALL]',
category: 'Tool option'
}
maxBaseQuality: {
description: 'Maximum quality of bases to count towards depth. [default: 127]',
category: 'Tool option'
}
minBaseQuality: {
description: 'Minimum quality of bases to count towards depth. [default: 0]',
category: 'Tool option'
}
maxDepthPerSample: {
description: 'Maximum number of reads to retain per sample per locus. Reads above this threshold will be downsampled. Set to 0 to disable. [default: 0]',
category: 'Tool option'
}
outputFormat: {
description: 'The format of the output file. (possible values: CSV, TABLE) [default: CSV]',
category: 'Tool option'
}
partitionType: {
description: 'Partition type for depth of coverage. (possbile values: sample, readgroup and/or library) [default: sample]',
category: 'Tool option'
}
printBaseCounts: {
description: 'Add base counts to per-locus output. [default: false]',
category: 'Tool option'
}
quiet: {
description: 'Whether to suppress job-summary info on System.err. [Default: false]',
category: 'Tool option'
}
tmpDir: {
description: 'Path to a directory with space available to be used by this program for temporary storage of working files. [Default: null]',
category: 'Tool option'
}
useJDKDeflater: {
description: 'Use the JDK Deflater instead of the Intel Deflater for writing compressed output. [Default: false]',
category: 'Tool option'
}
useJDKInflater: {
description: 'Use the JDK Inflater instead of the Intel Inflater for reading compressed input. [Default: false]',
category: 'Tool option'
}
validationStringency: {
description: ' Validation stringency for all SAM files read by this program. Setting stringency to SILENT can improve performance when processing a BAM file in which variable-length data (read, qualities, tags) do not otherwise need to be decoded. [Default: "STRIC"]',
category: 'Tool option'
}
verbosity: {
description: 'Control verbosity of logging. [Default: "INFO"]',
category: 'Tool option'
}
showHidden: {
description: 'Display hidden arguments. [Default: false]',
category: 'Tool option'
}
threads: {
description: 'Sets the number of threads [default: 1]',
category: 'System'
}
memory: {
description: 'Sets the total memory to use ; with suffix M/G [default: (memoryByThreads*threads)M]',
category: 'System'
}
memoryByThreads: {
description: 'Sets the total memory to use (in M) [default: 768]',
category: 'System'
}
}
}
task splitIntervals {
meta {
author: "Charles VAN GOETHEM"
email: "c-vangoethem(at)chu-montpellier.fr"
version: "0.0.1"
date: "2020-08-06"
}
input {
String path_exe = "gatk"
File in
String? outputPath
String? name
String subString = "\.([a-zA-Z]*)$"
String subStringReplace = "-split"
File refFasta
File refFai
File refDict
Int scatterCount = 1
String subdivisionMode = "INTERVAL_SUBDIVISION"
Int intervalsPadding = 0
Boolean overlappingRule = false
Boolean intersectionRule = false
Int threads = 1
Int memoryByThreads = 768
String? memory
}
String totalMem = if defined(memory) then memory else memoryByThreads*threads + "M"
Boolean inGiga = (sub(totalMem,"([0-9]+)(M|G)", "$2") == "G")
Int memoryValue = sub(totalMem,"([0-9]+)(M|G)", "$1")
Int totalMemMb = if inGiga then memoryValue*1024 else memoryValue
Int memoryByThreadsMb = floor(totalMemMb/threads)
String baseName = if defined(name) then name else sub(basename(in),subString,subStringReplace)
String outputRep = if defined(outputPath) then "~{outputPath}/~{baseName}" else "~{baseName}"
command <<<
if [[ ! -d $(dirname ~{outputRep}) ]]; then
mkdir -p $(dirname ~{outputRep})
fi
~{path_exe} SplitIntervals \
--intervals ~{in} \
--reference ~{refFasta} \
--scatter-count ~{scatterCount} \
--subdivision-mode ~{subdivisionMode} \
--interval-padding ~{intervalsPadding} \
--interval-merging-rule ~{true="OVERLAPPING_ONLY" false="ALL" overlappingRule} \
--interval-set-rule ~{true="INTERSECTION" false="UNION" intersectionRule} \
--output ~{outputRep}
>>>
output {
Array[File] splittedIntervals = glob("~{outputRep}/*-scattered.interval_list")
}
runtime {
cpu: "~{threads}"
requested_memory_mb_per_core: "${memoryByThreadsMb}"
}
parameter_meta {
path_exe: {
description: 'Path used as executable [default: "gatk"]',
category: 'System'
}
in: {
description: 'Path to a file containing genomic intervals over which to operate. (format intervals list: chr1:1000-2000)',
category: 'Required'
}
outputPath: {
description: 'Output path where files were generated.',
category: 'Output path/name option'
}
name: {
description: 'Output repertory name [default: sub(basename(in),"\.([a-zA-Z]*)$","")].',
category: 'Output path/name option'
}
subString: {
description: 'Extension to remove from the input file [default: "\.([a-zA-Z]*)$"]',
category: 'Output path/name option'
}
subStringReplace: {
description: 'subString replace by this string [default: "-split"]',
category: 'Output path/name option'
}
refFasta: {
description: 'Path to the reference file (format: fasta)',
category: 'Required'
}
refFai: {
description: 'Path to the reference file index (format: fai)',
category: 'Required'
}
refDict: {
description: 'Path to the reference file dict (format: dict)',
category: 'Required'
}
scatterCount: {
description: 'Scatter count: number of output interval files to split into [default: 1]',
category: 'Tool option'
}
subdivisionMode: {
description: 'How to divide intervals {INTERVAL_SUBDIVISION, BALANCING_WITHOUT_INTERVAL_SUBDIVISION, BALANCING_WITHOUT_INTERVAL_SUBDIVISION_WITH_OVERFLOW, INTERVAL_COUNT}. [default: INTERVAL_SUBDIVISION]',
category: 'Tool option'
}
intervalsPadding: {
description: 'Amount of padding (in bp) to add to each interval you are including. [default: 0]',
category: 'Tool option'
}
overlappingRule: {
description: 'Interval merging rule for abutting intervals set to OVERLAPPING_ONLY [default: false => ALL]',
category: 'Tool option'
}
intersectionRule: {
description: 'Set merging approach to use for combining interval inputs to INTERSECTION [default: false => UNION]',
category: 'Tool option'
}
threads: {
description: 'Sets the number of threads [default: 1]',
category: 'System'
}
memory: {
description: 'Sets the total memory to use ; with suffix M/G [default: (memoryByThreads*threads)M]',
category: 'System'
}
memoryByThreads: {
description: 'Sets the total memory to use (in M) [default: 768]',
category: 'System'
}
}
}
task baseRecalibrator {
meta {
author: "Charles VAN GOETHEM"
email: "c-vangoethem(at)chu-montpellier.fr"
version: "0.0.2"
date: "2021-02-23"
}
input {
String path_exe = "gatk"
File in
File bamIdx
String? outputPath
String? name
File? intervals
String subString_intervals = "([0-9]+)-scattered.interval_list"
String subStringReplace_intervals = "$1"
String ext = ".recal"
Array[File]+ knownSites
Array[File]+ knownSitesIdx
File refFasta
File refFai
File refDict
Int gapPenality = 40
Int indelDefaultQual = 45
Int lowQualTail = 2
Int indelKmer = 3
Int mismatchKmer = 2
Int maxCycle = 500
Boolean overlappingRule = false
Int intervalsPadding = 0
Boolean intersectionRule = false
Int threads = 1
Int memoryByThreads = 768
String? memory
}
String totalMem = if defined(memory) then memory else memoryByThreads*threads + "M"
Boolean inGiga = (sub(totalMem,"([0-9]+)(M|G)", "$2") == "G")
Int memoryValue = sub(totalMem,"([0-9]+)(M|G)", "$1")
Int totalMemMb = if inGiga then memoryValue*1024 else memoryValue
Int memoryByThreadsMb = floor(totalMemMb/threads)
String baseNameIntervals = if defined(intervals) then intervals else ""
String baseIntervals = if defined(intervals) then sub(basename(baseNameIntervals),subString_intervals,subStringReplace_intervals) else ""
String baseName = if defined(name) then name else sub(basename(in),"\.(sam|bam|cram)$","")
String outputFile = if defined(outputPath) then "~{outputPath}/~{baseName}.~{baseIntervals}~{ext}" else "~{baseName}.~{baseIntervals}~{ext}"
command <<<
if [[ ! -d $(dirname ~{outputFile}) ]]; then
mkdir -p $(dirname ~{outputFile})
fi
~{path_exe} BaseRecalibrator \
--input ~{in} \
--known-sites ~{sep=" --known-sites " knownSites} \
--reference ~{refFasta} \
~{default="" "--intervals " + intervals} \
--bqsr-baq-gap-open-penalty ~{gapPenality} \
--deletions-default-quality ~{indelDefaultQual} \
--insertions-default-quality ~{indelDefaultQual} \
--low-quality-tail ~{lowQualTail} \
--indels-context-size ~{indelKmer} \
--mismatches-context-size ~{mismatchKmer} \
--maximum-cycle-value ~{maxCycle} \
--interval-padding ~{intervalsPadding} \
--interval-merging-rule ~{true="OVERLAPPING_ONLY" false="ALL" overlappingRule} \
--interval-set-rule ~{true="INTERSECTION" false="UNION" intersectionRule} \
--output ~{outputFile}
>>>
output {
File outputFile = outputFile
}
runtime {
cpu: "~{threads}"
requested_memory_mb_per_core: "${memoryByThreadsMb}"
}
parameter_meta {
path_exe: {
description: 'Path used as executable [default: "gatk"]',
category: 'System'
}
in: {
description: 'Alignement file to recalibrate (SAM/BAM/CRAM)',
category: 'Required'
}
bamIdx: {
description: 'Index for the alignement input file to recalibrate.',
category: 'Required'
}
intervals: {
description: 'Path to a file containing genomic intervals over which to operate. (format intervals list: chr1:1000-2000)',
category: 'Tool option'
}
subString_intervals: {
description: 'Substring to replace for intervals files (e.g. remove extension) [default: "([0-9]+)-scattered.interval_list"]',
category: 'Output path/name option'
}
subStringReplace_intervals: {
description: 'Substring used to replace for intervals files (e.g. add a suffix) [default: "$1"]',
category: 'Output path/name option'
}
outputPath: {
description: 'Output path where bqsr report will be generated.',
category: 'Output path/name option'
}
name: {
description: 'Output file base name [default: sub(basename(in),"\.(sam|bam|cram)$","")].',
category: 'Output path/name option'
}
ext: {
description: 'Extension for the output file [default: ".recal"]',
category: 'Output path/name option'
}
knownSites: {
description: 'One or more databases of known polymorphic sites used to exclude regions around known polymorphisms from analysis.',
category: 'Tool option'
}
knownSitesIdx: {
description: 'Indexes of the inputs known sites.',
category: 'Tool option'
}
refFasta: {
description: 'Path to the reference file (format: fasta)',
category: 'Required'
}
refFai: {
description: 'Path to the reference file index (format: fai)',
category: 'Required'
}
refDict: {
description: 'Path to the reference file dict (format: dict)',
category: 'Required'
}
gapPenality: {
description: 'BQSR BAQ gap open penalty (Phred Scaled). Default value is 40. 30 is perhaps better for whole genome call sets [default: 40]',
category: 'Tool option'
}
indelDefaultQual: {
description: 'Default quality for the base insertions/deletions covariate [default: 45]',
category: 'Tool option'
}
lowQualTail: {
description: 'Minimum quality for the bases in the tail of the reads to be considered [default: 2]',
category: 'Tool option'
}
indelKmer: {
description: 'Size of the k-mer context to be used for base insertions and deletions [default: 3]',
category: 'Tool option'
}
mismatchKmer: {
description: 'Size of the k-mer context to be used for base mismatches [default: 2]',
category: 'Tool option'
}
maxCycle: {
description: 'The maximum cycle value permitted for the Cycle covariate [default: 500]',
category: 'Tool option'
}
intervalsPadding: {
description: 'Amount of padding (in bp) to add to each interval you are including. [default: 0]',
category: 'Tool option'
}
overlappingRule: {
description: 'Interval merging rule for abutting intervals set to OVERLAPPING_ONLY [default: false => ALL]',
category: 'Tool option'
}
intersectionRule: {
description: 'Set merging approach to use for combining interval inputs to INTERSECTION [default: false => UNION]',
category: 'Tool option'
}
threads: {
description: 'Sets the number of threads [default: 1]',
category: 'System'
}
memory: {
description: 'Sets the total memory to use ; with suffix M/G [default: (memoryByThreads*threads)M]',
category: 'System'
}
memoryByThreads: {
description: 'Sets the total memory to use (in M) [default: 768]',
category: 'System'
}
}
}
task gatherBQSRReports {
meta {
author: "Charles VAN GOETHEM"
email: "c-vangoethem(at)chu-montpellier.fr"
version: "0.0.2"
date: "2020-12-23"
}
input {
String path_exe = "gatk"
Array[File]+ in
String? outputPath
String? name
String subString = "(\.[0-9]+)?\.recal$"
String subStringReplace = ""
String ext = ".bqsr.report"
Int threads = 1
Int memoryByThreads = 768
String? memory
}
String totalMem = if defined(memory) then memory else memoryByThreads*threads + "M"
Boolean inGiga = (sub(totalMem,"([0-9]+)(M|G)", "$2") == "G")
Int memoryValue = sub(totalMem,"([0-9]+)(M|G)", "$1")
Int totalMemMb = if inGiga then memoryValue*1024 else memoryValue
Int memoryByThreadsMb = floor(totalMemMb/threads)
String firstFile = basename(in[0])
String baseName = if defined(name) then name else sub(basename(firstFile),subString,subStringReplace)
String outputFile = if defined(outputPath) then "~{outputPath}/~{baseName}~{ext}" else "~{baseName}~{ext}"
command <<<
if [[ ! -d $(dirname ~{outputFile}) ]]; then
mkdir -p $(dirname ~{outputFile})
fi
~{path_exe} GatherBQSRReports \
--input ~{sep=" --input " in} \
--output ~{outputFile}
>>>
output {
File outputFile = outputFile
}
runtime {
cpu: "~{threads}"
requested_memory_mb_per_core: "${memoryByThreadsMb}"
}
parameter_meta {
path_exe: {
description: 'Path used as executable [default: "gatk"]',
category: 'System'
}
in: {
description: 'List of scattered BQSR report files',
category: 'Required'
}
outputPath: {
description: 'Output path where bqsr report will be generated.',
category: 'Output path/name option'
}
name: {
description: 'Output file base name [default: sub(basename(firstFile),subString,"")].',
category: 'Output path/name option'
}
ext: {
description: 'Extension for the output file [default: ".bqsr.report"]',
category: 'Output path/name option'
}
subString: {
description: 'Extension to remove from the input file [default: "(\.[0-9]+)?\.recal$"]',
category: 'Output path/name option'
}
subStringReplace: {
description: 'Substring used to replace (e.g. add a suffix) [default: ""]',
category: 'Output path/name option'
}
threads: {
description: 'Sets the number of threads [default: 1]',
category: 'System'
}
memory: {
description: 'Sets the total memory to use ; with suffix M/G [default: (memoryByThreads*threads)M]',
category: 'System'
}
memoryByThreads: {
description: 'Sets the total memory to use (in M) [default: 768]',
category: 'System'
}
}
}
task applyBQSR {
meta {
author: "Charles VAN GOETHEM"
email: "c-vangoethem(at)chu-montpellier.fr"
version: "0.0.2"
date: "2021-02-23"
}
input {
String path_exe = "gatk"
File in
File bamIdx
File bqsrReport
File? intervals
String subString_intervals = "([0-9]+)-scattered.interval_list"
String subStringReplace_intervals = "$1"
String? outputPath
String? name
String suffix = ".bqsr"
File refFasta
File refFai
File refDict
Boolean originalQScore = false
Int globalQScorePrior = -1
Int preserveQScoreLT = 6
Int quantizeQual = 0
Boolean overlappingRule = false
Int intervalsPadding = 0
Boolean intersectionRule = false
Boolean bamIndex = true
Boolean bamMD5 = true
Int threads = 1
Int memoryByThreads = 768
String? memory
}
String totalMem = if defined(memory) then memory else memoryByThreads*threads + "M"
Boolean inGiga = (sub(totalMem,"([0-9]+)(M|G)", "$2") == "G")
Int memoryValue = sub(totalMem,"([0-9]+)(M|G)", "$1")
Int totalMemMb = if inGiga then memoryValue*1024 else memoryValue
Int memoryByThreadsMb = floor(totalMemMb/threads)
String baseNameIntervals = if defined(intervals) then intervals else ""
String baseIntervals = if defined(intervals) then sub(basename(baseNameIntervals),subString_intervals,subStringReplace_intervals) else ""
String baseName = if defined(name) then name else sub(basename(in),"(.*)\.(sam|bam|cram)$","$1")
String ext = sub(basename(in),"(.*)\.(sam|bam|cram)$","$2")
String outputBamFile = if defined(outputPath) then "~{outputPath}/~{baseName}~{suffix}.~{baseIntervals}\.~{ext}" else "~{baseName}~{suffix}.~{baseIntervals}\.~{ext}"
String outputBaiFile = sub(outputBamFile,"(m)$","i")
command <<<
if [[ ! -d $(dirname ~{outputBamFile}) ]]; then
mkdir -p $(dirname ~{outputBamFile})
fi
~{path_exe} ApplyBQSR \
--input ~{in} \