-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmito-pipeline.cwl.json
8943 lines (8943 loc) · 445 KB
/
mito-pipeline.cwl.json
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
{
"class": "Workflow",
"cwlVersion": "v1.2",
"label": "mitochondria-pipeline",
"$namespaces": {
"sbg": "https://sevenbridges.com"
},
"inputs": [
{
"id": "ref_fasta",
"sbg:fileTypes": "FASTA",
"type": "File?",
"secondaryFiles": [
{
"pattern": ".fai",
"required": true
},
{
"pattern": "^.dict",
"required": true
}
],
"sbg:x": 0,
"sbg:y": 284.34375
},
{
"id": "cram",
"type": "File?",
"secondaryFiles": [
{
"pattern": ".crai",
"required": true
}
],
"sbg:x": 0,
"sbg:y": 391.515625
},
{
"id": "reference_index_tar",
"sbg:fileTypes": "TAR",
"type": "File",
"label": "Non shifted Reference Index TAR",
"doc": "Reference fasta file with its BWA index files packed in a TAR archive.",
"sbg:x": 0,
"sbg:y": 177.171875
},
{
"id": "shifted_reference_index_tar",
"sbg:fileTypes": "TAR",
"type": "File",
"label": "Shifted Reference Index TAR",
"doc": "Reference fasta file with its BWA index files packed in a TAR archive.",
"sbg:x": 0,
"sbg:y": 70
},
{
"id": "in_reference_and_index",
"sbg:fileTypes": "FASTA, FA",
"type": "File",
"label": "Shifted Reference FASTA and index",
"doc": "Reference FASTA or FA sequence file and associated index and dict.",
"secondaryFiles": [
{
"pattern": ".fai",
"required": true
},
{
"pattern": "^.dict",
"required": true
}
],
"sbg:x": 992.677978515625,
"sbg:y": 163.171875
},
{
"id": "in_reference_and_index_1",
"sbg:fileTypes": "FASTA, FA",
"type": "File",
"label": "Non ShiftedReference FASTA and index",
"doc": "Reference FASTA or FA sequence file and associated index and dict.",
"secondaryFiles": [
{
"pattern": ".fai",
"required": true
},
{
"pattern": "^.dict",
"required": true
}
],
"sbg:x": 992.677978515625,
"sbg:y": 56
}
],
"outputs": [
{
"id": "theoretical_sensitivity_out_file",
"outputSource": [
"picard_collectwgsmetricswithnonzerocoverage_2_21_6_cwl1_2/theoretical_sensitivity_out_file",
"picard_collectwgsmetricswithnonzerocoverage_2_21_6_cwl1_2/wgs_metrics",
"picard_collectwgsmetricswithnonzerocoverage_2_21_6_cwl1_2/output_chart"
],
"type": "File?",
"label": "Theoretical sensitivity output file",
"doc": "Theoretical sensitivity output file.",
"sbg:x": 1551.78955078125,
"sbg:y": -9.155171394348145
},
{
"id": "out_variants",
"outputSource": [
"gatk_mutect2_shifted_mt/out_variants",
"gatk_mutect2_shifted_mt/out_stats",
"gatk_mutect2_shifted_mt/out_alignments",
"gatk_mutect2_shifted_mt/f1r2_counts"
],
"type": "File?",
"label": "Output variants",
"doc": "Output variants in VCF or VCF.GZ format.",
"sbg:x": 1556.78955078125,
"sbg:y": 281.84869384765625
},
{
"id": "out_variants_1",
"outputSource": [
"gatk_mutect2_non_shifted_mt/out_variants",
"gatk_mutect2_non_shifted_mt/out_stats",
"gatk_mutect2_non_shifted_mt/out_alignments",
"gatk_mutect2_non_shifted_mt/f1r2_counts"
],
"type": "File?",
"label": "Output variants",
"doc": "Output variants in VCF or VCF.GZ format.",
"sbg:x": 1535.40625,
"sbg:y": 417.4424133300781
},
{
"id": "wgs_metrics",
"outputSource": [
"picard_collectwgsmetricswithnonzerocoverage_2_21_6_cwl1_1/wgs_metrics",
"picard_collectwgsmetricswithnonzerocoverage_2_21_6_cwl1_1/theoretical_sensitivity_out_file",
"picard_collectwgsmetricswithnonzerocoverage_2_21_6_cwl1_1/output_chart"
],
"type": "File?",
"label": "WGS metrics",
"doc": "Output metrics file.",
"sbg:x": 1559.19970703125,
"sbg:y": 117.27950286865234
}
],
"steps": [
{
"id": "subset_bam_to_chrom_m",
"in": [
{
"id": "cram",
"source": "cram"
},
{
"id": "contig_name",
"default": "chrM"
},
{
"id": "ref_fasta",
"source": "ref_fasta"
}
],
"out": [
{
"id": "chrM_bam"
}
],
"run": {
"class": "CommandLineTool",
"cwlVersion": "v1.2",
"$namespaces": {
"sbg": "https://sevenbridges.com"
},
"id": "dave/build-mitochondria-pipeline/subset-bam-to-chrom-m/5",
"baseCommand": [
"gatk",
"PrintReads",
"--read-filter",
"MateOnSameContigOrNoMappedMateReadFilter",
"--read-filter",
"MateUnmappedAndUnmappedReadFilter"
],
"inputs": [
{
"id": "cram",
"type": "File?",
"inputBinding": {
"prefix": "-I",
"shellQuote": false,
"position": 0
},
"secondaryFiles": [
{
"pattern": ".crai",
"required": true
}
]
},
{
"id": "contig_name",
"type": "string?",
"inputBinding": {
"prefix": "-L",
"shellQuote": false,
"position": 0
}
},
{
"id": "ref_fasta",
"type": "File?",
"inputBinding": {
"prefix": "-R",
"shellQuote": false,
"position": 0
},
"sbg:fileTypes": "FASTA",
"secondaryFiles": [
{
"pattern": ".fai",
"required": true
},
{
"pattern": "^.dict",
"required": true
}
]
}
],
"outputs": [
{
"id": "chrM_bam",
"type": "File?",
"outputBinding": {
"glob": "*.bam"
},
"secondaryFiles": [
{
"pattern": "*.bam.bai",
"required": false
}
]
}
],
"label": "subset-bam-to-chrom-m",
"arguments": [
{
"prefix": "--read-index",
"shellQuote": false,
"position": 0,
"valueFrom": "$(inputs.cram.path + \".crai\")"
},
{
"prefix": "-O",
"shellQuote": false,
"position": 0,
"valueFrom": "$(inputs.cram.nameroot + \"_chrM.bam\")"
}
],
"requirements": [
{
"class": "ShellCommandRequirement"
},
{
"class": "DockerRequirement",
"dockerPull": "us.gcr.io/broad-gatk/gatk:4.1.7.0"
},
{
"class": "InitialWorkDirRequirement",
"listing": [
{
"entryname": "original.wdl",
"entry": "task SubsetBamToChrM {\n input {\n File input_bam\n File input_bai\n String contig_name\n String basename = basename(basename(input_bam, \".cram\"), \".bam\")\n String? requester_pays_project\n File? ref_fasta\n File? ref_fasta_index\n File? ref_dict\n\n File? gatk_override\n String? gatk_docker_override\n\n # runtime\n Int? preemptible_tries\n }\n Float ref_size = if defined(ref_fasta) then size(ref_fasta, \"GB\") + size(ref_fasta_index, \"GB\") + size(ref_dict, \"GB\") else 0\n Int disk_size = ceil(size(input_bam, \"GB\") + ref_size) + 20\n\n meta {\n description: \"Subsets a whole genome bam to just Mitochondria reads\"\n }\n parameter_meta {\n ref_fasta: \"Reference is only required for cram input. If it is provided ref_fasta_index and ref_dict are also required.\"\n input_bam: {\n localization_optional: true\n }\n input_bai: {\n localization_optional: true\n }\n }\n command <<<\n set -e\n export GATK_LOCAL_JAR=~{default=\"/root/gatk.jar\" gatk_override}\n\n gatk PrintReads \\\n ~{\"-R \" + ref_fasta} \\\n -L ~{contig_name} \\\n --read-filter MateOnSameContigOrNoMappedMateReadFilter \\\n --read-filter MateUnmappedAndUnmappedReadFilter \\\n ~{\"--gcs-project-for-requester-pays \" + requester_pays_project} \\\n -I ~{input_bam} \\\n --read-index ~{input_bai} \\\n -O ~{basename}.bam\n >>>\n runtime {\n memory: \"3 GB\"\n disks: \"local-disk \" + disk_size + \" HDD\"\n docker: select_first([gatk_docker_override, \"us.gcr.io/broad-gatk/gatk:4.1.7.0\"])\n preemptible: select_first([preemptible_tries, 5])\n }\n output {\n File output_bam = \"~{basename}.bam\"\n File output_bai = \"~{basename}.bai\"\n }\n}\nd",
"writable": false
}
]
},
{
"class": "InlineJavascriptRequirement"
}
],
"sbg:projectName": "BUILD: Mitochondria Pipeline",
"sbg:revisionsInfo": [
{
"sbg:revision": 0,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1620309846,
"sbg:revisionNotes": null
},
{
"sbg:revision": 1,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1620309931,
"sbg:revisionNotes": ""
},
{
"sbg:revision": 2,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1621978713,
"sbg:revisionNotes": ""
},
{
"sbg:revision": 3,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1621979134,
"sbg:revisionNotes": ""
},
{
"sbg:revision": 4,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1621979192,
"sbg:revisionNotes": "FASTA"
},
{
"sbg:revision": 5,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1621989342,
"sbg:revisionNotes": ""
}
],
"sbg:image_url": null,
"sbg:appVersion": [
"v1.2"
],
"sbg:id": "dave/build-mitochondria-pipeline/subset-bam-to-chrom-m/5",
"sbg:revision": 5,
"sbg:revisionNotes": "",
"sbg:modifiedOn": 1621989342,
"sbg:modifiedBy": "dave",
"sbg:createdOn": 1620309846,
"sbg:createdBy": "dave",
"sbg:project": "dave/build-mitochondria-pipeline",
"sbg:sbgMaintained": false,
"sbg:validationErrors": [],
"sbg:contributors": [
"dave"
],
"sbg:latestRevision": 5,
"sbg:publisher": "sbg",
"sbg:content_hash": "a8ed2320b344c2a12c20404c9b7c638c05da2197f2c4f07f88e58576eaf576320"
},
"label": "subset-bam-to-chrom-m",
"sbg:x": 276.5,
"sbg:y": 223.7578125
},
{
"id": "revert_sam",
"in": [
{
"id": "bam",
"source": "subset_bam_to_chrom_m/chrM_bam"
}
],
"out": [
{
"id": "unaligned_bam"
}
],
"run": {
"class": "CommandLineTool",
"cwlVersion": "v1.2",
"$namespaces": {
"sbg": "https://sevenbridges.com"
},
"id": "dave/build-mitochondria-pipeline/revert-sam/5",
"baseCommand": [
"java",
"-Xmx1000m",
"-jar",
"/usr/gitc/picard.jar",
"RevertSam",
"OUTPUT_BY_READGROUP=false",
"VALIDATION_STRINGENCY=LENIENT",
"ATTRIBUTE_TO_CLEAR=FT",
"ATTRIBUTE_TO_CLEAR=CO",
"SORT_ORDER=queryname",
"RESTORE_ORIGINAL_QUALITIES=false"
],
"inputs": [
{
"id": "bam",
"type": "File",
"inputBinding": {
"prefix": "INPUT=",
"separate": false,
"shellQuote": false,
"position": 0
},
"sbg:fileTypes": "BAM",
"secondaryFiles": [
{
"pattern": ".bai",
"required": false
}
]
}
],
"outputs": [
{
"id": "unaligned_bam",
"type": "File?",
"outputBinding": {
"glob": "*.bam"
}
}
],
"label": "revert-sam",
"arguments": [
{
"prefix": "OUTPUT=",
"separate": false,
"shellQuote": false,
"position": 0,
"valueFrom": "$(inputs.bam.nameroot + \"_u\" + \".bam\")"
}
],
"requirements": [
{
"class": "ShellCommandRequirement"
},
{
"class": "DockerRequirement",
"dockerPull": "us.gcr.io/broad-gotc-prod/genomes-in-the-cloud:2.4.2-1552931386"
},
{
"class": "InitialWorkDirRequirement",
"listing": [
{
"entryname": "original.wdl",
"entry": "task RevertSam {\n input {\n File input_bam\n String basename = basename(input_bam, \".bam\")\n\n # runtime\n Int? preemptible_tries\n }\n Int disk_size = ceil(size(input_bam, \"GB\") * 2.5) + 20\n\n meta {\n description: \"Removes alignment information while retaining recalibrated base qualities and original alignment tags\"\n }\n parameter_meta {\n input_bam: \"aligned bam\"\n }\n command {\n java -Xmx1000m -jar /usr/gitc/picard.jar \\\n RevertSam \\\n INPUT=~{input_bam} \\\n OUTPUT_BY_READGROUP=false \\\n OUTPUT=~{basename}.bam \\\n VALIDATION_STRINGENCY=LENIENT \\\n ATTRIBUTE_TO_CLEAR=FT \\\n ATTRIBUTE_TO_CLEAR=CO \\\n SORT_ORDER=queryname \\\n RESTORE_ORIGINAL_QUALITIES=false\n }\n runtime {\n disks: \"local-disk \" + disk_size + \" HDD\"\n memory: \"2 GB\"\n docker: \"us.gcr.io/broad-gotc-prod/genomes-in-the-cloud:2.4.2-1552931386\"\n preemptible: select_first([preemptible_tries, 5])\n }\n output {\n File unmapped_bam = \"~{basename}.bam\"\n }\n}\n\n\n RevertSam INPUT=~{input_bam} \\ OUTPUT_BY_READGROUP=false \\\n OUTPUT=~{basename}.bam \\\n VALIDATION_STRINGENCY=LENIENT \\\n ATTRIBUTE_TO_CLEAR=FT \\\n ATTRIBUTE_TO_CLEAR=CO \\\n SORT_ORDER=queryname \\\n RESTORE_ORIGINAL_QUALITIES=false",
"writable": false
}
]
},
{
"class": "InlineJavascriptRequirement"
}
],
"sbg:projectName": "BUILD: Mitochondria Pipeline",
"sbg:revisionsInfo": [
{
"sbg:revision": 0,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1620309974,
"sbg:revisionNotes": null
},
{
"sbg:revision": 1,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1620310016,
"sbg:revisionNotes": ""
},
{
"sbg:revision": 2,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1622052547,
"sbg:revisionNotes": ""
},
{
"sbg:revision": 3,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1622052847,
"sbg:revisionNotes": ""
},
{
"sbg:revision": 4,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1622052920,
"sbg:revisionNotes": ""
},
{
"sbg:revision": 5,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1622053186,
"sbg:revisionNotes": ""
}
],
"sbg:image_url": null,
"sbg:appVersion": [
"v1.2"
],
"sbg:id": "dave/build-mitochondria-pipeline/revert-sam/5",
"sbg:revision": 5,
"sbg:revisionNotes": "",
"sbg:modifiedOn": 1622053186,
"sbg:modifiedBy": "dave",
"sbg:createdOn": 1620309974,
"sbg:createdBy": "dave",
"sbg:project": "dave/build-mitochondria-pipeline",
"sbg:sbgMaintained": false,
"sbg:validationErrors": [],
"sbg:contributors": [
"dave"
],
"sbg:latestRevision": 5,
"sbg:publisher": "sbg",
"sbg:content_hash": "a7c97f4c0e0ac482a6f90458680eb53d1201c37d7d8da42092e4cf41b764694b2"
},
"label": "revert-sam",
"sbg:x": 481.63592529296875,
"sbg:y": 230.7578125
},
{
"id": "gatk_samtofastq",
"in": [
{
"id": "in_alignments",
"source": "revert_sam/unaligned_bam"
}
],
"out": [
{
"id": "out_reads"
},
{
"id": "unmapped_reads"
}
],
"run": {
"class": "CommandLineTool",
"cwlVersion": "v1.2",
"$namespaces": {
"sbg": "https://sevenbridges.com"
},
"id": "dave/build-mitochondria-pipeline/gatk-samtofastq/1",
"baseCommand": [],
"inputs": [
{
"sbg:altPrefix": "-CLIP_ACT",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "null",
"id": "clipping_action",
"type": "string?",
"inputBinding": {
"prefix": "--CLIPPING_ACTION",
"shellQuote": false,
"position": 5
},
"label": "Clipping action",
"doc": "The action that should be taken with clipped reads: 'X' means the reads and qualities should be trimmed at the clipped position; 'N' means the bases should be changed to Ns in the clipped region; and any integer means that the base qualities should be set to that value in the clipped region."
},
{
"sbg:altPrefix": "-CLIP_ATTR",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "null",
"id": "clipping_attribute",
"type": "string?",
"inputBinding": {
"prefix": "--CLIPPING_ATTRIBUTE",
"shellQuote": false,
"position": 5
},
"label": "Clipping attribute",
"doc": "The attribute that stores the position at which the SAM record should be clipped."
},
{
"sbg:altPrefix": "-CLIP_MIN",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "0",
"id": "clipping_min_length",
"type": "int?",
"inputBinding": {
"prefix": "--CLIPPING_MIN_LENGTH",
"shellQuote": false,
"position": 5
},
"label": "Clipping min length",
"doc": "When performing clipping with the CLIPPING_ATTRIBUTE and CLIPPING_ACTION parameters, ensure that the resulting reads after clipping are at least CLIPPING_MIN_LENGTH bases long. If the original read is shorter than CLIPPING_MIN_LENGTH then the original read length will be maintained."
},
{
"sbg:altPrefix": "-GZOPRG",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "false",
"id": "compress_outputs_per_rg",
"type": "boolean?",
"inputBinding": {
"prefix": "--COMPRESS_OUTPUTS_PER_RG",
"shellQuote": false,
"position": 5
},
"label": "Compress outputs per RG",
"doc": "Compress output FASTQ files per read group using gzip and append a .gz extension to the file names. Cannot be used in conjuction with argument(s) FASTQ (F) SECOND_END_FASTQ (F2) UNPAIRED_FASTQ (FU)."
},
{
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "2",
"id": "compression_level",
"type": "int?",
"inputBinding": {
"prefix": "--COMPRESSION_LEVEL",
"shellQuote": false,
"position": 5
},
"label": "Compression level",
"doc": "Compression level for all compressed files created (e.g. BAM and VCF)."
},
{
"sbg:altPrefix": "-NON_PF",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "false",
"id": "include_non_pf_reads",
"type": "boolean?",
"inputBinding": {
"prefix": "--INCLUDE_NON_PF_READS",
"shellQuote": false,
"position": 5
},
"label": "Include non PF reads",
"doc": "Include non-PF reads from the SAM file into the output FASTQ files. PF means 'passes filtering'. Reads whose 'not passing quality controls' flag is set are non-PF reads. See GATK Dictionary for more info."
},
{
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "false",
"id": "include_non_primary_alignments",
"type": "boolean?",
"inputBinding": {
"prefix": "--INCLUDE_NON_PRIMARY_ALIGNMENTS",
"shellQuote": false,
"position": 5
},
"label": "Include non primary alignments",
"doc": "If true, include non-primary alignments in the output. Support of non-primary alignments in SamToFastq is not comprehensive, so there may be exceptions if this is set to true and there are paired reads with non-primary alignments."
},
{
"sbg:altPrefix": "-I",
"sbg:category": "Required Arguments",
"id": "in_alignments",
"type": "File",
"inputBinding": {
"prefix": "--INPUT",
"shellQuote": false,
"position": 5
},
"label": "Input SAM/BAM file",
"doc": "Input SAM/BAM file to extract reads from.",
"sbg:fileTypes": "SAM, BAM"
},
{
"sbg:altPrefix": "-INTER",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "false",
"id": "interleave",
"type": "boolean?",
"inputBinding": {
"prefix": "--INTERLEAVE",
"shellQuote": false,
"position": 5
},
"label": "Interleave",
"doc": "Will generate an interleaved FASTQ if paired, each line will have /1 or /2 to describe which end it came from."
},
{
"sbg:category": "Platform Options",
"id": "memory_overhead_per_job",
"type": "int?",
"label": "Memory overhead per job",
"doc": "This input allows a user to set the desired overhead memory when running a tool or adding it to a workflow. This amount will be added to the Memory per job in the Memory requirements section but it will not be added to the -Xmx parameter leaving some memory not occupied which can be used as stack memory (-Xmx parameter defines heap memory). This input should be defined in MB (for both the platform part and the -Xmx part if Java tool is wrapped)."
},
{
"sbg:category": "Platform Options",
"sbg:toolDefaultValue": "2048 MB",
"id": "memory_per_job",
"type": "int?",
"label": "Memory per job",
"doc": "This input allows a user to set the desired memory requirement when running a tool or adding it to a workflow. This value should be propagated to the -Xmx parameter too.This input should be defined in MB (for both the platform part and the -Xmx part if Java tool is wrapped)."
},
{
"sbg:altPrefix": "-OPRG",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "false",
"id": "output_per_rg",
"type": "boolean?",
"inputBinding": {
"prefix": "--OUTPUT_PER_RG",
"shellQuote": false,
"position": 5
},
"label": "Output per RG",
"doc": "Output a FASTQ file per read group (two FASTQ files per read group if the group is paired). Cannot be used in conjuction with argument(s)FASTQ (F) SECOND_END_FASTQ (F2) UNPAIRED_FASTQ (FU)."
},
{
"sbg:altPrefix": "-Q",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "null",
"id": "quality",
"type": "int?",
"inputBinding": {
"prefix": "--QUALITY",
"shellQuote": false,
"position": 5
},
"label": "Quality",
"doc": "End-trim reads using the phred/bwa quality trimming algorithm and this quality."
},
{
"sbg:altPrefix": "-RC",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "true",
"id": "re_reverse",
"type": [
"null",
{
"type": "enum",
"symbols": [
"true",
"false"
],
"name": "re_reverse"
}
],
"inputBinding": {
"prefix": "--RE_REVERSE",
"shellQuote": false,
"position": 5
},
"label": "Re reverse",
"doc": "Re-reverse bases and qualities of reads with negative strand flag set before writing them to FASTQ."
},
{
"sbg:altPrefix": "-R1_MAX_BASES",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "null",
"id": "read1_max_bases_to_write",
"type": "int?",
"inputBinding": {
"prefix": "--READ1_MAX_BASES_TO_WRITE",
"shellQuote": false,
"position": 5
},
"label": "Read1 max bases to write",
"doc": "The maximum number of bases to write from read 1 after trimming. If there are fewer than this many bases left after trimming, all will be written. If this value is null then all bases left after trimming will be written."
},
{
"sbg:altPrefix": "-R1_TRIM",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "0",
"id": "read1_trim",
"type": "int?",
"inputBinding": {
"prefix": "--READ1_TRIM",
"shellQuote": false,
"position": 5
},
"label": "Read1 trim",
"doc": "The number of bases to trim from the beginning of read 1."
},
{
"sbg:altPrefix": "-R2_MAX_BASES",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "null",
"id": "read2_max_bases_to_write",
"type": "int?",
"inputBinding": {
"prefix": "--READ2_MAX_BASES_TO_WRITE",
"shellQuote": false,
"position": 5
},
"label": "Read2 max bases to write",
"doc": "The maximum number of bases to write from read 2 after trimming. If there are fewer than this many bases left after trimming, all will be written. If this value is null then all bases left after trimming will be written."
},
{
"sbg:altPrefix": "-R2_TRIM",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "0",
"id": "read2_trim",
"type": "int?",
"inputBinding": {
"prefix": "--READ2_TRIM",
"shellQuote": false,
"position": 5
},
"label": "Read2 trim",
"doc": "The number of bases to trim from the beginning of read 2."
},
{
"sbg:altPrefix": "-RGT",
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "PU",
"id": "rg_tag",
"type": "string?",
"inputBinding": {
"prefix": "--RG_TAG",
"shellQuote": false,
"position": 5
},
"label": "RG tag",
"doc": "The read group tag (PU or ID) to be used to output a FASTQ file per read group."
},
{
"sbg:category": "Optional Arguments",
"sbg:toolDefaultValue": "STRICT",
"id": "validation_stringency",
"type": [
"null",
{
"type": "enum",
"symbols": [
"STRICT",
"LENIENT",
"SILENT"
],
"name": "validation_stringency"
}
],
"inputBinding": {
"prefix": "--VALIDATION_STRINGENCY",
"shellQuote": false,
"position": 5
},
"label": "Validation stringency",
"doc": "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."
},
{
"sbg:category": "Optional Arguments",
"id": "output_prefix",
"type": "string?",
"label": "Output prefix",
"doc": "Output file name prefix."
},
{
"sbg:category": "Optional parameters",
"sbg:toolDefaultValue": "false",
"id": "compress_outputs",
"type": "boolean?",
"label": "Compress output file(s)",
"doc": "Compress output file(s)."
},
{
"sbg:category": "Platform Options",
"sbg:toolDefaultValue": "1",
"id": "cpu_per_job",
"type": "int?",
"label": "CPU per job",
"doc": "CPU per job."
}
],
"outputs": [
{
"id": "out_reads",
"doc": "Output FASTQ file(s).",
"label": "Output FASTQ file(s)",
"type": "File[]?",
"outputBinding": {
"glob": "${\n var output_ext = inputs.compress_outputs ? \".fastq.gz\" : \".fastq\";\n var interleave = inputs.interleave;\n if (!inputs.outputs_by_readgroup)\n {\n if (interleave)\n {\n return \"*interleaved\" + output_ext;\n }\n else\n {\n return [\"*pe_1\" + output_ext, \"*pe_2\" + output_ext, \"*se\" + output_ext];\n }\n\n }\n else\n {\n return \"*\" + output_ext;\n }\n}",
"outputEval": "${ \n self = [].concat(self)\n \n function getPairedEnd(filename)\n {\n if (filename.lastIndexOf(\".fastq\") !== 0 && filename[filename.lastIndexOf(\".fastq\") - 2 ]==\"_\") \n {\n return filename[filename.lastIndexOf(\".fastq\") - 1 ];\n } \n else \n {\n return \"\";\n }\n }\n \n var out = inheritMetadata(self,inputs.in_alignments);\n for (var i=0; i < out.length; i++)\n {\n out[i].metadata['paired_end'] = getPairedEnd(out[i].path);\n }\n \n return out;\n}"
},
"sbg:fileTypes": "FASTQ, FASTQ.GZ"
},
{
"id": "unmapped_reads",
"doc": "Unpaired reads.",
"label": "Unpaired reads",
"type": "File?",
"outputBinding": {
"glob": "${\n var output_ext = inputs.compress_outputs ? \".fastq.gz\" : \".fastq\";\n var interleave = inputs.interleave;\n if (!inputs.outputs_by_readgroup)\n {\n if (!interleave)\n {\n return \"*unpaired\" + output_ext;\n }\n else \n {\n return \"\"; \n } \n }\n else {\n return \"\"; \n \n }\n}",
"outputEval": "$(inheritMetadata(self, inputs.in_alignments))"
},
"sbg:fileTypes": "FASTQ, FASTQ.GZ"
}
],
"doc": "The **GATK SamToFastq** tool converts a SAM or BAM file to FASTQ.\n\nThis tool extracts read sequences and qualities from the input SAM/BAM file and writes them into the output file in Sanger FASTQ format.\n\nIn the RC mode (default is True), if the read is aligned and the alignment is to the reverse strand on the genome, the read sequence from input SAM file will be reverse-complemented prior to writing it to FASTQ in order to correctly restore the original read sequence as it was generated by the sequencer [1].\n\n*A list of **all inputs and parameters** with corresponding descriptions can be found at the bottom of the page.*\n\n###Common Use Cases\n\n* The **GATK SamToFastq** tool requires a BAM/SAM file on its **Input BAM/SAM file** (`--INPUT`) input. The tool generates a single-end FASTQ file on its **Output FASTQ file(s)** output if the input BAM/SAM file is single end. In case the input file is paired end, the tool outputs the first end of the pair FASTQ and the second end of the pair FASTQ on its **Output FASTQ file(s)** output, except when the **Interleave** (`--INTERLEAVE`) option is set to True. If the output is an interleaved FASTQ file, if paired, each line will have /1 or /2 to describe which end it came from.\n\n* The **GATK SamToFastq** tool supports an optional parameter **Output by readgroup** (`--OUTPUT_BY_READGROUP`) which, when true, outputs a FASTQ file per read group (two FASTQ files per read group if the group is paired).\n\n* Usage example (input BAM file is single-end):\n\n```\ngatk SamToFastq \n --INPUT input.bam\n --FASTQ output.fastq\n```\n\n\n\n\n\n* Usage example (input BAM file is paired-end):\n\n```\ngatk SamToFastq \n --INPUT input.bam\n --FASTQ output.pe_1.fastq\n --SECOND_END_FASTQ output.pe_2.fastq\n --UNPAIRED_FASTQ unpaired.fastq\n\n```\n\n###Changes Introduced by Seven Bridges\n\n* The GATK SamToFastq tool is implemented to check if the input alignments file contains single-end or paired-end data and according to that generates different command lines for these two modes and thus produces appropriate output files on its **Output FASTQ file(s)** output (one FASTQ file in single-end mode and two FASTQ files if the input alignment file contains paired-end data). \n\n* All output files will be prefixed using the **Output prefix** parameter. In case the **Output prefix** is not provided, the output prefix will be the same as the Sample ID metadata from the **input SAM/BAM file**, if the Sample ID metadata exists. Otherwise, the output prefix will be inferred from the **Input SAM/BAM** filename. This way, having identical names of the output files between runs is avoided.\n\n* For paired-end read files, in order to successfully run alignment with STAR, this tool adds the appropriate **paired-end** metadata field in the output FASTQ files.\n\n###Common Issues and Important Notes\n\n* None\n\n###Performance Benchmarking\n\nBelow is a table describing runtimes and task costs of **GATK SamToFastq** for a couple of different samples, executed on the AWS cloud instances:\n\n| Experiment type | Input size | Paired-end | # of reads | Read length | Duration | Cost | Instance (AWS) | \n|:--------------:|:------------:|:--------:|:-------:|:---------:|:----------:|:------:|:------:|\n| RNA-Seq | 1.9 GB | Yes | 16M | 101 | 4min | ~0.03$ | c4.2xlarge (8 CPUs) | \n| RNA-Seq | 5.7 GB | Yes | 50M | 101 | 7min | ~0.04$ | c4.2xlarge (8 CPUs) | \n| RNA-Seq | 9.5 GB | Yes | 82M | 101 | 10min | ~0.07$ | c4.2xlarge (8 CPUs) | \n| RNA-Seq | 19 GB | Yes | 164M | 101 | 20min | ~0.13$ | c4.2xlarge (8 CPUs) |\n\n*Cost can be significantly reduced by using **spot instances**. Visit the [Knowledge Center](https://docs.sevenbridges.com/docs/about-spot-instances) for more details.*\n\n\n###References\n\n[1] [GATK SamToFastq](https://software.broadinstitute.org/gatk/documentation/tooldocs/4.0.12.0/picard_sam_SamToFastq)",
"label": "GATK SamToFastq",
"arguments": [
{
"prefix": "",
"shellQuote": false,
"position": 0,
"valueFrom": "${\n var in_alignments = [].concat(inputs.in_alignments)[0];\n var output_ext = inputs.compress_outputs ? \".fastq.gz\" : \".fastq\";\n var interleave = inputs.interleave;\n var output_prefix = ''; \n var cmd_line = '';\n cmd_line = \"cmd='' && paired_end=`samtools view -h \" + in_alignments.path + \" | head -n 500000 | samtools view -Sc -f 0x1 -`\";\n\n if (!inputs.outputs_by_readgroup)\n {\n if (inputs.output_prefix)\n {\n output_prefix = inputs.output_prefix;\n }\n else\n {\n if (in_alignments.metadata && in_alignments.metadata.sample_id)\n {\n output_prefix = in_alignments.metadata.sample_id;\n }\n else\n {\n output_prefix = in_alignments.path.split('/').pop().split('.')[0];\n } \n } \n \n cmd_line = cmd_line + \" && if [ $paired_end != 0 ]; then cmd='--FASTQ \" + output_prefix; \n \n if (interleave)\n {\n cmd_line = cmd_line + \".interleaved\" + output_ext + \"';\";\n }\n else\n {\n cmd_line = cmd_line + \".pe_1\" + output_ext;\n cmd_line = cmd_line + \" --SECOND_END_FASTQ \" + output_prefix + \".pe_2\" + output_ext;\n cmd_line = cmd_line + \" --UNPAIRED_FASTQ \" + output_prefix + \".unpaired\" + output_ext + \"';\";\n } \n cmd_line = cmd_line + \" else cmd='--FASTQ \" + output_prefix + \".se\" + output_ext + \"'; fi;\";\n return cmd_line;\n }\n else\n {\n return \"cmd='--OUTPUT_DIR .'\";\n }\n}\n\n"
},
{
"prefix": "",
"shellQuote": false,
"position": 1,
"valueFrom": "/opt/gatk"
},
{
"prefix": "",
"shellQuote": false,
"position": 2,
"valueFrom": "${\n if (inputs.memory_per_job)\n {\n return \"--java-options\";\n }\n else {\n return '';\n }\n \n}"
},
{
"prefix": "",
"shellQuote": false,
"position": 3,
"valueFrom": "${\n if (inputs.memory_per_job) {\n return '\\\"-Xmx'.concat(inputs.memory_per_job, 'M') + '\\\"';\n }\n else {\n return \"\";\n }\n}"
},
{
"prefix": "",
"shellQuote": false,
"position": 4,
"valueFrom": "SamToFastq"
},
{
"prefix": "",
"shellQuote": false,
"position": 6,
"valueFrom": "${\n return '$cmd';\n}"
}
],
"requirements": [
{
"class": "ShellCommandRequirement"
},
{
"class": "ResourceRequirement",
"ramMin": "${\n var memory = 4096;\n if (inputs.memory_per_job) \n {\n memory = inputs.memory_per_job;\n }\n if (inputs.memory_overhead_per_job)\n {\n memory += inputs.memory_overhead_per_job;\n }\n return memory;\n}",
"coresMin": "${\n return inputs.cpu_per_job ? inputs.cpu_per_job : 1;\n}"
},
{
"class": "DockerRequirement",
"dockerPull": "images.sbgenomics.com/stefan_stojanovic/gatk:4.1.0.0"
},
{
"class": "InitialWorkDirRequirement",
"listing": []
},
{
"class": "InlineJavascriptRequirement",
"expressionLib": [
"var updateMetadata = function(file, key, value) {\n file['metadata'][key] = value;\n return file;\n};\n\n\nvar setMetadata = function(file, metadata) {\n if (!('metadata' in file))\n file['metadata'] = metadata;\n else {\n for (var key in metadata) {\n file['metadata'][key] = metadata[key];\n }\n }\n return file\n};\n\nvar inheritMetadata = function(o1, o2) {\n var commonMetadata = {};\n if (!Array.isArray(o2)) {\n o2 = [o2]\n }\n for (var i = 0; i < o2.length; i++) {\n var example = o2[i]['metadata'];\n for (var key in example) {\n if (i == 0)\n commonMetadata[key] = example[key];\n else {\n if (!(commonMetadata[key] == example[key])) {\n delete commonMetadata[key]\n }\n }\n }\n }\n if (!Array.isArray(o1)) {\n o1 = setMetadata(o1, commonMetadata)\n } else {\n for (var i = 0; i < o1.length; i++) {\n o1[i] = setMetadata(o1[i], commonMetadata)\n }\n }\n return o1;\n};\n\nvar toArray = function(file) {\n return [].concat(file);\n};\n\nvar groupBy = function(files, key) {\n var groupedFiles = [];\n var tempDict = {};\n for (var i = 0; i < files.length; i++) {\n var value = files[i]['metadata'][key];\n if (value in tempDict)\n tempDict[value].push(files[i]);\n else tempDict[value] = [files[i]];\n }\n for (var key in tempDict) {\n groupedFiles.push(tempDict[key]);\n }\n return groupedFiles;\n};\n\nvar orderBy = function(files, key, order) {\n var compareFunction = function(a, b) {\n if (a['metadata'][key].constructor === Number) {\n return a['metadata'][key] - b['metadata'][key];\n } else {\n var nameA = a['metadata'][key].toUpperCase();\n var nameB = b['metadata'][key].toUpperCase();\n if (nameA < nameB) {\n return -1;\n }\n if (nameA > nameB) {\n return 1;\n }\n return 0;\n }\n };\n\n files = files.sort(compareFunction);\n if (order == undefined || order == \"asc\")\n return files;\n else\n return files.reverse();\n};",
"\nvar setMetadata = function(file, metadata) {\n if (!('metadata' in file)) {\n file['metadata'] = {}\n }\n for (var key in metadata) {\n file['metadata'][key] = metadata[key];\n }\n return file\n};\n\nvar inheritMetadata = function(o1, o2) {\n var commonMetadata = {};\n if (!Array.isArray(o2)) {\n o2 = [o2]\n }\n for (var i = 0; i < o2.length; i++) {\n var example = o2[i]['metadata'];\n for (var key in example) {\n if (i == 0)\n commonMetadata[key] = example[key];\n else {\n if (!(commonMetadata[key] == example[key])) {\n delete commonMetadata[key]\n }\n }\n }\n }\n if (!Array.isArray(o1)) {\n o1 = setMetadata(o1, commonMetadata)\n } else {\n for (var i = 0; i < o1.length; i++) {\n o1[i] = setMetadata(o1[i], commonMetadata)\n }\n }\n return o1;\n};"
]
}
],
"sbg:categories": [
"Utilities",
"BAM Processing"
],
"sbg:image_url": null,
"sbg:license": "Open source BSD (3-clause) license",
"sbg:links": [
{
"id": "https://software.broadinstitute.org/gatk/",
"label": "Homepage"
},
{
"id": "https://github.com/broadinstitute/gatk/",
"label": "Source Code"
},
{
"id": "https://github.com/broadinstitute/gatk/releases/download/4.1.0.0/gatk-4.1.0.0.zip",
"label": "Download"
},
{
"id": "https://www.ncbi.nlm.nih.gov/pubmed?term=20644199",
"label": "Publications"
},
{
"id": "https://software.broadinstitute.org/gatk/documentation/tooldocs/4.1.0.0/picard_sam_SamToFastq.php",
"label": "Documentation"
}
],
"sbg:projectName": "BUILD: Mitochondria Pipeline",
"sbg:revisionsInfo": [
{
"sbg:revision": 0,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1622141489,
"sbg:revisionNotes": "Uploaded using sbpack v2020.10.05. \nSource: \nrepo: https://github.com/cwl-apps/gatk-best-practices.git\nfile: \ncommit: (uncommitted file)"
},
{
"sbg:revision": 1,
"sbg:modifiedBy": "dave",
"sbg:modifiedOn": 1622861214,
"sbg:revisionNotes": ""
}
],
"sbg:toolAuthor": "Broad Institute",
"sbg:toolkit": "GATK",
"sbg:toolkitVersion": "4.1.0.0",
"sbg:appVersion": [
"v1.2"
],
"sbg:id": "dave/build-mitochondria-pipeline/gatk-samtofastq/1",
"sbg:revision": 1,
"sbg:revisionNotes": "",
"sbg:modifiedOn": 1622861214,
"sbg:modifiedBy": "dave",
"sbg:createdOn": 1622141489,
"sbg:createdBy": "dave",
"sbg:project": "dave/build-mitochondria-pipeline",
"sbg:sbgMaintained": false,
"sbg:validationErrors": [],
"sbg:contributors": [
"dave"
],
"sbg:latestRevision": 1,
"sbg:publisher": "sbg",
"sbg:content_hash": "a9218b248ce7e6eab4ebdcb8e04418844c942fdc689a9e743f1f24819e5f79338"
},
"label": "GATK SamToFastq",
"sbg:x": 683.4907836914062,
"sbg:y": 292.5499267578125
},
{