diff --git a/batchRuns/analyze_codes.r b/batchRuns/analyze_codes.r index 1c72a65..970121e 100755 --- a/batchRuns/analyze_codes.r +++ b/batchRuns/analyze_codes.r @@ -6,7 +6,7 @@ library(cowplot) library(dplyr) #oneLR<-read.csv("v4_param_results.csv") #oneLR<-read.csv("v5_param_results.csv") -oneLR<- read.csv("ParamListGen_results(8).csv") +oneLR<- read.csv("ParamListGen-1_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, @@ -42,16 +42,16 @@ 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") -ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),red))+ +ggplot(oneLR%>%filter(wildOnly==0,d1>0,cloneCost==0.1), aes(log10(adjB),red))+ geom_raster(aes(fill=resistP))+scale_fill_viridis_c()+ facet_wrap(d1~seasonality, labeller="label_both") ggplot(oneLR%>%filter(wildOnly==0,d1>0.5,cloneCost==0.1), aes(log10(adjB),resistP))+geom_point()+geom_line(aes(color=as.factor(red)))#+facet_wrap(d1~cloneCost, labeller="label_both") # host populations -ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),log10(rawStrains)))+ - geom_raster(aes(fill=N))+scale_fill_viridis_c()+ - facet_wrap(d1~seasonality~, labeller="label_both") +ggplot(oneLR%>%filter(wildOnly==0,d1>0,prev>0), aes(log10(adjB),red))+ + geom_raster(aes(fill=resistP))+scale_fill_viridis_c()+ + facet_wrap(d1~cloneCost, labeller="label_both") ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),N)) + geom_point() + geom_line(aes(color=as.factor(log10(rawStrains)))) @@ -91,7 +91,7 @@ ggplot(oneLR%>%drop_na()%>%filter(wildOnly==0,d1>0), aes(log10(adjB*adjPrev*365) ylab("percentage of resistance")+facet_grid(d1~seasonality,labeller="label_both")+ theme_cowplot() -ggplot(oneLR%>%filter(wildOnly==0,d1>0.5), aes(adjB*adjPrev*365,resistP))+ +ggplot(oneLR%>%filter(wildOnly==0,d1>0.5,cloneCost==0.1), aes(adjB*adjPrev*365,resistP))+ geom_point(aes(color=red))+ scale_color_viridis_c(option="turbo")+xlab("log10(EIR per year)")+ ylab("percentage of resistance")+facet_grid(d1~seasonality,labeller="label_both")+ @@ -99,7 +99,7 @@ ggplot(oneLR%>%filter(wildOnly==0,d1>0.5), aes(adjB*adjPrev*365,resistP))+ # AU prevalence vs resistance -ggplot(oneLR%>%filter(wildOnly==0,d1>0),aes(I_AU,resistP))+ +ggplot(oneLR%>%filter(wildOnly==0,d1>0,cloneCost==0.1),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()+ @@ -143,7 +143,46 @@ ggplot(oneLR%>%filter(wildOnly==0,d1>0.5,cloneCost==0.1),aes(adjPrev,resistP))+ facet_grid(d1~.,labeller="label_both")+ theme_cowplot()+ geom_smooth() - + + +ggplot(oneLR%>%filter(wildOnly==0,d1>0),aes(adjPrev,resistP))+ + geom_line(aes(color=as.factor(adjB)))+scale_color_viridis_d(option="plasma")+ + xlab("Prevalance")+ylab("percentage of resistance")+ + facet_grid(d1~cloneCost,labeller="label_both")+ + theme_cowplot() + +ggplot(oneLR%>%filter(wildOnly==0,d1>0,adjB>=0.1,adjPrev>0,red>0),aes(I_AU,resistP))+ + geom_point(aes(color=red))+scale_color_viridis_c(option="plasma")+ + xlab("Prevalance")+ylab("percentage of resistance")+ + facet_grid(d1~cloneCost,labeller="label_both")+ + theme_cowplot() + +ggplot(oneLR%>%filter(wildOnly==0,d1>0,adjPrev>0,red>0),aes(1/muWU*exp(-red*P_acc_S/(SU+SD)),resistP))+ + geom_point(aes(color=red))+scale_color_viridis_c(option="plasma")+ + ylab("percentage of resistance")+ + facet_grid(d1~cloneCost,labeller="label_both")+ + theme_cowplot() + +oneLR<-oneLR%>%mutate(clearN = 1/(1/muWU*exp(-red*P_acc_N/(NU+ND))+1), + clearS = 1/(1/muWU*exp(-red*P_acc_S/(SU+SD))+1), + clearA = 1/(1/muWU*exp(-red*P_acc_A/(AU+AD))+1), + sympt = ((PW_NU)*(1-exp(-1/8/clearN))+(PW_SU)*(1-exp(-1/8/clearS))+ + (PW_AU)*(1-exp(-1/8/clearA))), + aSympt = ((PW_NU)*exp(-1/8/clearN))/clearN+ + ((PW_SU)*exp(-1/8/clearS))/clearS+ + ((PW_AU)*exp(-1/8/clearA))/clearA, + noDrug = PW_NU/clearN+PW_SU/clearS+PW_AU/clearA, + symptRatio = (sympt+aSympt)/noDrug) + + + +ggplot(oneLR%>%filter(wildOnly==0,d1>0,adjPrev>0,red>0),aes(symptRatio,resistP))+ + geom_point(aes(color=red))+scale_color_viridis_c(option="plasma")+ + ylab("percentage of resistance")+ + facet_grid(d1~cloneCost,labeller="label_both")+ + theme_cowplot() + + ggplot(oneLR%>%filter(wildOnly==0,d1>0.5,cloneCost==0.1,red!=0),aes(log10(adjB),adjPrev))+geom_point()+geom_line(aes(color=as.factor(red)))