Skip to content

Commit

Permalink
add new files
Browse files Browse the repository at this point in the history
  • Loading branch information
Qixin He committed Mar 19, 2022
1 parent c22f3de commit 539654d
Show file tree
Hide file tree
Showing 3 changed files with 8,235 additions and 0 deletions.
63 changes: 63 additions & 0 deletions batchRuns/analyze_codes.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
setwd("~/Dropbox/research/current/resistance/MalariaResistance/batchRuns/")
library(tidyverse)
library(cowplot)
oneLR<-read.csv("v4_param_results.csv")
#oneLR<-read.csv("v5_param_results.csv")
straRef<-data.frame(nstrains=ceiling(10^(seq(0.7,2.3,0.15))),rawStrains = 10^(seq(0.7,2.3,0.15)))
oneLR<-oneLR%>%left_join(straRef,by="nstrains")
oneLR<-oneLR%>%mutate(resistP = PR/P,
adjB = bavgnull*(0.5819519*(seasonality>0) + (seasonality==0)),
rNU = (PW_NU+PR_NU)/(NU+1),
rND = (PW_ND+PR_ND)/(ND+1),
rSU = (PW_SU+PR_SU)/(SU+1),
rSD = (PW_SD+PR_SD)/(SD+1),
rAU = (PW_AU+PR_AU)/(AU+1),
rAD = (PW_AD+PW_AD)/(AD+1),
I_NU = 1-exp(-rNU),
I_ND = 1-exp(-rND),
I_SU = 1-exp(-rSU),
I_SD = 1-exp(-rSD),
I_AU = 1-exp(-rAU),
I_AD = 1-exp(-rAD),
adjPrev = (I_NU*NU+I_ND*ND+I_SU*SU+I_SD*SD+I_AU*AU+I_AD*AD)/N
)



# resistant prevalence as a function of biting rate and strains
ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),log10(rawStrains)))+
geom_raster(aes(fill=resistP))+scale_fill_viridis_c()+
facet_wrap(d1~seasonality, labeller="label_both")

# prevalence as a function of starting conditions
ggplot(oneLR%>%drop_na()%>%filter(nstrains%in%c(10,20,80,159),d1==1),
aes(log10(adjB),adjPrev,
color=as.factor(wildOnly),shape = as.factor(d1)))+
geom_point()+
geom_line()+
facet_grid(nstrains~seasonality,scales="free")+theme_light()

# EIR vs. resistance
ggplot(oneLR%>%drop_na()%>%filter(wildOnly==0,d1>0), aes(log10(adjB*adjPrev*365),resistP))+
geom_point(aes(color=log(nstrains),shape=as.factor(seasonality)))+
scale_color_viridis_c(option="turbo")+xlab("log10(EIR per year)")+
ylab("percentage of resistance")+facet_grid(d1~seasonality,labeller="label_both")+
theme_cowplot()
# AU prevalence vs resistance
ggplot(oneLR%>%filter(wildOnly==0,d1>0),aes(I_AU,resistP))+
geom_point(aes(color=log10(nstrains/adjB),shape=as.factor(seasonality)))+scale_color_viridis_c(option="plasma")+xlab("Prevalance in Asymptomatic")+ylab("percentage of resistance")+
facet_grid(d1~.,labeller="label_both")+
theme_cowplot()

# prevalence vs resistance
ggplot(oneLR%>%filter(wildOnly==0,d1>0),aes(adjPrev,resistP))+
geom_point(aes(color=log10(nstrains/adjB),shape=as.factor(seasonality)))+scale_color_viridis_c(option="plasma")+
xlab("Prevalance")+ylab("percentage of resistance")+
facet_grid(d1~.,labeller="label_both")+
theme_cowplot()






Loading

0 comments on commit 539654d

Please sign in to comment.