Skip to content

Commit

Permalink
Added CQ vivax drug parameter sets, including hypnozoite drug paramet…
Browse files Browse the repository at this point in the history
…ers.

Default drug parameters have been relabelled using parasite species names, although the original names have been left in for now, so that it can still be compatable with previous code. All the tests and vignettes use the parasite named parameters sets.

Treatment, MDA and PMC code now includes hypnozoite clearance when these drugs are used.

Added drug prophylaxis effects to human infection, preventing new hypnozoite batch formation.
  • Loading branch information
RJSheppard committed Oct 25, 2024
1 parent fa12d59 commit a24ebdd
Show file tree
Hide file tree
Showing 28 changed files with 310 additions and 61 deletions.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Generated by roxygen2: do not edit by hand

export(AL_params)
export(AL_params_falciparum)
export(CQ_PQ_params_vivax)
export(CQ_params_vivax)
export(DHA_PQP_params)
export(DHA_PQP_params_falciparum)
export(SP_AQ_params)
export(SP_AQ_params_falciparum)
export(arab_params)
export(create_pev_profile)
export(fun_params)
Expand Down
59 changes: 55 additions & 4 deletions R/drug_parameters.R
Original file line number Diff line number Diff line change
@@ -1,44 +1,95 @@
#' @title Preset parameters for the DHA-PQP drug
#' @description From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014)
#' @details Use a vector of preset parameters for the DHA-PQP drug (dihydroartemisinin-piperaquine)
#' @details Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.09434, drug_prophylaxis_shape: 4.4, drug_prophylaxis_scale: 28.1
#' @export
DHA_PQP_params_falciparum <- c(.95, 0.09434, 4.4, 28.1)

#' @title Preset parameters for the DHA-PQP drug
#' @description From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014)
#' @details Use a vector of preset parameters for the DHA-PQP drug (dihydroartemisinin-piperaquine)
#' @details Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.09434, drug_prophylaxis_shape: 4.4, drug_prophylaxis_scale: 28.1
#' @export
DHA_PQP_params <- c(.95, 0.09434, 4.4, 28.1)

#' @title Preset parameters for the AL drug
#' @description From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014)
#' @details Use a vector of preset parameters for the AL drug (artemether-lumefantrine)
#' @details Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.05094, drug_prophylaxis_shape: 11.3, drug_prophylaxis_scale: 10.6
#' @export
AL_params_falciparum <- c(.95, 0.05094, 11.3, 10.6)

#' @title Preset parameters for the AL drug
#' @description From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014)
#' @details Use a vector of preset parameters for the AL drug (artemether-lumefantrine)
#' @details Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.05094, drug_prophylaxis_shape: 11.3, drug_prophylaxis_scale: 10.6
#' @export
AL_params <- c(.95, 0.05094, 11.3, 10.6)

#' @title Preset parameters for the SP-AQ drug
#' @details Use a vector of preset parameters for the SP-AQ drug (sulphadoxine-pyrimethamine and amodiaquine)
#' @details Default parameters, from L to R, are: drug_efficacy: 0.9, drug_rel_c: 0.32, drug_prophylaxis_shape: 4.3, drug_prophylaxis_scale: 38.1
#' @export
SP_AQ_params_falciparum <- c(0.9, 0.32, 4.3, 38.1)

#' @title Preset parameters for the SP-AQ drug
#' @details Use a vector of preset parameters for the SP-AQ drug (sulphadoxine-pyrimethamine and amodiaquine)
#' @details Default parameters, from L to R, are: drug_efficacy: 0.9, drug_rel_c: 0.32, drug_prophylaxis_shape: 4.3, drug_prophylaxis_scale: 38.1
#' @export
SP_AQ_params <- c(0.9, 0.32, 4.3, 38.1)

#' @title Preset parameters for the CQ drug acting on P. vivax
#' @description Efficacy from SI of Nekkab et al., DOI: 10.1371/journal.pmed.1003535 (2021),
#' shape and scale consistent with a longer prophylaxis time: 28 days, decreasing gradually
#' @details Use a vector of preset parameters for the CQ drug (chloroquine) acting on P. vivax
#' @details Default parameters, from L to R, are: drug_efficacy: 0.899, drug_rel_c: 0.5, drug_prophylaxis_shape: 20, drug_prophylaxis_scale: 5
#' @export
CQ_params_vivax <- c(0.899, 0.5, 5, 20)

