-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch_script.R
More file actions
295 lines (243 loc) · 9.37 KB
/
Copy pathlaunch_script.R
File metadata and controls
295 lines (243 loc) · 9.37 KB
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
## This is my launch script for the comparison between the two models
## Cluster set up
## Prepare for cluster use
## see https://mrc-ide.github.io/hipercow/
hipercow::hipercow_init()
hipercow::hipercow_configure(driver = "windows")
## Provision packages required on the cluster
## see https://mrc-ide.github.io/hipercow/articles/packages.html
hipercow::hipercow_provision()
# hipercow::hipercow_configuration()
# hipercow::hipercow_hello()
################################
## Model equilibrium analyses ##
################################
## Local test
# test <- orderly2::orderly_run(
# name = "equilibrium_comparison",
# parameters = list(
# investigation = "default",
# het_group_outputs = F,
# parameter_draws = F,
# EIR_range = "sparse",
# additional_outputs = F
# )
# )
#'- Generate standard (default) @equilibrium solutions
#--- With heterogeneity group outputs (for mixed infection calculations)
#--- Default parameter assumptions only (no parameter draws)
#--- With detailed range of EIR (for complete results set)
#--- With no additional (age-structured) outputs
default_run <- hipercow::task_create_expr(
orderly2::orderly_run(
name = "equilibrium_comparison",
parameters = list(
investigation = "default",
het_group_outputs = T,
parameter_draws = F,
EIR_range = "detailed",
additional_outputs = F
)
)
)
hipercow::task_status(default_run)
# hipercow::task_log_show(default_run)
# hipercow::task_cancel(default_run)
#'- Generate *sensitivity analyses* @equilibrium solutions
#--- These are:
#'---- varying *schizont-targeting drug coverage*
#'---- varying *hypnozoite relapse rate*
#'---- varying *mosquito biting heterogeneity*
#'---- varying *mosquito bioparameters*: q0, death rate and biting rate
#--- With no heterogeneity group outputs (only for mixed infection calculations)
#--- Default assumptions only (no parameter draws)
#--- With detailed range of EIR (for complete results set)
#--- With no additional (age-structured) outputs
# Other investigations don't return het outputs
equlibrium_investigations <-
c("vary_ft",
"vary_relapse_rate",
"vary_biting_het",
"decrease_q0",
"decrease_death_rate",
"increase_biting"
)
investigations_run_task_loop <- list()
for(investigation in equlibrium_investigations){
investigations_run_task_loop[[investigation]] <- hipercow::task_create_expr(
orderly2::orderly_run(
name = "equilibrium_comparison",
parameters = list(
investigation = investigation,
het_group_outputs = F,
parameter_draws = F,
EIR_range = "detailed",
additional_outputs = F
)
)
)
}
# table(unlist(lapply(investigations_run_task_loop, hipercow::task_status)))
# lapply(investigations_run_task_loop, hipercow::task_cancel)
# hipercow::task_log_show(investigations_run_task_loop[[1]])
#'- Generate standard (default) @equilibrium solutions [over parameter draws]
#--- With heterogeneity group outputs (for mixed infection calculations)
#'-- [Over 50 parameter draws]
#--- With detailed range of EIR (for complete results set)
#--- With no additional (age-structured) outputs
default_draws_run_task <- hipercow::task_create_expr(
orderly2::orderly_run(
name = "equilibrium_comparison",
parameters = list(
investigation = "default",
het_group_outputs = T,
parameter_draws = 50,
EIR_range = "detailed",
additional_outputs = F
)
),
parallel = hipercow::hipercow_parallel("parallel"),
# You could tailor cores if number to calibrate < 32
resources = hipercow::hipercow_resources(cores = 32)
)
# hipercow::task_status(default_draws_run_task)
# hipercow::task_log_show("9b05438cc6750357b236b99d1e5b0bc9")
# lapply(default_draws_run_task, hipercow::task_cancel)
#'- Generate *sensitivity analyses* @equilibrium solutions [over parameter draws]
#--- These are:
#'---- varying *schizont-targeting drug coverage*
#'---- varying *hypnozoite relapse rate*
#'---- varying *mosquito biting heterogeneity*
#'---- varying *mosquito bioparameters*: q0, death rate and biting rate
#--- With no heterogeneity group outputs (only for mixed infection calculations)
#'-- [Over 50 parameter draws]
#--- With detailed range of EIR (for complete results set)
#--- With no additional (age-structured) outputs
investigations_draws_run_task_loop <- list()
for(investigation in equlibrium_investigations){
investigations_draws_run_task_loop[[investigation]] <- hipercow::task_create_expr(
orderly2::orderly_run(
name = "equilibrium_comparison",
parameters = list(
investigation = investigation,
het_group_outputs = F,
parameter_draws = 50,
EIR_range = "detailed",
additional_outputs = F
)
),
parallel = hipercow::hipercow_parallel("parallel"),
# You could tailor cores if number to calibrate < 32
resources = hipercow::hipercow_resources(cores = 32)
)
}
# table(unlist(lapply(investigations_draws_run_task_loop, hipercow::task_status)))
# lapply(investigations_draws_run_task_loop, hipercow::task_log_show)
# lapply(investigations_draws_run_task_loop, hipercow::task_cancel)
#'- Generate standard (default) [age-structured] @equilibrium solutions
#--- With no heterogeneity group outputs (for mixed infection calculations)
#--- Default parameter assumptions only (no parameter draws)
#--- With detailed range of EIR (for complete results set)
#'-- With [age-structured] outputs
age_outputs_run_task <- hipercow::task_create_expr(
orderly2::orderly_run(
name = "equilibrium_comparison",
parameters = list(
investigation = "default",
het_group_outputs = F,
parameter_draws = F,
EIR_range = "detailed",
additional_outputs = T
)
),
parallel = hipercow::hipercow_parallel("parallel"),
# You could tailor cores if number to calibrate < 32
resources = hipercow::hipercow_resources(cores = 32)
)
# hipercow::task_status(age_outputs_run_task)
# hipercow::task_cancel(age_outputs_run_task)
#'- [Plot equilibrium results]
orderly2::orderly_run("equilibrium_comparison_plotting")
##################################################
## Malaria atlas project co-prevalence analyses ##
##################################################
# Set analysis admin level
admin_level <- 1
#'- [Fetch and compile site file prevalence, population and genetic estimates]
orderly2::orderly_run("download_country_site_files",
parameters = list(admin_level = admin_level))
#'- [Generate Pf/Pv endemic regions for use in analysis (with key results and plots)]
orderly2::orderly_run("assess_site_prevalences",
parameters = list(admin_level = admin_level))
#'- [Perform optimisation of kmeans clustering]
orderly2::orderly_run("clustering_algorithm_trajectories",
parameters = list(admin_level = admin_level))
#'- [Plot MAP co-prevalence results and key analysis outputs]
#'- *This includes all:*
#'--- *clustered trajectories (including by country and geographically)*
#'--- *clustered trajectories compared with equilibrium results (including sensitivity analyses)*
#'- Number of clusters is set to @7 in line with results from clustering_algorithm_trajectories
orderly2::orderly_run("clustering_plotting_trajectories",
parameters = list(k_groups = 7,
admin_level = admin_level))
###########################
## Intervention simulations
###########################
#'- [Create scenarios: ITN and treatment simulations]
#'- *treatment at 90% for 10 years*
#'- *a single ITN distribution at 90% coverage*
scenarios <- c("control", "treatment", "itns")
for(scenario in scenarios){
orderly2::orderly_run(
name = "sim_create_scenarios",
parameters = list(
scenario = scenario
)
)
}
#'- [Test run functions]
# orderly2::orderly_run(
# name = "sim_run_simulations",
# parameters = list(
# scenario = "control",
# total_M_to_match = 5,
# species_to_run = 'falciparum',
# simulation_years = 5,
# repetitions = 1,
# parallel = FALSE
# )
# )
#'- [Run scenarios: over a range of EIR values]
#'- *EIRs correspond with mosquito density*
total_Ms <- c(0.2, 0.3, 0.35, 0.4, 0.45, 0.47, 0.49, 0.5, 1, 5, 10)
species_v <- c("falciparum", "vivax")
run_scenarios_task <- list()
for(scenario in scenarios){
for(total_M in total_Ms[2:4]){
for(species in species_v){
run_scenarios_task[[paste0(c(scenario, total_M, species), collapse = "-")]] <- hipercow::task_create_expr(
orderly2::orderly_run(
name = "sim_run_simulations",
parameters = list(
scenario = scenario,
total_M_to_match = total_M,
species_to_run = species,
simulation_years = 20,
repetitions = 20,
parallel = TRUE
)
),
parallel = hipercow::hipercow_parallel("parallel"),
# You could tailor cores if number to calibrate < 32
resources = hipercow::hipercow_resources(cores = 32)
)
}
}
}
table(unlist(lapply(run_scenarios_task, hipercow::task_status)))
# lapply(run_scenarios_task, hipercow::task_cancel)
# hipercow::task_log_show(run_scenarios_task$`itns-5-falciparum`)
#'- [Plot scenario results]
orderly2::orderly_run(name = "sim_simulation_plots",
parameters = list(scenarios = paste0(scenarios, collapse = "--"),
total_Ms = paste0(total_Ms[c(2:4, 5, 9, 11)], collapse = "--")))