library(deSolve)
library(tidyverse)
3 Anti-viral Drug Therapy
From pages 35-37.
3.1 Set Up the ODE
Represents infected cells becoming:
- Latently infected: do not produce new virions, but contain replication competent virus that can be re-activated to become virus producing
- long-lived chronic producers: produce small amounts of virus over long periods
- cells which harbor defective provirus
These dynamics can be represented by the below equations:
\[ \frac{dx}{dt} = \lambda - dx - \beta x v \\ \] \[ \frac{dy_1}{dt} = q_1 \beta x v-a_1y_1+\alpha y_2 \\ \] \[ \frac{dy_2}{dt} = q_2 \beta x v-a_2y_2-\alpha y_2 \\ \] \[ \frac{dy_3}{dt} = q_3 \beta x v-a_3y_3 \\ \] \[ \frac{dv}{dt} = k y_1 - u v \]
These equations can then be coded as follows:
<- function(time, state, parameters){
base_ode with(as.list(c(state, parameters)),{
<- lambda - d*x - beta * x * v
dx <- q1*beta * x * v - a1 * y1 + alpha * y2
dy1 <- q2*beta * x * v - a2 * y2 - alpha * y2
dy2 <- q3*beta * x * v - a3 * y3
dy3 <- k * y1 - u * v
dv
return(list(c(dx, dy1, dy2, dy3, dv)))
})
}
Now we can set up the initial conditions and constants to simulate the outputs from this system of equations.
<- seq(0,30,.1)
t
<- c(
params lambda =1e7,# Uninfected cell production rate
d = .1, # Cell Death Rate
a1 = .5, # Infected Cell Death Rate
a2 = .01, # Infected Cell Death Rate
a3 = .008, # Infected Cell Death Rate
beta = 5e-10, # "Rate Constant"
alpha = .3, # Virus Production rate of reactivated latent
k = 500, # Virus productin from Infected cell
u = 5, # Free Virus lifestapn
q1 = .55, # P(Infected State | Infected)
q2 = .05, # P(Latent State | Infected)
q3 = .4 # P(Defective Provirus | Infected)
)
#' Guessing Initial values from a graph
<- params["lambda"][1]/params["d"][1]
x0 <- c(x = unname(x0),
init y1 = 1,y2=0,y3=0, v = 1)
<- ode(init, t, base_ode, params)
out
<- as_tibble(as.data.frame(out)) out_df
Funny side note is that the differences in the scales are almost immediately reproduced as in the book.
<- c("Uninfected Cells",
compartment_names "Actively Infected Cells",
"Latently Infected Cells",
"Cells Infected with Defective Virus",
"Free Virus")
<- out_df %>%
p setNames(c("time", compartment_names)) %>%
gather(compartment, value, -time) %>%
mutate(compartment = factor(compartment,
%>%
compartment_names)) ggplot(aes(time, y = value))+
geom_line()+
facet_wrap(~compartment, ncol = 1,scales = "free_y")+
theme_classic()+
labs(
title = "Viral Dynamics of Primary Phase of HIV or SIV Infection",
x = "Days",
y = "Count"
+
)scale_y_continuous(labels = scales::comma_format(accuracy = 1000))+
theme(strip.background = element_blank())
p
3.1.1 Equilibrium Conditions
\[ \hat{x} = \frac{x_0}{R_0} \\ \] \[ \hat{y_1} = (R_0-1)\frac{du}{\beta k} = \hat{v}\frac{u}{k} \\ \] \[ \hat{y_2}=\frac{\hat{y_1}\frac{a_1}{q_1}}{\frac{\alpha +a_2}{q_2}+\frac{\alpha}{q_1}}\\ \] \[ \hat{y_3} = \hat{y_2} \frac{\frac{\alpha + a_2}{q_2}}{\frac{a_3}{q_3}}\\ \] \[ \hat{v} = (R_0-1)\frac{d}{\beta} \]
With \(R_0\) given by:
\[ R_0 = \frac{\beta \lambda \ k}{a_1du}(q_1+q_2 \frac{\alpha}{\alpha + a_2}) \]