#' @title Preset parameters for the CQ-PQ drug acting on P. vivax
#' @description Efficacy from SI of Nekkab et al., DOI: 10.1371/journal.pmed.1003535 (2021),
#' BS shape and scale consistent with a longer prophylaxis time: 28 days, decreasing gradually,
#' LS shape are scale consistent with a 7 day PQ treatment, with rapid decay.
#' @details Use a vector of preset parameters for the CQ-PQ drug (chloroquine and primaquine) acting on P. vivax
#' @details Default parameters, from L to R, are: drug_efficacy: 0.948, drug_rel_c: 0.5, drug_prophylaxis_shape: 5, drug_prophylaxis_scale: 20,
#' drug_hypnozoite_efficacy: 0.713, drug_hypnozoite_prophylaxis_shape: 10, drug_hypnozoite_prophylaxis_scale: 5.5
#' @export
CQ_PQ_params_vivax <- c(0.948, 0.5, 5, 20, 0.713, 10, 5.5)

#' @title Preset parameters for the CQ-TQ drug acting on P. vivax
#' @description Efficacy from SI of Nekkab et al., DOI: 10.1371/journal.pmed.1003535 (2021),
#' BS shape and scale consistent with a longer prophylaxis time: 28 days, decreasing gradually,
#' LS shape are scale consistent with a single TQ treatment, with longer prophylaxis: 45 days.
#' @details Use a vector of preset parameters for the CQ-TQ drug (chloroquine and tafenoquine) acting on P. vivax
#' @details Default parameters, from L to R, are: drug_efficacy: 1, drug_rel_c: 0.5, drug_prophylaxis_shape: 5, drug_prophylaxis_scale: 20,
#' drug_hypnozoite_efficacy: 0.713, drug_hypnozoite_prophylaxis_shape: 5.5, drug_hypnozoite_prophylaxis_scale: 30
CQ_TQ_params_vivax <- c(1, 0.5, 5, 20, 0.713, 5, 30)

#' @title Parameterise drugs to use in the model
#'
#' @param parameters the model parameters
#' @param drugs a list of drug parameters, can be set using presets
#' @export
set_drugs <- function(parameters, drugs) {
stopifnot(is.list(drugs))
stopifnot("is.list(drugs) is not TRUE" = is.list(drugs))
keys <- c(
'drug_efficacy',
'drug_rel_c',
'drug_prophylaxis_shape',
'drug_prophylaxis_scale'
'drug_prophylaxis_scale',
# hypnozoite parameters
'drug_hypnozoite_efficacy',
'drug_hypnozoite_prophylaxis_shape',
'drug_hypnozoite_prophylaxis_scale'
)

for (drug in seq_along(drugs)) {
for (i in seq_along(drugs[[drug]])) {
parameters[[keys[[i]]]] <- c(parameters[[keys[[i]]]], drugs[[drug]][[i]])
parameters[[keys[[i]]]][drug] <- drugs[[drug]][[i]]
}
}
parameters
}

#' @title Parameterise clinical treatment
#'
#' @param parameters the model parameters
Expand Down
43 changes: 41 additions & 2 deletions R/human_infection.R
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,33 @@ relapse_bite_infection_hazard_resolution <- function(
## all bitten humans with an infectious bite (incorporating prophylaxis) get a new batch of hypnozoites
if(bite_infections$size()>0){

## drug prophylaxis may limit formation of new hypnozoite batches
ls_prophylaxis <- rep(0, bite_infections$size())
if(length(parameters$drug_hypnozoite_efficacy) > 0){

ls_drug <- variables$ls_drug$get_values(bite_infections)
ls_medicated <- (ls_drug > 0)
ls_medicated[ls_drug > 0] <- !is.na(parameters$drug_hypnozoite_efficacy[ls_drug])

if (any(ls_medicated)) {
ls_drug <- ls_drug[ls_medicated]
ls_drug_time <- variables$ls_drug_time$get_values(bite_infections)[ls_medicated]
ls_prophylaxis[ls_medicated] <- weibull_survival(
timestep - ls_drug_time,
parameters$drug_hypnozoite_prophylaxis_shape[ls_drug],
parameters$drug_hypnozoite_prophylaxis_scale[ls_drug]
)
}
}

# make sure batches are capped
current_batches <- variables$hypnozoites$get_values(bite_infections)
new_hypnozoite_batch_formed <- bitset_at(bite_infections, bernoulli_multi_p(1 - ls_prophylaxis))
current_batches <- variables$hypnozoites$get_values(new_hypnozoite_batch_formed)
new_batch_number <- pmin(current_batches + 1, parameters$kmax)

variables$hypnozoites$queue_update(
new_batch_number,
bite_infections
new_hypnozoite_batch_formed
)
}
}
Expand Down Expand Up @@ -729,6 +749,15 @@ calculate_treated <- function(
)
}

