Commit 59ce63e4 authored by de Freitas Costa, Eduardo's avatar de Freitas Costa, Eduardo
Browse files

Public commit

parent 234f7026
......@@ -11,4 +11,4 @@ Literature/
Output/
Validation/
*.Rproj
*.docx
*.docx
\ No newline at end of file
This diff is collapsed.
### Multidirectional dynamic source attribution ESBL
# Multidirectional dynamic risk assessment for ESBL source attribution
Main objective of the project is to model a multidirectinal dynamic mechanistic source attribution for ESBL. A risk assessment approach is used to answer the following questions:
[![DOI](https://zenodo.org/badge/DOI/10.1111/risa.12753.svg)](https://doi.org/10.1111/risa.12753)
## Authors:
Eduardo de Freitas Costa, Thomas Hagenaars, Anita Damme-Korevaar, and Clazien de Vos
## Aims:
The main objective of the project is to model a multidirectional dynamic risk assessment source attribution for ESBL. A risk assessment approach is used to answer the following questions:
+ i) Estimate the number of human ESBL colonization attributed to the livestock sector;
+ ii) Interventions in the food chain (here: chicken consumption), and in which step interventions contribute most to reducing the number of human colonization;
+ iii) Contribution of broiler flock farms with high antimicrobial usage to the public health burden of ESBL colonization.
## The paper is available online:
## Instrucitons to reproduce the results of the paper
### Using RStudio:
### 1 Download the files to a local or cloud folder. The best option is to download all files zipped;
### 2 Unzip and open the R project "MADRA.Rproj";
### 3 In R, you can open the file\
+ "main.R" \
### 4 Always load the packages before running the model. The model may take a long time to run;
### 5 Note that two folders were created into the working directory:
- **Output/chicken**: Stores the results of the baseline (scenario1), uncertainty, what-if analysis simulation, final prevalence, and table 4;
- **Figures/chicken**: Stores the graphs obtained in the paper;
......@@ -36,6 +36,10 @@
#Script start#############################################################################
##Create sub-dir
dir.create(here("Figures","chicken"),showWarnings = F)
####################
# Baseline outputs #
####################
......@@ -49,6 +53,10 @@ colo1<-cbind.data.frame(prev,time=seq(1,200,1))
colo2<-colo1[,c(1,2,4,5)]%>%gather(key="pop",value="prop",-time)
prev1<-knitr::kable(tail(colo1,1))
capture.output(prev1,file=here("Output","chicken","prevalences.txt"))
# Plot with prevalence per week
ggplot(colo2, aes(x=time, y=prop, linetype=pop)) +
......@@ -81,23 +89,9 @@ ggsave(here("Figures","chicken",'Fig_2.png'), dpi = 300, height = 5, width = 7,
risk <- read.csv(here("Output","chicken_risk","scenario1.txt"),sep=" ")
1-((1-tail(risk$r1,1))*(1-tail(risk$r2,1))*(1-tail(risk$r3,1))*(1-tail(risk$r4,1)))
1-((1-tail(risk$r6,1))*(1-tail(risk$r6.1,1))*(1-tail(risk$r7,1))*(1-tail(risk$r3,1))*(1-tail(risk$r4,1)))
1-((1-tail(risk$ere9,1))*(1-tail(risk$ere10,1)))
# Table with source attribution
rbind(
cbind(tail(risk$r1,n=1),tail(risk$r2,n=1),"NA",tail(risk$r3,n=1),tail(risk$r4,n=1)),
cbind(tail(risk$r6,n=1),tail(risk$r6.1,n=1),tail(risk$r7,n=1),tail(risk$r3,n=1),tail(risk$r4,n=1)),
cbind("NA",tail(risk$ere10,n=1),tail(risk$ere9,n=1),"NA","NA")
)
##Dataset with the sources according Thomas's eq
......@@ -107,13 +101,13 @@ h2<-(-log(1-risk$r2)) #Farmer
h3<-(-log(1-risk$r3)) #Meat
h4<-(-log(1-risk$r4)) #Veg
pcol_oc<-tail((h1/(h1+h2+h3+h4)),1)
pcol_fa<-tail(h2/(h1+h2+h3+h4),1)
pcol_me<-tail(h3/(h1+h2+h3+h4),1)
pcol_ve<-tail(h4/(h1+h2+h3+h4),1)
pcol_oc1<-tail((h1/(h1+h2+h3+h4)),1)
pcol_fa1<-tail(h2/(h1+h2+h3+h4),1)
pcol_me1<-tail(h3/(h1+h2+h3+h4),1)
pcol_ve1<-tail(h4/(h1+h2+h3+h4),1)
pcol_oc;pcol_fa;pcol_me;pcol_ve
pcol_oc1;pcol_fa1;pcol_me1;pcol_ve1
#For farmers
h5<-(-log(1-risk$r6)) #OC
......@@ -122,23 +116,35 @@ h7<-(-log(1-risk$r7)) #Flock
h8<-(-log(1-risk$r3)) #Meat
h9<-(-log(1-risk$r4)) #Veg
pcol_oc<-tail(h5/(h5+h6+h7+h8+h9),1)
pcol_fa<-tail(h6/(h5+h6+h7+h8+h9),1)
pcol_fl<-tail(h7/(h5+h6+h7+h8+h9),1)
pcol_me<-tail(h8/(h5+h6+h7+h8+h9),1)
pcol_ve<-tail(h9/(h5+h6+h7+h8+h9),1)
pcol_oc2<-tail(h5/(h5+h6+h7+h8+h9),1)
pcol_fa2<-tail(h6/(h5+h6+h7+h8+h9),1)
pcol_fl2<-tail(h7/(h5+h6+h7+h8+h9),1)
pcol_me2<-tail(h8/(h5+h6+h7+h8+h9),1)
pcol_ve2<-tail(h9/(h5+h6+h7+h8+h9),1)
pcol_oc;pcol_fa;pcol_fl;pcol_me;pcol_ve
pcol_oc2;pcol_fa2;pcol_fl2;pcol_me2;pcol_ve2
#For flocks
h10<-(-log(1-risk$ere9)) #flock
h11<-(-log(1-risk$ere10)) #farmer
pcol_fl<-tail(h10/(h10+h11),1)
pcol_fa<-tail(h11/(h10+h11),1)
pcol_fl3<-tail(h10/(h10+h11),1)
pcol_fa3<-tail(h11/(h10+h11),1)
pcol_fl3;pcol_fa3
tb4<-rbind(
c(pcol_oc1,pcol_fa1,pcol_me1,NA,pcol_ve1),
c(pcol_oc2,pcol_fa2,pcol_fl2,pcol_me2,pcol_ve2),
c(NA,pcol_fa3,pcol_fl3,NA,NA)
)
rownames(tb4)<-c("OC","Farmer","Flock")
colnames(tb4)<-c("OC","Farmer","Flock","Meat","Vegetables")
pcol_fl;pcol_fa
tb4<-knitr::kable(tb4)
capture.output(tb4,file=here("Output","chicken","tb4.txt"))
# Graph for source attribution
attr<-cbind.data.frame(Time=1:200,OC=risk$r1,Farmer=risk$r2,Meat=risk$r3,Veg=risk$r4)
......
......@@ -31,7 +31,7 @@
#Script start#############################################################################
#Packages to be used
packages<-c("here","tidyverse","ggplot2","gridExtra")
packages<-c("here","tidyverse","ggplot2","gridExtra","knitr")
# Install packages not yet installed
installed_packages <- packages %in% rownames(installed.packages())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment