From 679f3e20d7951d962dded5679065b6fdb320028c Mon Sep 17 00:00:00 2001 From: Jack Chaillet Date: Tue, 12 Apr 2022 14:44:47 -0400 Subject: [PATCH] Generalized Immunity change --- batchRuns/ODESGeneralizedImmunity.R | 2 +- batchRuns/analyze_codes.r | 73 +++++++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 6 deletions(-) diff --git a/batchRuns/ODESGeneralizedImmunity.R b/batchRuns/ODESGeneralizedImmunity.R index 7b47ed5..b893ebe 100644 --- a/batchRuns/ODESGeneralizedImmunity.R +++ b/batchRuns/ODESGeneralizedImmunity.R @@ -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,] diff --git a/batchRuns/analyze_codes.r b/batchRuns/analyze_codes.r index 0b447e9..b837b6d 100755 --- a/batchRuns/analyze_codes.r +++ b/batchRuns/analyze_codes.r @@ -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, @@ -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), @@ -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, @@ -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) \ No newline at end of file