Commit 785450e3 authored by de Freitas Costa, Eduardo's avatar de Freitas Costa, Eduardo
Browse files

Deep changes in scenarios

parent b3dd836a
......@@ -29,8 +29,13 @@ set.seed(13)
wd.dados <- paste(wd,"/output","/output_scenario",j,sep="")
dir.create(wd.dados,showWarnings = F)
nome1<-c("Baseline","Long_OC","Short_Fa", "Short_OC", "Fade_ch=0.5", "Beta_ch=5","Heavy=0.001", "Heavy=0.5", "Cross=0.015","Storage=4days" ,"High Leakage","High_slaugh_contaminaiton","No_farmer-exposure","No_food_consum", "No_far&No_food", "Rate=(0.9,0.5)")
nome1<-c("Baseline","No Farm exposure","High beta_ch", "Low beta_ch", "No food", "No cross-cont. kitchen","Full cross-cont kitchen", "High cont at SH",
"no name","no name" ,"no name","no name","no name","no name", "no name", "no name")
nome<-c("No Farm exposure","High beta_ch", "Low beta_ch", "No food", "No cross-cont. kitchen","Full cross-cont kitchen", "High cont at SH",
"no name","no name" ,"no name","no name","no name","no name", "no name", "no name")
par(mar=c(5,5,4,3))
......@@ -153,13 +158,13 @@ set.seed(13)
#Sub-module cross-contamination at consumer# Evers`s model#
###########################################################
raw[1]<- (10^raw_af[1])*consu_ch*(1-frac_cross)
raw[1]<- (10^raw_af[1])*consu_ch*(1-frac_cross[j]) # CFU on meat portion after cross-contamination
raw_cross[1]<-(10^raw_af[1])*consu_ch * (1-cross[j])*(frac_cross) #CFU on 1 portion
veg_cross[1]<-(10^raw_af[1])*consu_ch * (cross[j])*frac_cross[j] #CFU on 1 portion of vegetables after cross-contamination
veg_cross[1]<-(10^raw_af[1])*consu_ch * (cross[j])*frac_cross #CFU on 1 portion
raw_cross[1]<-(10^raw_af[1])*consu_ch * (1-cross[j]) #CFU on 1 portion of meat no cross-contaminaiton
#Sub-module inactivation at consumer# Evers`s model#
......@@ -337,11 +342,16 @@ set.seed(13)
#Sub-module cross-contamination at consumer# Evers`s model#
###########################################################
raw[t]<- (10^raw_af[t])*consu_ch*(1-frac_cross)
raw_cross[t]<-(10^raw_af[t])*consu_ch * (1-cross[j]) *(frac_cross) #CFU on 1 portion
raw[t]<- (10^raw_af[t])*consu_ch*(1-frac_cross[j]) # CFU on meat portion after cross-contamination
veg_cross[t]<-(10^raw_af[t])*consu_ch * (cross[j])*frac_cross[j] #CFU on 1 portion of vegetables after cross-contamination
raw_cross[t]<-(10^raw_af[t])*consu_ch * (1-cross[j]) #CFU on 1 portion of meat no cross-contaminaiton
veg_cross[t]<-(10^raw_af[t])*consu_veg * (cross[j])*frac_cross #CFU on 1 portion
#Sub-module inactivation at consumer# Evers`s model#
......@@ -354,7 +364,7 @@ set.seed(13)
ready[t]<-log10(raw_cross[t]/consu_ch)+ R #Final concentration log10(cfu/g) in 1 serving with salad
ready2[t]<-(log10(raw[t]/consu_ch)+ R) #Final concentration log10(cfu/g) in 1 serving without salad
ready2[t]<-(log10(raw[t]/consu_ch)+ R) #Final concentration log10(cfu/g) in 1 serving without salad
#Sub-module exposure cfu#
......@@ -405,7 +415,7 @@ set.seed(13)
par(xpd=NA)
legend(-165,-0.5, legend=c("Ope. Commu.", "Chicken","Farmer","Slaug_prev"),
legend('center', legend=c("Ope. Commu.", "Chicken","Farmer","Slaug_prev"),
horiz=TRUE,col=c("red","green", "blue","yellow"), lty=1:1, cex=1.2)
......@@ -417,10 +427,14 @@ cena<-readRDS(paste(wd,"/output/cena.rds",sep=""))
tornado<-function(){
par(mfrow=c(1,1))
par(mfrow=c(1,1))
base<-cena[1]
nome<-c("Long_OC","Short_Fa", "Short_OC", "Fade_ch=0.5", "Beta_ch=5","Heavy=0.001", "Heavy=0.5", "Cross=0.015","Storage=4days" ,"High Leakage","High_slaugh_contaminaiton","No_farmer_exposure","No_food_consum", "No_far&No_food", "Rate=(0.9,0.5)")
nome<-c("No Farm exposure","High beta_ch", "Low beta_ch", "No food", "No cross-cont. kitchen","Full cross-cont kitchen", "High cont at SH",
"no name","no name" ,"no name","no name","no name","no name", "no name", "no name")
dado<-cbind.data.frame(cena[2:simtable],nome)
sorted<-dado[order(abs(log(cena[2:simtable]/base))),]
......@@ -430,8 +444,8 @@ sorted1<-dado[order(abs(((cena[2:simtable]-base)))),]
saveRDS(sorted,paste(wd,"/output/sorted.rds",sep=""))
saveRDS(sorted1,paste(wd,"/output/sorted1.rds",sep=""))
png(file=here("Figures", "tornado1.png"), width=600, height=350)
png(file=here("Figures", "tornado1.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(5,13,1,2))
barplot(log(sorted$cena/base), horiz = T,
names.arg = sorted$nome,col = "darkgray",las=1,xlab="Log difference",
......@@ -443,8 +457,8 @@ mtext(side = 1, text = "log difference", line = 3)
dev.off()
png(file=here("Figures", "tornado2.png"), width=600, height=350)
png(file=here("Figures", "tornado2.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(5,13,1,2))
barplot((sorted1$cena-base), horiz = T,
names.arg = sorted1$nome,col = "darkgray",las=1,xaxt="n",
......@@ -468,7 +482,7 @@ log_diff<-list()
prev<-list()
for (i in 1:16){
for (i in 1:simtable){
human_prev[[i]]<-read.table(paste(here(),"/","Output","/","output_scenario",i,"/","data1.txt",sep=""),header = TRUE)
......@@ -483,18 +497,18 @@ for (i in 1:16){
}
png(file=here("Figures", "human_prev.png"), width=600, height=350)
png(file=here("Figures", "human_prev.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(4,4,1,1))
plot(1:200,human_prev[[1]]$H,type="l",col=1,lwd=2,ylab="ESBL prevalence in the open community",xlab="Time in weeks")
lines(1:200,human_prev[[15]]$H,type="l",col=15)
lines(1:200,human_prev[[9]]$H,type="l",col=9)
lines(1:200,human_prev[[14]]$H,type="l",col=14)
lines(1:200,human_prev[[12]]$H,type="l",col=12)
lines(1:200,human_prev[[4]]$H,type="l",col=4)
lines(1:200,human_prev[[5]]$H,type="l",col=5)
lines(1:200,human_prev[[2]]$H,type="l",col=2)
nome2<-c("Baseline","No_far&No_food", "Cross=0.15", "No_food_consum", "High_slaugh_contaminaiton","Short_OC" ,"Fade_ch=0.5" ,"Long_OC" )
lines(1:200,human_prev[[2]]$H,type="l",col=15)
lines(1:200,human_prev[[3]]$H,type="l",col=9)
lines(1:200,human_prev[[4]]$H,type="l",col=14)
lines(1:200,human_prev[[5]]$H,type="l",col=12)
lines(1:200,human_prev[[6]]$H,type="l",col=4)
lines(1:200,human_prev[[7]]$H,type="l",col=5)
lines(1:200,human_prev[[8]]$H,type="l",col=2)
nome2<-c("No Farm exposure","High beta_ch", "Low beta_ch", "No food", "No cross-cont. kitchen","Full cross-cont kitchen", "High cont at SH")
legend(130, 0.05, legend=nome2,
......
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