-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaster_script.R
89 lines (63 loc) · 2.59 KB
/
master_script.R
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
################################################################################
# Coronavirus cross-protection
# Author: Naomi R Waterlow
# Date: 2021-04-25
################################################################################
setwd("~/Documents/GitHub/coronavirus_immunity/")
library(here)
# Overall setup script
####### LOAD THE INITIAL REQUIREMENTS ######
# load the relevant packages
library(data.table)
library(MASS)
library(deSolve)
library(rootSolve)
library(Rcpp)
library(tmvtnorm)
library(ggplot2)
library(gridExtra)
library(parallel)
library(doParallel)
library(coda)
library(viridis)
## This is the package that contains the actual model code. It's in a package
# for convenience when running on a cluster.
source("AWS/compiler_function.R")
compileModel("AWS/SEIR_comp.cpp", "AWS/build")
dyn.load("AWS/build/SEIR_comp.so")
# load in the functions and parameters for fitting
source(here("AWS", "BM_PT_functions.R"))
source(here("fitting_seasonal/fit", "BM_PT.R"))
source(here("fitting_seasonal/fit", "BM_PT_parameters.R"))
###### RUN THE FIT ######
#run the fit (from the below script. can alter preferences etc.)
#Note: this takes a long time! The end traces are already saved so you can
#carry on to the analysis if wanted
file.edit(here("fitting_seasonal/fit", "BM_PT_run.R"))
##### ANALYSE THE FIT ######
# load in the plotting functions
source(here("fitting_seasonal/analysis", "analyse_traces_funcs.R"))
#run the analysis and create the figures
# if you want to change the traces you want to analyze go into this file and change
source(here("fitting_seasonal/analysis", "analyse_traces.R"))
######## COVID SIMULATIONS ######
compileModel(here::here("simulating_covid","SEIR_comp_lockdown.cpp"), "simulating_covid/build")
dyn.load("simulating_covid/build/SEIR_comp_lockdown.so")
source(here("serology_data.R"))
source(here("simulating_covid", "covid_sims_data.R"))
source(here("simulating_covid", "covid_sims_functions.R"))
# take the samples and make figures
# if any fixed parameters have changed need to change upper limit transmission
# rate by running last line of this script and then putting in as limit
source(here("simulating_covid", "Covid_sims_main.R"))
####### COVID FOREWARD PROJECTIONS ######
# source any required functions
source(here("projections", "projections_functions.R"))
# run the simulations and create graphs
source(here("projections", "projections_run.R"))
###### EXTRAS #####
# extra plots
source(here("figures", "plotting_data.R"))
source(here("figures", "extra_plots.RDS"))
# compare fit with Kissler parameters
file.edit(here("kissler_comparison","kissler_comparison.R"))