# Update liver stage drug effects
if(length(parameters$drug_hynozoite_efficacy) > 0){
if(successfully_treated$successfully_treated_hypnozoites$size() > 0){
variables$hypnozoites$queue_update(0, successfully_treated$successfully_treated_hypnozoites)
variables$ls_drug$queue_update(drug, successfully_treated$successfully_treated_hypnozoites)
variables$ls_drug_time$queue_update(timestep, successfully_treated$successfully_treated_hypnozoites)
}
}

successfully_treated$successfully_treated

}
Expand Down Expand Up @@ -808,6 +837,16 @@ calculate_successful_treatments <- function(
successfully_treated = successfully_treated)

}

if(length(parameters$drug_hypnozoite_efficacy) > 0){
effectively_treated_hypnozoites_index <- bernoulli_multi_p(parameters$drug_hypnozoite_efficacy[drugs])
successfully_treated_hypnozoites <- bitset_at(target, effectively_treated_hypnozoites_index)
successfully_treated_list <- c(
successfully_treated_list,
successfully_treated_hypnozoites = successfully_treated_hypnozoites
)
}

successfully_treated_list
}

Expand Down
9 changes: 9 additions & 0 deletions R/mda_processes.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ update_mass_drug_admin <- function(
variables$drug_time$queue_update(timestep, target$successfully_treated)

}

# Update liver stage drug effects
if(length(parameters$drug_hypnozoite_efficacy) > 0){
if(target$successfully_treated_hypnozoites$size() > 0){
variables$hypnozoites$queue_update(0, target$successfully_treated_hypnozoites)
variables$ls_drug$queue_update(drug, target$successfully_treated_hypnozoites)
variables$ls_drug_time$queue_update(timestep, target$successfully_treated_hypnozoites)
}
}
}

#' @title Calculate asymptomatic detectable individuals
Expand Down
3 changes: 3 additions & 0 deletions R/parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ get_parameters <- function(overrides = list(), parasite = "falciparum") {
drug_rel_c = numeric(0),
drug_prophylaxis_shape = numeric(0),
drug_prophylaxis_scale = numeric(0),
drug_hypnozoite_efficacy = numeric(0),
drug_hypnozoite_prophylaxis_shape = numeric(0),
drug_hypnozoite_prophylaxis_scale = numeric(0),
clinical_treatment_drugs = list(),
clinical_treatment_timesteps = list(),
clinical_treatment_coverages = list(),
Expand Down
1 change: 0 additions & 1 deletion R/pmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,5 @@ create_pmc_process <- function(
timestep,
drug
)

}
}
2 changes: 1 addition & 1 deletion R/processes.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ create_processes <- function(
immunity_process = create_exponential_decay_process(variables$ica,
parameters$rc)
)

if(parameters$parasite == "falciparum"){
processes <- c(
processes,
Expand Down
7 changes: 7 additions & 0 deletions R/variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#' * infectivity - The onward infectiousness to mosquitos
#' * drug - The last prescribed drug
#' * drug_time - The timestep of the last drug
#' * ls_drug - The last prescribed drug
#' * ls_drug_time - The timestep of the last drug
#'
#' Antimalarial resistance variables are:
#' * dt - the delay for humans to move from state Tr to state S
Expand Down Expand Up @@ -286,6 +288,11 @@ create_variables <- function(parameters) {
drug <- individual::IntegerVariable$new(rep(0, size))
drug_time <- individual::IntegerVariable$new(rep(-1, size))

if(length(parameters$drug_hypnozoite_efficacy) > 0){
ls_drug <- individual::IntegerVariable$new(rep(0, size))
ls_drug_time <- individual::IntegerVariable$new(rep(-1, size))
}

last_pev_timestep <- individual::IntegerVariable$new(rep(-1, size))
last_eff_pev_timestep <- individual::IntegerVariable$new(rep(-1, size))
pev_profile <- individual::IntegerVariable$new(rep(-1, size))
Expand Down
21 changes: 21 additions & 0 deletions man/AL_params_falciparum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions man/CQ_PQ_params_vivax.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions man/CQ_TQ_params_vivax.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions man/CQ_params_vivax.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/DHA_PQP_params_falciparum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/SP_AQ_params_falciparum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a24ebdd

Please sign in to comment.