library(spleenrbc, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)
library(tidyr)
library(ggplot2)
A malaria infection can cause uninfected red blood cells to be “lost” from circulation. This can manifest as a direct effect — becoming infected — but also as an indirect effect where the infection leads to an increased retention of uninfected red blood cells in the spleen.
We can use this model to examine the relative contributions of these different processes to the overall loss. Here, we will use the baseline parameter values for a Pf infection:
scenario <- baseline_parameters(species = "Pf")
df_base <- run_spleenrbc(scenario, days = 150) |>
infection_flows_and_loss() |>
pivot_longer(! c("time", "scenario")) |>
mutate(
sim_no = factor(scenario),
days = time / 24
)
We can plot the circulating (uninfected) RBC population over time, to see how it changes over the course of the infection:
ggplot(df_base |> filter(name == "U_t"),
aes(days, value)) +
geom_line() +
geom_hline(
yintercept = df_base |>
filter(name == "U_t", time == 0) |>
pull(value),
linetype = "dashed"
) +
xlab("Time (days)") +
scale_y_log10("Circulating uRBC population")
We can also convert from RBC counts to haemoglobin levels:
df_hg <- df_base |>
filter(name == "U_t") |>
mutate(value = rbc_counts_to_haemoglobin(value))
initial_hg <- df_hg$value[1]
ggplot(df_hg, aes(days, value)) +
geom_line() +
geom_hline(
yintercept = initial_hg,
linetype = "dashed"
) +
xlab("Time (days)") +
scale_y_log10("Haemoglobin (g/dL)")
We can plot the rate at which red blood cells are moved from the circulation into the spleen, and how much of this is due to the malaria infection:
urbc_flows <- c("flow_uc_to_r", "flow_uc_to_r_inf", "flow_uc_to_r_no_inf")
urbc_baseline_retention <- df_base |>
filter(name == "flow_uc_to_r", time == 1) |>
pull(value)
ggplot(df_base |>
filter(name %in% urbc_flows, time > 0),
aes(days, value, colour = name)) +
geom_line() +
geom_hline(
yintercept = urbc_baseline_retention,
linetype = "dashed"
) +
xlab("Time (days)") +
scale_y_log10("RBC movement (per hour)") +
scale_colour_hue(
name = NULL,
labels = c("Total retention", "Due to infection", "Baseline")
) +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
Important: note that the baseline RBC retention rate is sensitive to the age distribution of RBCs in the circulation, and this age distribution changes over the course of an infection.
We can plot the rate at which red blood cells are being infected in the circulation and in the spleen:
urbc_infs <- c("flow_uc_to_ic", "flow_ur_to_ir")
ggplot(df_base |>
filter(name %in% urbc_infs, time > 0),
aes(days, value, colour = name)) +
geom_line() +
xlab("Time (days)") +
scale_y_log10("RBC infections (per hour)") +
scale_colour_hue(
name = NULL,
labels = c("uRBCs in circulation", "uRBCs in spleen")
) +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
We can plot the rate at which red blood cells (in the circulation and spleen) are being infected by merozoites released from infected cells in the circulation, in the microvasculature, and in the spleen:
urbc_inf_src <- c("inf_from_ic", "inf_from_iq", "inf_from_ir")
ggplot(df_base |>
filter(name %in% urbc_inf_src, time > 0),
aes(days, value, colour = name)) +
geom_line() +
xlab("Time (days)") +
scale_y_log10("RBC infections (per hour)") +
scale_colour_hue(
name = NULL,
labels = c("Circulation", "Microvasculature", "Spleen")
) +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
We can plot the rate at which uninfected and infected red blood cells are destroyed in the spleen:
rbc_destr <- c("flow_ir_out", "flow_ur_out")
ggplot(df_base |>
filter(name %in% rbc_destr, time > 0),
aes(days, value, colour = name)) +
geom_line() +
xlab("Time (days)") +
scale_y_log10("RBC destruction (per hour)") +
scale_colour_hue(
name = NULL,
labels = c("Infected RBCs", "Uninfected RBCs")
) +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
#> Warning in scale_y_log10("RBC destruction (per hour)"): log-10 transformation
#> introduced infinite values.
We can plot the ratio of the rate at which RBCs are retained in the spleen to the rate at which RBCs are infected:
urbc_ratios <- c("Uc_loss_ratio_c", "Uc_loss_ratio_cr")
ggplot(df_base |>
filter(name %in% urbc_ratios, time > 0),
aes(days, value, colour = name)) +
geom_line() +
xlab("Time (days)") +
scale_y_log10("Ratio of retention : infection") +
scale_colour_hue(
name = "Infections",
labels = c("Circulation", "Circulation and spleen")
) +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
We can compare the rates at which RBCs are being retained and infected (similar to Figure 6b of the draft manuscript):
urbc_cmp <- c("flow_uc_to_r_inf", "inf_from_ic", "inf_from_iq", "inf_from_ir", "inf_total")
ggplot(df_base |>
filter(name %in% urbc_cmp, time > 0),
aes(days, value, colour = name)) +
geom_line() +
xlab("Time (days)") +
scale_y_log10("Rate of RBC retention or infection") +
scale_colour_hue(
name = NULL,
labels = c(
"Retention",
"Inf: circulation",
"Inf: microvasculature",
"Inf: spleen",
"Inf: total"
)
) +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))