-
Notifications
You must be signed in to change notification settings - Fork 1
/
component_stats_for_sel_sims.wdl
133 lines (115 loc) · 4.79 KB
/
component_stats_for_sel_sims.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
version 1.0
import "./tasks.wdl"
workflow component_stats_for_sel_sims_wf {
input {
String modelId
String experimentId = "default"
Array[Array[Array[File]]] selection_sims
File compute_components_script = "./remodel_components.py"
File old_compute_components_script = "./old_remodel_components.py"
File normalize_and_collate_script = "./norm_and_collate.py"
PopsInfo pops_info
Int n_bins_ihs = 20
Int n_bins_nsl = 20
Int n_bins_delihh = 20
Array[File] norm_bins_ihs
Array[File] norm_bins_nsl
Array[File] norm_bins_ihh12
Array[File] norm_bins_delihh
Array[Array[File]] norm_bins_xpehh
Int threads = 1
Int mem_base_gb = 0
Int mem_per_thread_gb = 1
Int local_disk_gb = 50
String docker = "quay.io/ilya_broad/cms@sha256:fc4825edda550ef203c917adb0b149cbcc82f0eeae34b516a02afaaab0eceac6" # selscan=1.3.0a09
Int preemptible
ComputeResources compute_resources_for_compute_one_pop_cms2_components = object {
mem_gb: 4,
cpus: 1,
local_storage_gb: 50
}
ComputeResources compute_resources_for_compute_two_pop_cms2_components = object {
mem_gb: 4,
cpus: 1,
local_storage_gb: 50
}
}
Int n_bins_ihh12 = 1
Int n_bins_xpehh = 1
scatter(sel_scen_idx in range(length(selection_sims))) {
Pop sel_pop = object { pop_id: pops_info.sel_pop_ids[sel_scen_idx] }
Int sel_pop_idx = pops_info.pop_id_to_idx[sel_pop.pop_id]
scatter(sel_blk_idx in range(length(selection_sims[sel_scen_idx]))) {
# if (sel_sim.left.succeeded && (sel_sim.left.modelInfo.sweepInfo.selPop == sel_pop)) {
# ReplicaInfo sel_sim_replicaInfo = sel_sim.left
# Pop sel_pop = object { pop_id: sel_sim_replicaInfo.modelInfo.sweepInfo.selPop }
# File sel_sim_region_haps_tar_gz = sel_sim.right
# String sel_sim_replica_id_str = modelId + "__selpop_" + sel_pop.pop_id + "__rep_" + sel_sim_replicaInfo.replicaId.replicaNumGlobal
call tasks.compute_one_pop_cms2_components as compute_one_pop_cms2_components_for_selection {
input:
sel_pop=sel_pop,
region_haps_tar_gzs=selection_sims[sel_scen_idx][sel_blk_idx],
script=compute_components_script,
compute_resources=compute_resources_for_compute_one_pop_cms2_components,
docker=docker,
preemptible=preemptible
}
scatter(alt_pop_idx in range(length(pops_info.pop_ids))) {
if (alt_pop_idx != sel_pop_idx) {
call tasks.compute_two_pop_cms2_components as compute_two_pop_cms2_components_for_selection {
input:
sel_pop=sel_pop,
alt_pop=pops_info.pops[alt_pop_idx],
region_haps_tar_gzs=selection_sims[sel_scen_idx][sel_blk_idx],
script=compute_components_script,
compute_resources=compute_resources_for_compute_two_pop_cms2_components,
docker=docker,
preemptible=preemptible
}
}
} # for each comparison pop
# should normalize_and_collate be done by blocks?
call tasks.normalize_and_collate_block {
input:
inp = object {
#replica_info: sel_sim_replicaInfo,
#replica_id_str: sel_sim_replica_id_str,
pop_ids: pops_info.pop_ids,
pop_pairs: pops_info.pop_pairs,
sel_pop: sel_pop,
replica_info: compute_one_pop_cms2_components_for_selection.replicaInfos,
ihs_out: compute_one_pop_cms2_components_for_selection.ihs,
delihh_out: compute_one_pop_cms2_components_for_selection.delihh,
nsl_out: compute_one_pop_cms2_components_for_selection.nsl,
ihh12_out: compute_one_pop_cms2_components_for_selection.ihh12,
delihh_out: compute_one_pop_cms2_components_for_selection.delihh,
derFreq_out: compute_one_pop_cms2_components_for_selection.derFreq,
xpehh_out: select_all(compute_two_pop_cms2_components_for_selection.xpehh),
fst_and_delDAF_out: select_all(compute_two_pop_cms2_components_for_selection.fst_and_delDAF),
n_bins_ihs: n_bins_ihs,
n_bins_nsl: n_bins_nsl,
n_bins_ihh12: n_bins_ihh12,
n_bins_delihh: n_bins_delihh,
n_bins_xpehh: n_bins_xpehh,
norm_bins_ihs: norm_bins_ihs[sel_pop_idx],
norm_bins_nsl: norm_bins_nsl[sel_pop_idx],
norm_bins_ihh12: norm_bins_ihh12[sel_pop_idx],
norm_bins_delihh: norm_bins_delihh[sel_pop_idx],
norm_bins_xpehh: norm_bins_xpehh[sel_pop_idx]
}
} # call tasks.normalize_and_collate_block
} # for each block of sel sims
#} # if (sel_sim.left.succeeded)
} # end: scatter(sel_scen_idx in range(length(selection_sims)))
call tasks.collate_stats_and_metadata_for_all_sel_sims {
input:
inp = object {
experimentId: experimentId,
sel_normed_and_collated: flatten(flatten(normalize_and_collate_block.normed_collated_stats)),
replica_infos: flatten(flatten(normalize_and_collate_block.replica_info))
}
}
output {
File all_hapsets_component_stats_h5 = collate_stats_and_metadata_for_all_sel_sims.all_hapsets_component_stats_h5
}
}