Skip to content

Commit

Permalink
Generalized Immunity change
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Chaillet committed Apr 12, 2022
1 parent abb4c23 commit 679f3e2
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 6 deletions.
2 changes: 1 addition & 1 deletion batchRuns/ODESGeneralizedImmunity.R
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ SEAI_wildOnly<-function(t,y,p){
})
}

allPara<-read.csv("MalariaResistance/batchRuns/ParamListGen.csv",sep=",",header=T)
allPara<-read.csv(paramFile,sep=",",header=T)

currentPara<-allPara[allPara$No==No,]

Expand Down
73 changes: 68 additions & 5 deletions batchRuns/analyze_codes.r
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
setwd("~/Dropbox/research/current/resistance/MalariaResistance/batchRuns/")
setwd("~/MalariaResistance/batchRuns/")
library(tidyverse)
library(cowplot)
oneLR<-read.csv("v4_param_results.csv")
#oneLR<-read.csv("v5_param_results.csv")
library(dplyr)
#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,
Expand All @@ -12,7 +13,7 @@ oneLR<-oneLR%>%mutate(resistP = PR/P,
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),
rAD = (PW_AD+PR_AD)/(AD+1),
I_NU = 1-exp(-rNU),
I_ND = 1-exp(-rND),
I_SU = 1-exp(-rSU),
Expand All @@ -29,6 +30,34 @@ 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")

# 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), aes(log10(adjB),N)) + geom_point() + geom_line(aes(color=as.factor(log10(rawStrains))))

ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),(NU+ND)/N)) + geom_point()+geom_line(aes(color=as.factor(log10(rawStrains))))

ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),(NU+ND)/N)) + geom_point()+geom_line(aes(color=as.factor(seasonality)))


ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),(SU+SD)/N)) + geom_point()+geom_line(aes(color=as.factor(log10(rawStrains))))

ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),(AU+AD)/N)) + geom_point()+geom_line(aes(color=as.factor(log10(rawStrains))))

#host-specific prevalence

ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),(I_SU*SU+I_SD*SD)/(SU+SD))) + geom_point() + geom_line(aes(color=as.factor(log10(rawStrains))))

ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),(I_NU*NU+I_ND*ND)/(NU+ND))) + geom_point() + geom_line(aes(color=as.factor(log10(rawStrains))))

ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),(I_AU*AU+I_AD*AD)/(AU+AD))) + geom_point() + geom_line(aes(color=as.factor(log10(rawStrains))))

ggplot(oneLR%>%filter(wildOnly==0,d1>0), aes(log10(adjB),(PR_AU+PR_AD)/(PR_AU+PR_AD+PW_AU+PW_AD))) + geom_point() + geom_line(aes(color=as.factor(log10(rawStrains))))



# 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,
Expand All @@ -47,17 +76,51 @@ ggplot(oneLR%>%drop_na()%>%filter(wildOnly==0,d1>0), aes(log10(adjB*adjPrev*365)
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()+
geom_smooth()

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

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

ggplot(oneLR%>%filter(wildOnly==0,d1>0),aes(adjPrev,(1-(1/nstrains))^m_A))+
geom_point(aes(color=log10(nstrains/adjB),shape=as.factor(seasonality)))+scale_color_viridis_c(option="plasma")+xlab("adjPrev")+ylab("infectivity")+
facet_grid(d1~.,labeller="label_both")+
theme_cowplot()+
geom_smooth()

ggplot(oneLR%>%filter(wildOnly==0,d1>0),aes(log10(adjB),adjPrev))+
scale_color_viridis_d(option="plasma")+geom_line(aes(color=as.factor(nstrains)))+
facet_grid(d1~seasonality,labeller="label_both")+
theme_cowplot()


ggplot(oneLR%>%filter(wildOnly==0,d1>0),aes(log10(adjB),(AU+AD)/N))+
geom_point(aes(color=log10(nstrains/adjB),shape=as.factor(seasonality)))+scale_color_viridis_c(option="plasma")+xlab("adjB")+ylab("proportion asymptomatic")+
facet_grid(d1~.,labeller="label_both")+
theme_cowplot()+
geom_smooth()


# 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()
theme_cowplot()+
geom_smooth()






require(ggplot2)

0 comments on commit 679f3e2

Please sign in to comment.