Skip to content
Snippets Groups Projects
Commit e3d321f1 authored by Rob Moss's avatar Rob Moss
Browse files

Remove outdated analyses

With the updated baseline parameters, we no longer observe any RBC
population dropping to zero in the sensitivity analysis.
parent f279459d
Branches
No related tags found
No related merge requests found
---
title: "Impact of reducing the parasite multiplication factor (PMF)"
output:
rmarkdown::html_vignette:
code_folding: show
vignette: >
%\VignetteIndexEntry{Impact of reducing the parasite multiplication factor (PMF)}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.align = "center",
fig.width = 7,
fig.height = 5,
fig.asp = NULL,
out.width = "95%"
)
```
## Overview
```{r setup, class.source = 'fold-hide'}
library(spleenrbc, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)
library(tidyr)
library(ggplot2)
library(gghalves)
p <- baseline_parameters("Pf")
reduced_PMF <- 8
```
This document presents the impact of reducing the parasite multiplication factor (PMF) from the current default value of \(`r p$PMF`\) to a value of \(`r reduced_PMF`\), as per the findings of [Simpson et al., 2002](https://doi.org/10.1017/S0031182001001202).
In brief, this results in lower numbers of infected RBCs (iRBCs) in the peripheral circulation and in the spleen, which are generally smaller the values reported in asymptomatic Papuans who underwent splenectomy.
However, the change in PMF has little effect on the ratio of spleen iRBC % to circulation iRBC %.
```{r modified-pmf-scenario, class.source = 'fold-hide'}
run_scenario <- function(scenario) {
run_spleenrbc(scenario) |>
mutate(
sim_no = factor(scenario),
Ur_frac_U = Ur_t / (Ur_t + U_t),
flow_uc_to_r_inf = flow_uc_to_r - flow_uc_to_r_no_inf,
inf_total = inf_from_ic + inf_from_iq + inf_from_ir,
inf_from_icq = inf_from_ic + inf_from_iq
) |>
calculate_irbc_ratio() |>
pivot_longer(! c("time", "sim_no", "scenario")) |>
filter(time > 0)
}
compare_reduced_pmf_to_baseline <- function(species, reduced_PMF) {
scenario <- baseline_parameters(species)
df_baseline <- run_scenario(scenario) |>
mutate(PMF = "Baseline")
scenario$PMF <- reduced_PMF
df_reduced_pmf <- run_scenario(scenario) |>
mutate(PMF = "Reduced")
rbind(df_baseline, df_reduced_pmf)
}
df_bpf <- compare_reduced_pmf_to_baseline("Pf", reduced_PMF)
df_bpv <- compare_reduced_pmf_to_baseline("Pv", reduced_PMF)
```
```{r clinical-data, class.source = 'fold-hide'}
load_clinical_data <- function(species = c("Pf", "Pv")) {
species <- match.arg(species)
# Load HHS total RBC counts for asymptomatic Pf infections.
data(hhs_asymp, envir = environment())
df_asymp <- hhs_asymp |>
filter(species == !!species) |>
mutate(kind = "Uninfected RBCs: Circulation")
# Load uRBC and iRBC counts for splenectomised Pf patients.
data(splenectomised, envir = environment())
df_splen <- splenectomised |>
filter(infection == !!species) |>
pivot_longer(! c("patient", "infection")) |>
filter(! is.na(value)) |>
# filter(! is.na(value) & value > 0) |>
mutate(
cell_type = case_when(
grepl("^urbc", name) ~ "Uninfected RBCs",
grepl("^irbc", name) ~ "Infected RBCs"
),
location = case_when(
grepl("_spleen", name) ~ "Spleen",
grepl("_peri", name) ~ "Circulation",
),
kind = paste0(cell_type, ": ", location),
cell_type = NULL,
location = NULL
)
df_ratio <- df_splen |>
select(patient, infection, name, value) |>
pivot_wider(names_from = "name", values_from = "value") |>
mutate(
ratio = (irbc_spleen / urbc_spleen) / (irbc_peri / urbc_peri),
day = 52
) |>
select(day, ratio) |>
filter(is.finite(ratio))
list(asymp = df_asymp, splen = df_splen, ratio = df_ratio)
}
pf_clinical <- load_clinical_data("Pf")
pv_clinical <- load_clinical_data("Pv")
plot_vs_clinical_data <- function(df, clinical) {
quantiles <- c(0.05, 0.25, 0.5, 0.75, 0.95)
labels <- c(
"U_t" = "Uninfected RBCs: Circulation",
"Ur_t" = "Uninfected RBCs: Spleen",
"I_t" = "Infected RBCs: Circulation",
"Ir_t" = "Infected RBCs: Spleen"
)
df <- df |>
filter(name %in% c("U_t", "Ur_t", "I_t", "Ir_t")) |>
mutate(kind = labels[name])
ggplot(df, aes()) +
geom_half_violin(
data = clinical$asymp,
mapping = aes(2.5, total_rbc),
linetype = "dashed",
draw_quantiles = quantiles,
side = "l",
width = 5
) +
geom_line(
mapping = aes(time / 24, value, linetype = PMF),
linewidth = 0.5
) +
geom_half_violin(
data = clinical$splen,
mapping = aes(max(df$time / 24) + 2, value),
position = position_identity(),
draw_quantiles = quantiles,
side = "r",
width = 5
) +
scale_x_continuous(
"Time (days)",
breaks = scales::breaks_width(10)
) +
scale_y_log10("Number of cells") +
facet_wrap(~ kind, ncol = 1, scales = "free_y") +
guides(colour = guide_none())
}
```
```{r baseline-pf-clinical, class.source = 'fold-hide'}
#| fig.cap = 'Uninfected and infected RBC populations in the circulation and spleen for Pv (lines). These are compared to data from asymptomatic Papuans (violins) who underwent splenectomy (solid lines) and who retained their spleens (dashed lines).'
plot_vs_clinical_data(df_bpf, pf_clinical)
```
```{r baseline-pv-clinical, class.source = 'fold-hide'}
#| fig.cap = 'Uninfected and infected RBC populations in the circulation and spleen for Pv (lines). These are compared to data from asymptomatic Papuans (violins) who underwent splenectomy (solid lines) and who retained their spleens (dashed lines).'
plot_vs_clinical_data(df_bpv, pv_clinical)
```
## Plasmodium falciparum
```{r baseline-pf-urbc, class.source = 'fold-hide', fig.cap = 'RBC populations over time for the baseline parameter values (Pf infection).'}
ggplot(df_bpf |> filter(name %in% c("U_t", "Ur_t", "I_t", "Ir_t")),
aes(time / 24, value, colour = name, linetype = PMF)) +
geom_line() +
scale_colour_hue(
name = NULL,
labels = c(expression(I[c](t)), expression(I[r](t)),
expression(U[c](t)), expression(U[r](t)))
) +
xlab("Time (days)") +
scale_y_log10("Number of RBCs") +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
```
```{r baseline-pf-ur-frac, class.source = 'fold-hide', fig.cap = 'Uninfected RBC retention in the spleen (Pf infection).'}
ggplot(df_bpf |> filter(name == "Ur_frac_U"),
aes(time / 24, 100 * value, linetype = PMF)) +
geom_line() +
xlab("Time (days)") +
ylab("uRBC retention in the spleen (%)")
```
```{r baseline-pf-u-infs, class.source = 'fold-hide', fig.cap = 'Uninfected RBC loss due to malaria, by infection and by retention in the spleen (Pf infection).'}
ggplot(df_bpf |> filter(name %in% c("inf_total", "inf_from_icq",
"inf_from_ir", "flow_uc_to_r_inf")),
aes(time / 24, value, colour = name, linetype = PMF)) +
geom_line() +
scale_colour_hue(
name = NULL,
labels = c("Retained in spleen", "Parasitised: circulation",
"Parasitised: spleen", "Parasitised: total")
) +
xlab("Time (days)") +
scale_y_log10(
"Number of uRBCs",
breaks = scales::log_breaks(n = 8)
) +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
```
```{r baseline-pf-irbc-ratio, class.source = 'fold-hide', fig.cap = 'The ratio of (a) the proportion of RBCs in the spleen that are infected; to (b) the proportion of RBCs in the circulation that are infected (Pf infection).'}
ggplot(df_bpf |> filter(name == "iRBC_Ratio"),
aes(time / 24, value)) +
geom_line(mapping = aes(linetype = PMF)) +
geom_point(
mapping = aes(day, ratio),
data = pf_clinical$ratio
) +
xlab("Time (days)") +
ylab("Ratio of spleen iRBC % to circulation iRBC %") +
scale_y_log10()
```
## Plasmodium vivax
```{r baseline-pv-urbc, class.source = 'fold-hide', fig.cap = 'RBC populations over time for the baseline parameter values (Pv infection).'}
ggplot(df_bpv |> filter(name %in% c("U_t", "Ur_t", "I_t", "Ir_t")),
aes(time / 24, value, colour = name, linetype = PMF)) +
geom_line() +
scale_colour_hue(
name = NULL,
labels = c(expression(I[c](t)), expression(I[r](t)),
expression(U[c](t)), expression(U[r](t)))
) +
xlab("Time (days)") +
scale_y_log10("Number of RBCs") +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
```
```{r baseline-pv-ur-frac, class.source = 'fold-hide', fig.cap = 'Uninfected RBC retention in the spleen (Pv infection).'}
ggplot(df_bpv |> filter(name == "Ur_frac_U"),
aes(time / 24, 100 * value, linetype = PMF)) +
geom_line() +
xlab("Time (days)") +
ylab("uRBC retention in the spleen (%)")
```
```{r baseline-pv-u-infs, class.source = 'fold-hide', fig.cap = 'Uninfected RBC loss due to malaria, by infection and by retention in the spleen (Pv infection).'}
ggplot(df_bpv |> filter(name %in% c("inf_total", "inf_from_icq",
"inf_from_ir", "flow_uc_to_r_inf")),
aes(time / 24, value, colour = name, linetype = PMF)) +
geom_line() +
scale_colour_hue(
name = NULL,
labels = c("Retained in spleen", "Parasitised: circulation",
"Parasitised: spleen", "Parasitised: total"),
) +
xlab("Time (days)") +
scale_y_log10(
"Number of uRBCs",
breaks = scales::log_breaks(n = 8),
) +
theme(legend.position = "top") +
theme(legend.text = element_text(margin = margin(r = 12)))
```
```{r baseline-pv-irbc-ratio, class.source = 'fold-hide', fig.cap = 'The ratio of (a) the proportion of RBCs in the spleen that are infected; to (b) the proportion of RBCs in the circulation that are infected (Pv infection).'}
ggplot(df_bpv |> filter(name == "iRBC_Ratio"),
aes(time / 24, value)) +
geom_line(mapping = aes(linetype = PMF)) +
geom_point(
mapping = aes(day, ratio),
data = pv_clinical$ratio
) +
xlab("Time (days)") +
ylab("Ratio of spleen iRBC % to circulation iRBC %") +
scale_y_log10()
```
......@@ -15,7 +15,7 @@ knitr::opts_chunk$set(
comment = "#>",
fig.align = "center",
fig.width = 7,
fig.height = 5,
fig.height = 12,
fig.asp = NULL,
out.width = "95%"
)
......@@ -39,25 +39,15 @@ suppressPackageStartupMessages(library(here))
output_dir <- here("outputs")
# Load Pf results where Ur(t) > 0 for all times t.
pf_ur_nonz <- readRDS(
file.path(output_dir, "sensitivity-analysis-pf-rbc-cints-nonz.rds")
) |>
mutate(day = time / 24)
# Load Pf results where Ur(t) = 0 for some time t.
pf_ur_zero <- readRDS(
file.path(output_dir, "sensitivity-analysis-pf-rbc-cints-zero.rds")
# Load Pf results.
pf_results <- readRDS(
file.path(output_dir, "sensitivity-analysis-pf-rbc-cints-all.rds")
) |>
mutate(day = time / 24)
# Load Pv results where Ic(t) > 0 and Ir(t) > 0 for all times t.
pv_i_nonz <- readRDS(
file.path(output_dir, "sensitivity-analysis-pv-rbc-cints-nonz.rds")
) |>
mutate(day = time / 24)
# Load Pv results where Ic(t) = 0 or Ir(t) = 0 for some time t.
pv_i_zero <- readRDS(
file.path(output_dir, "sensitivity-analysis-pv-rbc-cints-zero.rds")
# Load Pv results.
pv_results <- readRDS(
file.path(output_dir, "sensitivity-analysis-pv-rbc-cints-all.rds")
) |>
mutate(day = time / 24)
......@@ -76,7 +66,6 @@ load_clinical_data <- function(species = c("Pf", "Pv")) {
filter(infection == !!species) |>
pivot_longer(! c("patient", "infection")) |>
filter(! is.na(value)) |>
# filter(! is.na(value) & value > 0) |>
mutate(
cell_type = case_when(
grepl("^urbc", name) ~ "Uninfected RBCs",
......@@ -84,13 +73,14 @@ load_clinical_data <- function(species = c("Pf", "Pv")) {
),
location = case_when(
grepl("_spleen", name) ~ "Spleen",
grepl("_peri", name) ~ "Circulation",
grepl("_peri", name) ~ "Circulation"
),
kind = paste0(cell_type, ": ", location),
cell_type = NULL,
location = NULL
)
# Calculate the ratio of iRBC % in spleen vs circulation.
df_ratio <- df_splen |>
select(patient, infection, name, value) |>
pivot_wider(names_from = "name", values_from = "value") |>
......@@ -108,45 +98,33 @@ pf_clinical <- load_clinical_data("Pf")
pv_clinical <- load_clinical_data("Pv")
```
```{r plot-results-function, class.source = 'fold-hide'}
plot_irbc_ratio <- function(df, clinical) {
df <- filter(df, name == "iRBC_Ratio")
ggplot() +
geom_ribbon(
mapping = aes(day, ymin = ci_min, ymax = ci_max,
fill = cred_int, colour = cred_int),
data = df,
linewidth = 0.5
) +
geom_point(
mapping = aes(day, ratio),
data = clinical$ratio
) +
scale_x_continuous(
"Time (days)",
breaks = scales::breaks_width(10)
) +
scale_y_log10("iRBC ratio (spleen % / circulation %)") +
scale_colour_brewer(NULL) +
scale_fill_brewer(NULL) +
guides(colour = guide_none())
}
plot_sensitivity_analysis_results <- function(df, clinical) {
```{r plot-results-vs-data, class.source = 'fold-hide'}
plot_results_vs_data <- function(df, clinical) {
# Plot uninfected and infected RBC populations against clinical data.
quantiles <- c(0.05, 0.25, 0.5, 0.75, 0.95)
labels <- c(
"U_t" = "Uninfected RBCs: Circulation",
"Ur_t" = "Uninfected RBCs: Spleen",
"I_t" = "Infected RBCs: Circulation",
"Ir_t" = "Infected RBCs: Spleen"
"Ir_t" = "Infected RBCs: Spleen",
"iRBC_Ratio" = "iRBC: (Spleen % / Circulation %)"
)
df <- df |>
filter(name %in% c("U_t", "Ur_t", "I_t", "Ir_t")) |>
filter(name %in% names(labels)) |>
mutate(kind = labels[name])
df_splen <- bind_rows(
clinical$splen |>
select(value, kind),
clinical$ratio |> mutate(
value = ratio,
kind = "iRBC: (Spleen % / Circulation %)"
) |>
select(value, kind)
)
ggplot(df, aes()) +
geom_half_violin(
data = clinical$asymp,
......@@ -162,13 +140,20 @@ plot_sensitivity_analysis_results <- function(df, clinical) {
linewidth = 0.5
) +
geom_half_violin(
data = clinical$splen,
data = df_splen,
mapping = aes(max(df$day) + 2, value),
position = position_identity(),
draw_quantiles = quantiles,
side = "r",
width = 5
) +
geom_jitter(
data = df_splen,
mapping = aes(max(df$day) + 7, value),
colour = "#af3f3f",
shape = 8,
width = 2
) +
scale_x_continuous(
"Time (days)",
breaks = scales::breaks_width(10)
......@@ -183,44 +168,22 @@ plot_sensitivity_analysis_results <- function(df, clinical) {
## Plasmodium falciparum
```{r pf-ur-nonz, class.source = 'fold-hide', fig.cap = 'Uninfected and infected RBC populations in the circulation and spleen (blue ribbons). These are compared to data from asymptomatic Papuans (violins) who underwent splenectomy (solid lines) and who retained their spleens (dashed lines). Results are shown for simulations where \\(U_r(t) > 0\\) for all times \\(t\\).'}
plot_sensitivity_analysis_results(pf_ur_nonz, pf_clinical)
```
```{r pf-irbc-ratios-nonz, class.source = 'fold-hide', fig.cap = 'The ratio of (a) the percentage of RBCs in the spleen that are infected; to (b) the percentage of RBCs in the circulation that are infected. Black points show ratios measured in splenectomised Papuans. Results are shown for simulations where \\(U_r(t) > 0\\) for all times \\(t\\).'}
plot_irbc_ratio(pf_ur_nonz, pf_clinical)
```{r plot-pf}
#| class.source = "fold-hide",
#| fig.cap = "Uninfected and infected RBC populations in the circulation and
#| spleen (blue ribbons). These are compared to data from asymptomatic
#| Papuans (violins) who underwent splenectomy (solid lines) and who
#| retained their spleens (dashed lines)."
plot_results_vs_data(pf_results, pf_clinical)
```
## Plasmodium vivax
```{r pv-i-nonz, class.source = 'fold-hide', fig.cap = 'Uninfected and infected RBC populations in the circulation and spleen (blue ribbons). These are compared to data from asymptomatic Papuans (violins) who underwent splenectomy (solid lines) and who retained their spleens (dashed lines). Results are shown for simulations where \\(I_c(t) > 0\\) and \\(I_r(t) > 0\\) for all times \\(t\\).'}
plot_sensitivity_analysis_results(pv_i_nonz, pv_clinical)
```
```{r pv-irbc-ratios-nonz, class.source = 'fold-hide', fig.cap = 'The ratio of (a) the percentage of RBCs in the spleen that are infected; to (b) the percentage of RBCs in the circulation that are infected. Black points show ratios measured in splenectomised Papuans. Results are shown for simulations where \\(U_r(t) > 0\\) for all times \\(t\\).'}
plot_irbc_ratio(pv_i_nonz, pv_clinical)
```
## Simulations where cell populations reach zero
For a small number of model simulations in the sensitivity analyses, we observed that all of the RBCs retained in the spleen became infected (Pf) or the infection was cleared (Pv).
### Plasmodium falciparum
```{r pf-ur-zero, class.source = 'fold-hide', fig.cap = 'Uninfected and infected RBC populations in the circulation and spleen (blue ribbons). These are compared to data from asymptomatic Papuans (violins) who underwent splenectomy (solid lines) and who retained their spleens (dashed lines). Results are shown for simulations where \\(U_r(t) = 0\\) for one or more times \\(t\\).'}
plot_sensitivity_analysis_results(pf_ur_zero, pf_clinical)
```
```{r pf-irbc-ratios-zero, class.source = 'fold-hide', fig.cap = 'The ratio of (a) the percentage of RBCs in the spleen that are infected; to (b) the percentage of RBCs in the circulation that are infected. Black points show ratios measured in splenectomised Papuans.'}
plot_irbc_ratio(pf_ur_zero, pf_clinical)
```
### Plasmodium vivax
```{r pv-i-zero, class.source = 'fold-hide', fig.cap = 'Uninfected and infected RBC populations in the circulation and spleen (blue ribbons). These are compared to data from asymptomatic Papuans (violins) who underwent splenectomy (solid lines) and who retained their spleens (dashed lines). Results are shown for simulations where \\(I_c(t) = 0\\) or \\(I_r(t) = 0\\) for one or more times \\(t\\).'}
plot_sensitivity_analysis_results(pv_i_zero, pv_clinical)
```
```{r pv-irbc-ratios-zero, class.source = 'fold-hide', fig.cap = 'The ratio of (a) the percentage of RBCs in the spleen that are infected; to (b) the percentage of RBCs in the circulation that are infected. Black points show ratios measured in splenectomised Papuans.'}
plot_irbc_ratio(pv_i_zero, pv_clinical)
```{r plot-pv}
#| class.source = "fold-hide",
#| fig.cap = "Uninfected and infected RBC populations in the circulation and
#| spleen (blue ribbons). These are compared to data from asymptomatic
#| Papuans (violins) who underwent splenectomy (solid lines) and who
#| retained their spleens (dashed lines)."
plot_results_vs_data(pv_results, pv_clinical)
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment