Skip to content

Instantly share code, notes, and snippets.

@ericminikel
Last active December 31, 2015 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericminikel/8029963 to your computer and use it in GitHub Desktop.
Save ericminikel/8029963 to your computer and use it in GitHub Desktop.
Simulation of effects of PrPC downregulation on kinetics of prion infection in vivo
# simulate PrPC downregulation
kdeg = log(2)/1.5 # 36 half life for PrPSc
kconv = 1.7 # a conversion rate that works out well for wt mice
PrPSc0 = 10^1.5 # initial titer as of 4 dpi
symptomatic_threshold = 10^9 # titer when mice become asymptomatic
downreg_threshold = sqrt(PrPSc0 * symptomatic_threshold) # geometric mean for 1/2way through disease course
plot(NA,NA,xlim=range(times),ylim=c(1,10^10),log="y", # empty plot over 300 days and 10 log10s
xlab='days post-inoculation', ylab='prion titer', main=paste("kconversion = ",kconv,sep=''))
colorvals = data.frame(prpc=c(.5,1,3.5,6.5,10),k=colorRampPalette(c("orange","blue"))(n=5),
stringsAsFactors=FALSE) # this is necessary to have R read the hex colors as strings
# numerical simulation
for (prpc_expr_level in c(.5,1,3.5,6.5,10)) {
prpc = numeric(150)
prpsc = numeric(150)
prpc[1] = prpc_expr_level
prpsc[1] = PrPSc0
prpc_current_level = prpc_expr_level
for (i in 2:150) {
# apply the downregulation
if (prpsc[i-1] > downreg_threshold) {
prpc_current_level = prpc_expr_level * 0.5
}
prpc[i] = prpc_current_level
# exponential growth as usual
prpsc[i] = kconv * prpc[i-1] * prpsc[i-1] - kdeg * prpsc[i-1]
}
points(1:150,prpsc,lwd=3,type='l',col=colorvals$k[colorvals$prpc==prpc_expr_level])
}
legend('topright',legend=colorvals$prpc,col=colorvals$k,lwd=3,pch=NA,title="PrPC expr level",bg='white') # add a legend for curve colors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment