-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcnv_somatic_pair_workflow.wdl
763 lines (690 loc) · 35.9 KB
/
cnv_somatic_pair_workflow.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
# Workflow for running the GATK CNV pipeline on a matched pair. Supports both WGS and WES.
#
# Notes:
#
# - The interval-list file is required for both WGS and WES workflows and should be a Picard or GATK-style interval list.
# These intervals will be padded on both sides by the amount specified by PreprocessIntervals.padding (default 250)
# and split into bins of length specified by PreprocessIntervals.bin_length (default 1000; specify 0 to skip binning,
# e.g. for WES). For WGS, the intervals should simply cover the autosomal chromosomes (sex chromosomes may be
# included, but care should be taken to 1) avoid creating panels of mixed sex, and 2) denoise case samples only
# with panels containing only individuals of the same sex as the case samples).
#
# - The sites file (common_sites) should be a Picard or GATK-style interval list. This is a list of sites
# of known variation at which allelic counts will be collected for use in modeling minor-allele fractions.
#
# - Example invocation:
#
# java -jar cromwell.jar run cnv_somatic_pair_workflow.wdl -i my_parameters.json
#
#tag gatk4.0.1.2 release
#############
import "cnv_common_tasks.wdl" as CNVTasks
import "cnv_somatic_oncotator_workflow.wdl" as CNVOncotator
workflow CNVSomaticPairWorkflow {
##################################
#### required basic arguments ####
##################################
File common_sites
File intervals
File tumor_bam
File tumor_bam_idx
File normal_bam
File normal_bam_idx
File read_count_pon
File ref_fasta_dict
File ref_fasta_fai
File ref_fasta
String gatk_docker
##################################
#### optional basic arguments ####
##################################
# For running oncotator
Boolean? is_run_oncotator
File? gatk4_jar_override
Int? preemptible_attempts
# Use as a last resort to increase the disk given to every task in case of ill behaving data
Int? emergency_extra_disk
####################################################
#### optional arguments for PreprocessIntervals ####
####################################################
Int? padding
Int? bin_length
Int? mem_gb_for_preprocess_intervals
##############################################
#### optional arguments for CollectCounts ####
##############################################
String? format
Int? mem_gb_for_collect_counts
#####################################################
#### optional arguments for CollectAllelicCounts ####
#####################################################
String? minimum_base_quality
Int? mem_gb_for_collect_allelic_counts
##################################################
#### optional arguments for DenoiseReadCounts ####
##################################################
Int? number_of_eigensamples
Int? mem_gb_for_denoise_read_counts
##############################################
#### optional arguments for ModelSegments ####
##############################################
Int? max_num_segments_per_chromosome
Int? min_total_allele_count
Float? genotyping_homozygous_log_ratio_threshold
Float? genotyping_base_error_rate
Float? kernel_variance_copy_ratio
Float? kernel_variance_allele_fraction
Float? kernel_scaling_allele_fraction
Int? kernel_approximation_dimension
Array[Int]+? window_sizes = [8, 16, 32, 64, 128, 256]
Float? num_changepoints_penalty_factor
Float? minor_allele_fraction_prior_alpha
Int? num_samples_copy_ratio
Int? num_burn_in_copy_ratio
Int? num_samples_allele_fraction
Int? num_burn_in_allele_fraction
Float? smoothing_threshold_copy_ratio
Float? smoothing_threshold_allele_fraction
Int? max_num_smoothing_iterations
Int? num_smoothing_iterations_per_fit
Int? mem_gb_for_model_segments
######################################################
#### optional arguments for CallCopyRatioSegments ####
######################################################
Float? neutral_segment_copy_ratio_lower_bound
Float? neutral_segment_copy_ratio_upper_bound
Float? outlier_neutral_segment_copy_ratio_z_score_threshold
Float? calling_copy_ratio_z_score_threshold
Int? mem_gb_for_call_copy_ratio_segments
#########################################
#### optional arguments for plotting ####
#########################################
Int? minimum_contig_length
Int? mem_gb_for_plotting
##########################################
#### optional arguments for Oncotator ####
##########################################
String? additional_args_for_oncotator
String? oncotator_docker
Int? mem_gb_for_oncotator
Int ref_size = ceil(size(ref_fasta, "GB") + size(ref_fasta_dict, "GB") + size(ref_fasta_fai, "GB"))
Int read_count_pon_size = ceil(size(read_count_pon, "GB"))
Int tumor_bam_size = ceil(size(tumor_bam, "GB") + size(tumor_bam_idx, "GB"))
Int normal_bam_size = ceil(size(normal_bam, "GB") + size(normal_bam_idx, "GB"))
Int gatk4_override_size = if defined(gatk4_jar_override) then ceil(size(gatk4_jar_override, "GB")) else 0
# This is added to every task as padding, should increase if systematically you need more disk for every call
Int disk_pad = 20 + ceil(size(intervals, "GB")) + ceil(size(common_sites, "GB")) + gatk4_override_size + select_first([emergency_extra_disk,0])
Int preprocess_intervals_disk = ref_size + disk_pad
call CNVTasks.PreprocessIntervals {
input:
intervals = intervals,
ref_fasta = ref_fasta,
ref_fasta_fai = ref_fasta_fai,
ref_fasta_dict = ref_fasta_dict,
padding = padding,
bin_length = bin_length,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_preprocess_intervals,
disk_space_gb = preprocess_intervals_disk,
preemptible_attempts = preemptible_attempts
}
Int collect_counts_tumor_disk = tumor_bam_size + ceil(size(PreprocessIntervals.preprocessed_intervals, "GB")) + disk_pad
call CNVTasks.CollectCounts as CollectCountsTumor {
input:
intervals = PreprocessIntervals.preprocessed_intervals,
bam = tumor_bam,
bam_idx = tumor_bam_idx,
ref_fasta = ref_fasta,
ref_fasta_fai = ref_fasta_fai,
ref_fasta_dict = ref_fasta_dict,
format = format,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_collect_counts,
disk_space_gb = collect_counts_tumor_disk,
preemptible_attempts = preemptible_attempts
}
Int collect_counts_normal_disk = normal_bam_size + ceil(size(PreprocessIntervals.preprocessed_intervals, "GB")) + disk_pad
call CNVTasks.CollectCounts as CollectCountsNormal {
input:
intervals = PreprocessIntervals.preprocessed_intervals,
bam = normal_bam,
bam_idx = normal_bam_idx,
ref_fasta = ref_fasta,
ref_fasta_fai = ref_fasta_fai,
ref_fasta_dict = ref_fasta_dict,
format = format,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_collect_counts,
disk_space_gb = collect_counts_normal_disk,
preemptible_attempts = preemptible_attempts
}
Int collect_allelic_counts_tumor_disk = tumor_bam_size + ref_size + disk_pad
call CNVTasks.CollectAllelicCounts as CollectAllelicCountsTumor {
input:
common_sites = common_sites,
bam = tumor_bam,
bam_idx = tumor_bam_idx,
ref_fasta = ref_fasta,
ref_fasta_dict = ref_fasta_dict,
ref_fasta_fai = ref_fasta_fai,
minimum_base_quality = minimum_base_quality,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_collect_allelic_counts,
disk_space_gb = collect_allelic_counts_tumor_disk,
preemptible_attempts = preemptible_attempts
}
Int collect_allelic_counts_normal_disk = normal_bam_size + ref_size + disk_pad
call CNVTasks.CollectAllelicCounts as CollectAllelicCountsNormal {
input:
common_sites = common_sites,
bam = normal_bam,
bam_idx = normal_bam_idx,
ref_fasta = ref_fasta,
ref_fasta_dict = ref_fasta_dict,
ref_fasta_fai = ref_fasta_fai,
minimum_base_quality = minimum_base_quality,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_collect_allelic_counts,
disk_space_gb = collect_allelic_counts_normal_disk,
preemptible_attempts = preemptible_attempts
}
Int denoise_read_counts_tumor_disk = read_count_pon_size + ceil(size(CollectCountsTumor.counts, "GB")) + disk_pad
call DenoiseReadCounts as DenoiseReadCountsTumor {
input:
entity_id = CollectCountsTumor.entity_id,
read_counts = CollectCountsTumor.counts,
read_count_pon = read_count_pon,
number_of_eigensamples = number_of_eigensamples,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_denoise_read_counts,
disk_space_gb = denoise_read_counts_tumor_disk,
preemptible_attempts = preemptible_attempts
}
Int denoise_read_counts_normal_disk = read_count_pon_size + ceil(size(CollectCountsNormal.counts, "GB")) + disk_pad
call DenoiseReadCounts as DenoiseReadCountsNormal {
input:
entity_id = CollectCountsNormal.entity_id,
read_counts = CollectCountsNormal.counts,
read_count_pon = read_count_pon,
number_of_eigensamples = number_of_eigensamples,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_denoise_read_counts,
disk_space_gb = denoise_read_counts_normal_disk,
preemptible_attempts = preemptible_attempts
}
Int model_segments_disk = ceil(size(DenoiseReadCountsTumor.denoised_copy_ratios, "GB")) + ceil(size(CollectAllelicCountsTumor.allelic_counts, "GB")) + ceil(size(CollectAllelicCountsNormal.allelic_counts, "GB")) + disk_pad
call ModelSegments as ModelSegmentsTumor {
input:
entity_id = CollectCountsTumor.entity_id,
denoised_copy_ratios = DenoiseReadCountsTumor.denoised_copy_ratios,
allelic_counts = CollectAllelicCountsTumor.allelic_counts,
normal_allelic_counts = CollectAllelicCountsNormal.allelic_counts,
max_num_segments_per_chromosome = max_num_segments_per_chromosome,
min_total_allele_count = min_total_allele_count,
genotyping_homozygous_log_ratio_threshold = genotyping_homozygous_log_ratio_threshold,
genotyping_base_error_rate = genotyping_base_error_rate,
kernel_variance_copy_ratio = kernel_variance_copy_ratio,
kernel_variance_allele_fraction = kernel_variance_allele_fraction,
kernel_scaling_allele_fraction = kernel_scaling_allele_fraction,
kernel_approximation_dimension = kernel_approximation_dimension,
window_sizes = window_sizes,
num_changepoints_penalty_factor = num_changepoints_penalty_factor,
minor_allele_fraction_prior_alpha = minor_allele_fraction_prior_alpha,
num_samples_copy_ratio = num_samples_copy_ratio,
num_burn_in_copy_ratio = num_burn_in_copy_ratio,
num_samples_allele_fraction = num_samples_allele_fraction,
num_burn_in_allele_fraction = num_burn_in_allele_fraction,
smoothing_threshold_copy_ratio = smoothing_threshold_copy_ratio,
smoothing_threshold_allele_fraction = smoothing_threshold_allele_fraction,
max_num_smoothing_iterations = max_num_smoothing_iterations,
num_smoothing_iterations_per_fit = num_smoothing_iterations_per_fit,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_model_segments,
disk_space_gb = model_segments_disk,
preemptible_attempts = preemptible_attempts
}
call ModelSegments as ModelSegmentsNormal {
input:
entity_id = CollectCountsNormal.entity_id,
denoised_copy_ratios = DenoiseReadCountsNormal.denoised_copy_ratios,
allelic_counts = CollectAllelicCountsNormal.allelic_counts,
max_num_segments_per_chromosome = max_num_segments_per_chromosome,
min_total_allele_count = min_total_allele_count,
genotyping_homozygous_log_ratio_threshold = genotyping_homozygous_log_ratio_threshold,
genotyping_base_error_rate = genotyping_base_error_rate,
kernel_variance_copy_ratio = kernel_variance_copy_ratio,
kernel_variance_allele_fraction = kernel_variance_allele_fraction,
kernel_scaling_allele_fraction = kernel_scaling_allele_fraction,
kernel_approximation_dimension = kernel_approximation_dimension,
window_sizes = window_sizes,
num_changepoints_penalty_factor = num_changepoints_penalty_factor,
minor_allele_fraction_prior_alpha = minor_allele_fraction_prior_alpha,
num_samples_copy_ratio = num_samples_copy_ratio,
num_burn_in_copy_ratio = num_burn_in_copy_ratio,
num_samples_allele_fraction = num_samples_allele_fraction,
num_burn_in_allele_fraction = num_burn_in_allele_fraction,
smoothing_threshold_copy_ratio = smoothing_threshold_copy_ratio,
smoothing_threshold_allele_fraction = smoothing_threshold_allele_fraction,
max_num_smoothing_iterations = max_num_smoothing_iterations,
num_smoothing_iterations_per_fit = num_smoothing_iterations_per_fit,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_model_segments,
disk_space_gb = model_segments_disk,
preemptible_attempts = preemptible_attempts
}
Int copy_ratio_segments_tumor_disk = ceil(size(DenoiseReadCountsTumor.denoised_copy_ratios, "GB")) + ceil(size(ModelSegmentsTumor.copy_ratio_only_segments, "GB")) + disk_pad
call CallCopyRatioSegments as CallCopyRatioSegmentsTumor {
input:
entity_id = CollectCountsTumor.entity_id,
copy_ratio_segments = ModelSegmentsTumor.copy_ratio_only_segments,
neutral_segment_copy_ratio_lower_bound = neutral_segment_copy_ratio_lower_bound,
neutral_segment_copy_ratio_upper_bound = neutral_segment_copy_ratio_upper_bound,
outlier_neutral_segment_copy_ratio_z_score_threshold = outlier_neutral_segment_copy_ratio_z_score_threshold,
calling_copy_ratio_z_score_threshold = calling_copy_ratio_z_score_threshold,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_call_copy_ratio_segments,
disk_space_gb = copy_ratio_segments_tumor_disk,
preemptible_attempts = preemptible_attempts
}
Int copy_ratio_segments_normal_disk = ceil(size(DenoiseReadCountsNormal.denoised_copy_ratios, "GB")) + ceil(size(ModelSegmentsNormal.copy_ratio_only_segments, "GB")) + disk_pad
call CallCopyRatioSegments as CallCopyRatioSegmentsNormal {
input:
entity_id = CollectCountsNormal.entity_id,
copy_ratio_segments = ModelSegmentsNormal.copy_ratio_only_segments,
neutral_segment_copy_ratio_lower_bound = neutral_segment_copy_ratio_lower_bound,
neutral_segment_copy_ratio_upper_bound = neutral_segment_copy_ratio_upper_bound,
outlier_neutral_segment_copy_ratio_z_score_threshold = outlier_neutral_segment_copy_ratio_z_score_threshold,
calling_copy_ratio_z_score_threshold = calling_copy_ratio_z_score_threshold,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_call_copy_ratio_segments,
disk_space_gb = copy_ratio_segments_normal_disk,
preemptible_attempts = preemptible_attempts
}
# The F=files from other tasks are small enough to just combine into one disk variable and pass to the tumor plotting tasks
Int plot_tumor_disk = ref_size + ceil(size(DenoiseReadCountsTumor.standardized_copy_ratios, "GB")) + ceil(size(DenoiseReadCountsTumor.denoised_copy_ratios, "GB")) + ceil(size(ModelSegmentsTumor.het_allelic_counts, "GB")) + ceil(size(ModelSegmentsTumor.modeled_segments, "GB")) + disk_pad
call PlotDenoisedCopyRatios as PlotDenoisedCopyRatiosTumor {
input:
entity_id = CollectCountsTumor.entity_id,
standardized_copy_ratios = DenoiseReadCountsTumor.standardized_copy_ratios,
denoised_copy_ratios = DenoiseReadCountsTumor.denoised_copy_ratios,
ref_fasta_dict = ref_fasta_dict,
minimum_contig_length = minimum_contig_length,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_plotting,
disk_space_gb = plot_tumor_disk,
preemptible_attempts = preemptible_attempts
}
# The files from other tasks are small enough to just combine into one disk variable and pass to the normal plotting tasks
Int plot_normal_disk = ref_size + ceil(size(DenoiseReadCountsNormal.standardized_copy_ratios, "GB")) + ceil(size(DenoiseReadCountsNormal.denoised_copy_ratios, "GB")) + ceil(size(ModelSegmentsNormal.het_allelic_counts, "GB")) + ceil(size(ModelSegmentsNormal.modeled_segments, "GB")) + disk_pad
call PlotDenoisedCopyRatios as PlotDenoisedCopyRatiosNormal {
input:
entity_id = CollectCountsNormal.entity_id,
standardized_copy_ratios = DenoiseReadCountsNormal.standardized_copy_ratios,
denoised_copy_ratios = DenoiseReadCountsNormal.denoised_copy_ratios,
ref_fasta_dict = ref_fasta_dict,
minimum_contig_length = minimum_contig_length,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_plotting,
disk_space_gb = plot_normal_disk,
preemptible_attempts = preemptible_attempts
}
call PlotModeledSegments as PlotModeledSegmentsTumor {
input:
entity_id = CollectCountsTumor.entity_id,
denoised_copy_ratios = DenoiseReadCountsTumor.denoised_copy_ratios,
het_allelic_counts = ModelSegmentsTumor.het_allelic_counts,
modeled_segments = ModelSegmentsTumor.modeled_segments,
ref_fasta_dict = ref_fasta_dict,
minimum_contig_length = minimum_contig_length,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_plotting,
disk_space_gb = plot_tumor_disk,
preemptible_attempts = preemptible_attempts
}
call PlotModeledSegments as PlotModeledSegmentsNormal {
input:
entity_id = CollectCountsNormal.entity_id,
denoised_copy_ratios = DenoiseReadCountsNormal.denoised_copy_ratios,
het_allelic_counts = ModelSegmentsNormal.het_allelic_counts,
modeled_segments = ModelSegmentsNormal.modeled_segments,
ref_fasta_dict = ref_fasta_dict,
minimum_contig_length = minimum_contig_length,
gatk4_jar_override = gatk4_jar_override,
gatk_docker = gatk_docker,
mem_gb = mem_gb_for_plotting,
disk_space_gb = plot_normal_disk,
preemptible_attempts = preemptible_attempts
}
if (select_first([is_run_oncotator, false])) {
call CNVOncotator.CNVOncotatorWorkflow as CNVOncotatorWorkflow {
input:
called_file = CallCopyRatioSegmentsTumor.called_copy_ratio_segments,
additional_args = additional_args_for_oncotator,
oncotator_docker = oncotator_docker,
mem_gb_for_oncotator = mem_gb_for_oncotator,
preemptible_attempts = preemptible_attempts
}
}
output {
File preprocessed_intervals = PreprocessIntervals.preprocessed_intervals
File read_counts_entity_id_tumor = CollectCountsTumor.entity_id
File read_counts_tumor = CollectCountsTumor.counts
File allelic_counts_entity_id_tumor = CollectAllelicCountsTumor.entity_id
File allelic_counts_tumor = CollectAllelicCountsTumor.allelic_counts
File denoised_copy_ratios_tumor = DenoiseReadCountsTumor.denoised_copy_ratios
File standardized_copy_ratios_tumor = DenoiseReadCountsTumor.standardized_copy_ratios
File het_allelic_counts_tumor = ModelSegmentsTumor.het_allelic_counts
File normal_het_allelic_counts_tumor = ModelSegmentsTumor.normal_het_allelic_counts
File copy_ratio_only_segments_tumor = ModelSegmentsTumor.copy_ratio_only_segments
File modeled_segments_begin_tumor = ModelSegmentsTumor.modeled_segments_begin
File copy_ratio_parameters_begin_tumor = ModelSegmentsTumor.copy_ratio_parameters_begin
File allele_fraction_parameters_begin_tumor = ModelSegmentsTumor.allele_fraction_parameters_begin
File modeled_segments_tumor = ModelSegmentsTumor.modeled_segments
File copy_ratio_parameters_tumor = ModelSegmentsTumor.copy_ratio_parameters
File allele_fraction_parameters_tumor = ModelSegmentsTumor.allele_fraction_parameters
File called_copy_ratio_segments_tumor = CallCopyRatioSegmentsTumor.called_copy_ratio_segments
File denoised_copy_ratios_plot_tumor = PlotDenoisedCopyRatiosTumor.denoised_copy_ratios_plot
File denoised_copy_ratios_lim_4_plot_tumor = PlotDenoisedCopyRatiosTumor.denoised_copy_ratios_lim_4_plot
File standardized_MAD_tumor = PlotDenoisedCopyRatiosTumor.standardized_MAD
File denoised_MAD_tumor = PlotDenoisedCopyRatiosTumor.denoised_MAD
File delta_MAD_tumor = PlotDenoisedCopyRatiosTumor.delta_MAD
File scaled_delta_MAD_tumor = PlotDenoisedCopyRatiosTumor.scaled_delta_MAD
File modeled_segments_plot_tumor = PlotModeledSegmentsTumor.modeled_segments_plot
File read_counts_entity_id_normal = CollectCountsNormal.entity_id
File read_counts_normal = CollectCountsNormal.counts
File allelic_counts_entity_id_normal = CollectAllelicCountsNormal.entity_id
File allelic_counts_normal = CollectAllelicCountsNormal.allelic_counts
File denoised_copy_ratios_normal = DenoiseReadCountsNormal.denoised_copy_ratios
File standardized_copy_ratios_normal = DenoiseReadCountsNormal.standardized_copy_ratios
File het_allelic_counts_normal = ModelSegmentsNormal.het_allelic_counts
File normal_het_allelic_counts_normal = ModelSegmentsNormal.normal_het_allelic_counts
File copy_ratio_only_segments_normal = ModelSegmentsNormal.copy_ratio_only_segments
File modeled_segments_begin_normal = ModelSegmentsNormal.modeled_segments_begin
File copy_ratio_parameters_begin_normal = ModelSegmentsNormal.copy_ratio_parameters_begin
File allele_fraction_parameters_begin_normal = ModelSegmentsNormal.allele_fraction_parameters_begin
File modeled_segments_normal = ModelSegmentsNormal.modeled_segments
File copy_ratio_parameters_normal = ModelSegmentsNormal.copy_ratio_parameters
File allele_fraction_parameters_normal = ModelSegmentsNormal.allele_fraction_parameters
File called_copy_ratio_segments_normal = CallCopyRatioSegmentsNormal.called_copy_ratio_segments
File denoised_copy_ratios_plot_normal = PlotDenoisedCopyRatiosNormal.denoised_copy_ratios_plot
File denoised_copy_ratios_lim_4_plot_normal = PlotDenoisedCopyRatiosNormal.denoised_copy_ratios_lim_4_plot
File standardized_MAD_normal = PlotDenoisedCopyRatiosNormal.standardized_MAD
File denoised_MAD_normal = PlotDenoisedCopyRatiosNormal.denoised_MAD
File delta_MAD_normal = PlotDenoisedCopyRatiosNormal.delta_MAD
File scaled_delta_MAD_normal = PlotDenoisedCopyRatiosNormal.scaled_delta_MAD
File modeled_segments_plot_normal = PlotModeledSegmentsNormal.modeled_segments_plot
File oncotated_called_file_tumor = select_first([CNVOncotatorWorkflow.oncotated_called_file, "null"])
File oncotated_called_gene_list_file_tumor = select_first([CNVOncotatorWorkflow.oncotated_called_gene_list_file, "null"])
}
}
task DenoiseReadCounts {
String entity_id
File read_counts
File read_count_pon
Int? number_of_eigensamples #use all eigensamples in panel by default
File? gatk4_jar_override
# Runtime parameters
String gatk_docker
Int? mem_gb
Int? disk_space_gb
Boolean use_ssd = false
Int? cpu
Int? preemptible_attempts
Int machine_mem_mb = select_first([mem_gb, 13]) * 1000
Int command_mem_mb = machine_mem_mb - 1000
command <<<
set -e
export GATK_LOCAL_JAR=${default="/root/gatk.jar" gatk4_jar_override}
gatk --java-options "-Xmx${command_mem_mb}m" DenoiseReadCounts \
--input ${read_counts} \
--count-panel-of-normals ${read_count_pon} \
${"--number-of-eigensamples " + number_of_eigensamples} \
--standardized-copy-ratios ${entity_id}.standardizedCR.tsv \
--denoised-copy-ratios ${entity_id}.denoisedCR.tsv
>>>
runtime {
docker: "${gatk_docker}"
memory: machine_mem_mb + " MB"
disks: "local-disk " + disk_space_gb + if use_ssd then " SSD" else " HDD"
cpu: select_first([cpu, 1])
preemptible: select_first([preemptible_attempts, 5])
}
output {
File standardized_copy_ratios = "${entity_id}.standardizedCR.tsv"
File denoised_copy_ratios = "${entity_id}.denoisedCR.tsv"
}
}
task ModelSegments {
String entity_id
File denoised_copy_ratios
File allelic_counts
File? normal_allelic_counts
Int? max_num_segments_per_chromosome
Int? min_total_allele_count
Float? genotyping_homozygous_log_ratio_threshold
Float? genotyping_base_error_rate
Float? kernel_variance_copy_ratio
Float? kernel_variance_allele_fraction
Float? kernel_scaling_allele_fraction
Int? kernel_approximation_dimension
Array[Int]+? window_sizes = [8, 16, 32, 64, 128, 256]
Float? num_changepoints_penalty_factor
Float? minor_allele_fraction_prior_alpha
Int? num_samples_copy_ratio
Int? num_burn_in_copy_ratio
Int? num_samples_allele_fraction
Int? num_burn_in_allele_fraction
Float? smoothing_threshold_copy_ratio
Float? smoothing_threshold_allele_fraction
Int? max_num_smoothing_iterations
Int? num_smoothing_iterations_per_fit
String? output_dir
File? gatk4_jar_override
# Runtime parameters
String gatk_docker
Int? mem_gb
Int? disk_space_gb
Boolean use_ssd = false
Int? cpu
Int? preemptible_attempts
Int machine_mem_mb = select_first([mem_gb, 13]) * 1000
# ModelSegments seems to need at least 3GB of overhead to run
Int command_mem_mb = machine_mem_mb - 3000
# If optional output_dir not specified, use "out"
String output_dir_ = select_first([output_dir, "out"])
command <<<
set -e
mkdir ${output_dir_}
export GATK_LOCAL_JAR=${default="/root/gatk.jar" gatk4_jar_override}
gatk --java-options "-Xmx${command_mem_mb}m" ModelSegments \
--denoised-copy-ratios ${denoised_copy_ratios} \
--allelic-counts ${allelic_counts} \
${"--normal-allelic-counts " + normal_allelic_counts} \
--minimum-total-allele-count ${default="30" min_total_allele_count} \
--genotyping-homozygous-log-ratio-threshold ${default="-10.0" genotyping_homozygous_log_ratio_threshold} \
--genotyping-base-error-rate ${default="0.05" genotyping_base_error_rate} \
--maximum-number-of-segments-per-chromosome ${default="1000" max_num_segments_per_chromosome} \
--kernel-variance-copy-ratio ${default="0.0" kernel_variance_copy_ratio} \
--kernel-variance-allele-fraction ${default="0.025" kernel_variance_allele_fraction} \
--kernel-scaling-allele-fraction ${default="1.0" kernel_scaling_allele_fraction} \
--kernel-approximation-dimension ${default="100" kernel_approximation_dimension} \
--window-size ${sep=" --window-size " window_sizes} \
--number-of-changepoints-penalty-factor ${default="1.0" num_changepoints_penalty_factor} \
--minor-allele-fraction-prior-alpha ${default="25.0" minor_allele_fraction_prior_alpha} \
--number-of-samples-copy-ratio ${default=100 num_samples_copy_ratio} \
--number-of-burn-in-samples-copy-ratio ${default=50 num_burn_in_copy_ratio} \
--number-of-samples-allele-fraction ${default=100 num_samples_allele_fraction} \
--number-of-burn-in-samples-allele-fraction ${default=50 num_burn_in_allele_fraction} \
--smoothing-credible-interval-threshold-copy-ratio ${default="2.0" smoothing_threshold_copy_ratio} \
--smoothing-credible-interval-threshold-allele-fraction ${default="2.0" smoothing_threshold_allele_fraction} \
--maximum-number-of-smoothing-iterations ${default=10 max_num_smoothing_iterations} \
--number-of-smoothing-iterations-per-fit ${default=0 num_smoothing_iterations_per_fit} \
--output ${output_dir_} \
--output-prefix ${entity_id}
# We need to create the file even if the above command doesn't so we have something to delocalize
# If no file is created by the above task then it will copy out an empty file
touch ${output_dir_}/${entity_id}.hets.normal.tsv
>>>
runtime {
docker: "${gatk_docker}"
memory: machine_mem_mb + " MB"
disks: "local-disk " + disk_space_gb + if use_ssd then " SSD" else " HDD"
cpu: select_first([cpu, 1])
preemptible: select_first([preemptible_attempts, 5])
}
output {
File het_allelic_counts = "${output_dir_}/${entity_id}.hets.tsv"
File normal_het_allelic_counts = "${output_dir_}/${entity_id}.hets.normal.tsv"
File copy_ratio_only_segments = "${output_dir_}/${entity_id}.cr.seg"
File modeled_segments_begin = "${output_dir_}/${entity_id}.modelBegin.seg"
File copy_ratio_parameters_begin = "${output_dir_}/${entity_id}.modelBegin.cr.param"
File allele_fraction_parameters_begin = "${output_dir_}/${entity_id}.modelBegin.af.param"
File modeled_segments = "${output_dir_}/${entity_id}.modelFinal.seg"
File copy_ratio_parameters = "${output_dir_}/${entity_id}.modelFinal.cr.param"
File allele_fraction_parameters = "${output_dir_}/${entity_id}.modelFinal.af.param"
}
}
task CallCopyRatioSegments {
String entity_id
File copy_ratio_segments
Float? neutral_segment_copy_ratio_lower_bound
Float? neutral_segment_copy_ratio_upper_bound
Float? outlier_neutral_segment_copy_ratio_z_score_threshold
Float? calling_copy_ratio_z_score_threshold
File? gatk4_jar_override
# Runtime parameters
String gatk_docker
Int? mem_gb
Int? disk_space_gb
Boolean use_ssd = false
Int? cpu
Int? preemptible_attempts
Int machine_mem_mb = select_first([mem_gb, 7]) * 1000
Int command_mem_mb = machine_mem_mb - 1000
command <<<
set -e
export GATK_LOCAL_JAR=${default="/root/gatk.jar" gatk4_jar_override}
gatk --java-options "-Xmx${command_mem_mb}m" CallCopyRatioSegments \
--input ${copy_ratio_segments} \
--neutral-segment-copy-ratio-lower-bound ${default="0.9" neutral_segment_copy_ratio_lower_bound} \
--neutral-segment-copy-ratio-upper-bound ${default="1.1" neutral_segment_copy_ratio_upper_bound} \
--outlier-neutral-segment-copy-ratio-z-score-threshold ${default="2.0" outlier_neutral_segment_copy_ratio_z_score_threshold} \
--calling-copy-ratio-z-score-threshold ${default="2.0" calling_copy_ratio_z_score_threshold} \
--output ${entity_id}.called.seg
>>>
runtime {
docker: "${gatk_docker}"
memory: machine_mem_mb + " MB"
disks: "local-disk " + disk_space_gb + if use_ssd then " SSD" else " HDD"
cpu: select_first([cpu, 1])
preemptible: select_first([preemptible_attempts, 5])
}
output {
File called_copy_ratio_segments = "${entity_id}.called.seg"
}
}
task PlotDenoisedCopyRatios {
String entity_id
File standardized_copy_ratios
File denoised_copy_ratios
File ref_fasta_dict
Int? minimum_contig_length
String? output_dir
File? gatk4_jar_override
# Runtime parameters
String gatk_docker
Int? mem_gb
Int? disk_space_gb
Boolean use_ssd = false
Int? cpu
Int? preemptible_attempts
Int machine_mem_mb = select_first([mem_gb, 7]) * 1000
Int command_mem_mb = machine_mem_mb - 1000
# If optional output_dir not specified, use "out"
String output_dir_ = select_first([output_dir, "out"])
command <<<
set -e
mkdir ${output_dir_}
export GATK_LOCAL_JAR=${default="/root/gatk.jar" gatk4_jar_override}
gatk --java-options "-Xmx${command_mem_mb}m" PlotDenoisedCopyRatios \
--standardized-copy-ratios ${standardized_copy_ratios} \
--denoised-copy-ratios ${denoised_copy_ratios} \
--sequence-dictionary ${ref_fasta_dict} \
--minimum-contig-length ${default="1000000" minimum_contig_length} \
--output ${output_dir_} \
--output-prefix ${entity_id}
>>>
runtime {
docker: "${gatk_docker}"
memory: machine_mem_mb + " MB"
disks: "local-disk " + disk_space_gb + if use_ssd then " SSD" else " HDD"
cpu: select_first([cpu, 1])
preemptible: select_first([preemptible_attempts, 5])
}
output {
File denoised_copy_ratios_plot = "${output_dir_}/${entity_id}.denoised.png"
File denoised_copy_ratios_lim_4_plot = "${output_dir_}/${entity_id}.denoisedLimit4.png"
File standardized_MAD = "${output_dir_}/${entity_id}.standardizedMAD.txt"
File denoised_MAD = "${output_dir_}/${entity_id}.denoisedMAD.txt"
File delta_MAD = "${output_dir_}/${entity_id}.deltaMAD.txt"
File scaled_delta_MAD = "${output_dir_}/${entity_id}.scaledDeltaMAD.txt"
}
}
task PlotModeledSegments {
String entity_id
File denoised_copy_ratios
File het_allelic_counts
File modeled_segments
File ref_fasta_dict
Int? minimum_contig_length
String? output_dir
File? gatk4_jar_override
# Runtime parameters
String gatk_docker
Int? mem_gb
Int? disk_space_gb
Boolean use_ssd = false
Int? cpu
Int? preemptible_attempts
Int machine_mem_mb = select_first([mem_gb, 7]) * 1000
Int command_mem_mb = machine_mem_mb - 1000
# If optional output_dir not specified, use "out"
String output_dir_ = select_first([output_dir, "out"])
command <<<
set -e
mkdir ${output_dir_}
export GATK_LOCAL_JAR=${default="/root/gatk.jar" gatk4_jar_override}
gatk --java-options "-Xmx${command_mem_mb}m" PlotModeledSegments \
--denoised-copy-ratios ${denoised_copy_ratios} \
--allelic-counts ${het_allelic_counts} \
--segments ${modeled_segments} \
--sequence-dictionary ${ref_fasta_dict} \
--minimum-contig-length ${default="1000000" minimum_contig_length} \
--output ${output_dir_} \
--output-prefix ${entity_id}
>>>
runtime {
docker: "${gatk_docker}"
memory: machine_mem_mb + " MB"
disks: "local-disk " + disk_space_gb + if use_ssd then " SSD" else " HDD"
cpu: select_first([cpu, 1])
preemptible: select_first([preemptible_attempts, 5])
}
output {
File modeled_segments_plot = "${output_dir_}/${entity_id}.modeled.png"
}
}