diff --git a/NAMESPACE b/NAMESPACE index d3fe01a6..b5a7c879 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/drug_parameters.R b/R/drug_parameters.R index 4f205604..678c3e92 100644 --- a/R/drug_parameters.R +++ b/R/drug_parameters.R @@ -1,3 +1,10 @@ +#' @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) @@ -5,6 +12,13 @@ #' @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) @@ -12,33 +26,70 @@ DHA_PQP_params <- c(.95, 0.09434, 4.4, 28.1) #' @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 diff --git a/R/human_infection.R b/R/human_infection.R index f0854f93..f949d956 100644 --- a/R/human_infection.R +++ b/R/human_infection.R @@ -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 ) } } @@ -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 } @@ -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 } diff --git a/R/mda_processes.R b/R/mda_processes.R index 81ba0b7e..dd782ba7 100644 --- a/R/mda_processes.R +++ b/R/mda_processes.R @@ -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 diff --git a/R/parameters.R b/R/parameters.R index f113d908..29ff70da 100644 --- a/R/parameters.R +++ b/R/parameters.R @@ -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(), diff --git a/R/pmc.R b/R/pmc.R index 6397c681..f8f41ecc 100644 --- a/R/pmc.R +++ b/R/pmc.R @@ -63,6 +63,5 @@ create_pmc_process <- function( timestep, drug ) - } } \ No newline at end of file diff --git a/R/processes.R b/R/processes.R index 3e50cfb0..3048ba6e 100644 --- a/R/processes.R +++ b/R/processes.R @@ -47,7 +47,7 @@ create_processes <- function( immunity_process = create_exponential_decay_process(variables$ica, parameters$rc) ) - + if(parameters$parasite == "falciparum"){ processes <- c( processes, diff --git a/R/variables.R b/R/variables.R index 9745d026..a2f81e0d 100644 --- a/R/variables.R +++ b/R/variables.R @@ -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 @@ -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)) diff --git a/man/AL_params_falciparum.Rd b/man/AL_params_falciparum.Rd new file mode 100644 index 00000000..698f09e0 --- /dev/null +++ b/man/AL_params_falciparum.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/drug_parameters.R +\docType{data} +\name{AL_params_falciparum} +\alias{AL_params_falciparum} +\title{Preset parameters for the AL drug} +\format{ +An object of class \code{numeric} of length 4. +} +\usage{ +AL_params_falciparum +} +\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) + +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 +} +\keyword{datasets} diff --git a/man/CQ_PQ_params_vivax.Rd b/man/CQ_PQ_params_vivax.Rd new file mode 100644 index 00000000..a0938989 --- /dev/null +++ b/man/CQ_PQ_params_vivax.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/drug_parameters.R +\docType{data} +\name{CQ_PQ_params_vivax} +\alias{CQ_PQ_params_vivax} +\title{Preset parameters for the CQ-PQ drug acting on P. vivax} +\format{ +An object of class \code{numeric} of length 7. +} +\usage{ +CQ_PQ_params_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 + +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 +} +\keyword{datasets} diff --git a/man/CQ_TQ_params_vivax.Rd b/man/CQ_TQ_params_vivax.Rd new file mode 100644 index 00000000..72a66b37 --- /dev/null +++ b/man/CQ_TQ_params_vivax.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/drug_parameters.R +\docType{data} +\name{CQ_TQ_params_vivax} +\alias{CQ_TQ_params_vivax} +\title{Preset parameters for the CQ-TQ drug acting on P. vivax} +\format{ +An object of class \code{numeric} of length 7. +} +\usage{ +CQ_TQ_params_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 + +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 +} +\keyword{datasets} diff --git a/man/CQ_params_vivax.Rd b/man/CQ_params_vivax.Rd new file mode 100644 index 00000000..3a7d192e --- /dev/null +++ b/man/CQ_params_vivax.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/drug_parameters.R +\docType{data} +\name{CQ_params_vivax} +\alias{CQ_params_vivax} +\title{Preset parameters for the CQ drug acting on P. vivax} +\format{ +An object of class \code{numeric} of length 4. +} +\usage{ +CQ_params_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 + +Default parameters, from L to R, are: drug_efficacy: 0.899, drug_rel_c: 0.5, drug_prophylaxis_shape: 20, drug_prophylaxis_scale: 5 +} +\keyword{datasets} diff --git a/man/DHA_PQP_params_falciparum.Rd b/man/DHA_PQP_params_falciparum.Rd new file mode 100644 index 00000000..c4c9ac6e --- /dev/null +++ b/man/DHA_PQP_params_falciparum.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/drug_parameters.R +\docType{data} +\name{DHA_PQP_params_falciparum} +\alias{DHA_PQP_params_falciparum} +\title{Preset parameters for the DHA-PQP drug} +\format{ +An object of class \code{numeric} of length 4. +} +\usage{ +DHA_PQP_params_falciparum +} +\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) + +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 +} +\keyword{datasets} diff --git a/man/SP_AQ_params_falciparum.Rd b/man/SP_AQ_params_falciparum.Rd new file mode 100644 index 00000000..063aabfd --- /dev/null +++ b/man/SP_AQ_params_falciparum.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/drug_parameters.R +\docType{data} +\name{SP_AQ_params_falciparum} +\alias{SP_AQ_params_falciparum} +\title{Preset parameters for the SP-AQ drug} +\format{ +An object of class \code{numeric} of length 4. +} +\usage{ +SP_AQ_params_falciparum +} +\description{ +Preset parameters for the SP-AQ drug +} +\details{ +Use a vector of preset parameters for the SP-AQ drug (sulphadoxine-pyrimethamine and amodiaquine) + +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 +} +\keyword{datasets} diff --git a/tests/testthat/test-antimalarial-resistance.R b/tests/testthat/test-antimalarial-resistance.R index ae45a20e..4ed0afac 100644 --- a/tests/testthat/test-antimalarial-resistance.R +++ b/tests/testthat/test-antimalarial-resistance.R @@ -1,6 +1,6 @@ test_that('set_antimalarial_resistance() toggles resistance on', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -21,7 +21,7 @@ test_that('set_antimalarial_resistance() toggles resistance on', { test_that('set_antimalarial_resistance() errors if parameter inputs of different length to timesteps', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -41,7 +41,7 @@ test_that('set_antimalarial_resistance() errors if parameter inputs of different test_that('set_antimalarial_resistance() errors if resistance proportions outside of range 0-1', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -62,7 +62,7 @@ test_that('set_antimalarial_resistance() errors if resistance proportions outsid test_that('set_antimalarial_resistance() errors if resistance phenotype probabilities outside bound of 0-1', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -82,7 +82,7 @@ test_that('set_antimalarial_resistance() errors if resistance phenotype probabil test_that('set_antimalarial_resistance() errors if drug index > than number of drugs assigned using set_drugs()', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -103,7 +103,7 @@ test_that('set_antimalarial_resistance() errors if drug index > than number of d test_that('set_antimalarial_resistance() assigns parameters correctly despite order in which resistance parameters are specified', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params, SP_AQ_params, DHA_PQP_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum, SP_AQ_params_falciparum, DHA_PQP_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 2, timesteps = 1, coverages = 0.2) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 0.1) parameters <- set_clinical_treatment(parameters = parameters, drug = 3, timesteps = 1, coverages = 0.4) @@ -158,7 +158,7 @@ test_that('set_antimalarial_resistance() assigns parameters correctly despite or test_that("set_antimalarial_resistance errors if length slow_parasite_clearance_time > 1", { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = c(0, 10), @@ -182,7 +182,7 @@ test_that("set_antimalarial_resistance errors if length slow_parasite_clearance_ test_that("set_antimalarial_resistance errors if slow_parasite_clearance_time not positive", { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = c(0, 10), @@ -206,7 +206,7 @@ test_that("set_antimalarial_resistance errors if slow_parasite_clearance_time no test_that('get_antimalarial_resistance_parameters() correctly retrieves parameters when multiple drugs assigned', { get_parameters(overrides = list(human_population = 10000)) |> - set_drugs(drugs = list(AL_params, SP_AQ_params, DHA_PQP_params)) |> + set_drugs(drugs = list(AL_params_falciparum, SP_AQ_params_falciparum, DHA_PQP_params_falciparum)) |> set_clinical_treatment(drug = 1, timesteps = 1, coverages = 0.4) |> set_clinical_treatment(drug = 2, timesteps = 1, coverages = 0.3) |> set_clinical_treatment(drug = 3, timesteps = 1, coverages = 0.2) |> @@ -266,7 +266,7 @@ test_that('get_antimalarial_resistance_parameters() correctly retrieves paramete test_that('get_antimalarial_resistance_parameters() correctly retrieves parameters when not all drugs assigned resistance', { get_parameters(overrides = list(human_population = 10000)) %>% - set_drugs(drugs = list(AL_params, SP_AQ_params, DHA_PQP_params)) %>% + set_drugs(drugs = list(AL_params_falciparum, SP_AQ_params_falciparum, DHA_PQP_params_falciparum)) %>% set_clinical_treatment(drug = 1, timesteps = 1, coverages = 0.4) %>% set_clinical_treatment(drug = 2, timesteps = 1, coverages = 0.3) %>% set_clinical_treatment(drug = 3, timesteps = 1, coverages = 0.2) %>% @@ -306,7 +306,7 @@ test_that('get_antimalarial_resistance_parameters() correctly retrieves paramete test_that('get_antimalarial_resistance_parameters() returns an error when antimalarial resistance has not been parameterised', { get_parameters(overrides = list(human_population = 10000)) %>% - set_drugs(drugs = list(AL_params, SP_AQ_params, DHA_PQP_params)) %>% + set_drugs(drugs = list(AL_params_falciparum, SP_AQ_params_falciparum, DHA_PQP_params_falciparum)) %>% set_clinical_treatment(drug = 1, timesteps = 1, coverages = 0.4) %>% set_clinical_treatment(drug = 2, timesteps = 1, coverages = 0.3) %>% set_clinical_treatment(drug = 3, timesteps = 1, coverages = 0.2) %>% diff --git a/tests/testthat/test-infection-integration.R b/tests/testthat/test-infection-integration.R index a4bcd1ab..c9c5921f 100644 --- a/tests/testthat/test-infection-integration.R +++ b/tests/testthat/test-infection-integration.R @@ -172,7 +172,7 @@ test_that('simulate_infection integrates different types of infection and schedu test_that('calculate_infections works various combinations of drug and vaccination', { timestep <- 50 parameters <- get_parameters() - parameters <- set_drugs(parameters, list(AL_params, DHA_PQP_params)) + parameters <- set_drugs(parameters, list(AL_params_falciparum, DHA_PQP_params_falciparum)) parameters <- set_clinical_treatment(parameters, 2, 1, .5) parameters <- set_mass_pev( parameters, @@ -313,7 +313,7 @@ test_that('calculate_clinical_infections correctly samples clinically infected', test_that('calculate_treated correctly samples treated and updates the drug state', { parameters <- get_parameters() - parameters <- set_drugs(parameters, list(AL_params, DHA_PQP_params)) + parameters <- set_drugs(parameters, list(AL_params_falciparum, DHA_PQP_params_falciparum)) parameters <- set_clinical_treatment(parameters, 1, 1, .25) parameters <- set_clinical_treatment(parameters, 2, 1, .25) timestep <- 5 @@ -380,7 +380,7 @@ test_that('calculate_treated correctly samples treated and updates the drug stat test_that('calculate_treated correctly samples treated and updates the drug state when resistance set', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params, SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum, SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 0.25) parameters <- set_clinical_treatment(parameters = parameters, drug = 2, timesteps = 1, coverages = 0.25) parameters <- set_antimalarial_resistance(parameters = parameters, @@ -496,7 +496,7 @@ test_that('calculate_treated correctly samples treated and updates the drug stat # Establish the parameters parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params, SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum, SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 0.25) parameters <- set_clinical_treatment(parameters = parameters, drug = 2, timesteps = 1, coverages = 0.25) parameters <- set_antimalarial_resistance(parameters = parameters, @@ -680,7 +680,7 @@ test_that('schedule_infections correctly schedules new infections', { test_that('prophylaxis is considered for medicated humans', { parameters <- get_parameters() - parameters <- set_drugs(parameters, list(AL_params, DHA_PQP_params)) + parameters <- set_drugs(parameters, list(AL_params_falciparum, DHA_PQP_params_falciparum)) events <- create_events(parameters) timestep <- 50 @@ -879,7 +879,7 @@ test_that('update_severe_disease renders with no infections', { test_that('calculate_treated returns empty Bitset when there is no clinical treatment coverage', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 0) parameters <- set_antimalarial_resistance(parameters = parameters, drug = 1, @@ -915,7 +915,7 @@ test_that('calculate_treated returns empty Bitset when there is no clinical trea test_that('calculate_treated returns empty Bitset when the clinically_infected input is an empty Bitset', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 1) parameters <- set_antimalarial_resistance(parameters = parameters, drug = 1, @@ -976,7 +976,7 @@ test_that('calculate_treated() returns an empty Bitset when the parameter list c test_that('Number of treatment failures matches number of individuals treated when artemisinin resistance proportion and early treatment failure probability both set to 1', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params, SP_AQ_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum, SP_AQ_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -1030,7 +1030,7 @@ test_that('Number of treatment failures matches number of individuals treated wh test_that('calculate_treated() successfully adds additional resistance columns to the renderer', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 1) parameters <- set_antimalarial_resistance(parameters = parameters, drug = 1, diff --git a/tests/testthat/test-mda.R b/tests/testthat/test-mda.R index e2db7f67..904d242a 100644 --- a/tests/testthat/test-mda.R +++ b/tests/testthat/test-mda.R @@ -58,7 +58,7 @@ test_that('MDA moves the diseased and non-diseased population correctly', { timestep <- 50 renderer <- individual::Render$new(timestep) parameters <- get_parameters(list(human_population = 4)) - parameters <- set_drugs(parameters, list(SP_AQ_params)) + parameters <- set_drugs(parameters, list(SP_AQ_params_falciparum)) parameters <- set_mda( parameters, drug = 1, @@ -82,6 +82,8 @@ test_that('MDA moves the diseased and non-diseased population correctly', { drug = mock_double(c(1, 2, 1, 2)) ) + events$mda_administer <- mock_event(events$mda_administer) + listener <- create_mda_listeners( variables, parameters$mda_drug, @@ -121,7 +123,7 @@ test_that('MDA moves the diseased and non-diseased population correctly', { expect_bitset_update( variables$infectivity$queue_update_mock(), - c(.3) * SP_AQ_params[[2]], + c(.3) * SP_AQ_params_falciparum[[2]], c(3) ) @@ -148,7 +150,7 @@ test_that('MDA moves the diseased and non-diseased population correctly - second timestep <- 150 renderer <- individual::Render$new(timestep) parameters <- get_parameters(list(human_population = 4)) - parameters <- set_drugs(parameters, list(SP_AQ_params)) + parameters <- set_drugs(parameters, list(SP_AQ_params_falciparum)) parameters <- set_mda( parameters, drug = 1, @@ -211,7 +213,7 @@ test_that('MDA moves the diseased and non-diseased population correctly - second expect_bitset_update( variables$infectivity$queue_update_mock(), - c(.1, .3) * SP_AQ_params[[2]], + c(.1, .3) * SP_AQ_params_falciparum[[2]], c(1, 3) ) @@ -252,7 +254,7 @@ test_that('MDA ignores non-detectable asymptomatics', { timestep <- 150 renderer <- individual::Render$new(timestep) parameters <- get_parameters(list(human_population = 4)) - parameters <- set_drugs(parameters, list(SP_AQ_params)) + parameters <- set_drugs(parameters, list(SP_AQ_params_falciparum)) parameters <- set_mda( parameters, drug = 1, @@ -310,7 +312,7 @@ test_that('MDA ignores non-detectable asymptomatics', { expect_bitset_update( variables$infectivity$queue_update_mock(), - c(.1) * SP_AQ_params[[2]], + c(.1) * SP_AQ_params_falciparum[[2]], c(1) ) diff --git a/tests/testthat/test-mortality-integration.R b/tests/testthat/test-mortality-integration.R index 6ea850e7..7d914971 100644 --- a/tests/testthat/test-mortality-integration.R +++ b/tests/testthat/test-mortality-integration.R @@ -1,7 +1,7 @@ test_that('mortality_process resets humans correctly', { timestep <- 2 parameters <- get_parameters(list(human_population = 4)) - parameters <- set_drugs(parameters, list(SP_AQ_params)) + parameters <- set_drugs(parameters, list(SP_AQ_params_falciparum)) parameters <- set_mda( parameters, drug = 1, diff --git a/tests/testthat/test-pmc.R b/tests/testthat/test-pmc.R index 8622f16f..4ff421c8 100644 --- a/tests/testthat/test-pmc.R +++ b/tests/testthat/test-pmc.R @@ -9,7 +9,7 @@ test_that("pmc parameterisation works", { p <- set_drugs( parameters = p, - drugs = list(SP_AQ_params)) + drugs = list(SP_AQ_params_falciparum)) p <- set_pmc( parameters = p, drug = 1, @@ -50,7 +50,7 @@ test_that("pmc gives drugs to correct ages", { p <- get_parameters(list(human_population = 6)) p <- set_drugs( parameters = p, - drugs = list(SP_AQ_params)) + drugs = list(SP_AQ_params_falciparum)) p <- set_pmc( parameters = p, @@ -123,4 +123,3 @@ test_that("pmc gives drugs to correct ages", { c(2, 3, 5) ) }) - \ No newline at end of file diff --git a/tests/testthat/test-resume.R b/tests/testthat/test-resume.R index 954fd063..a9068976 100644 --- a/tests/testthat/test-resume.R +++ b/tests/testthat/test-resume.R @@ -131,7 +131,7 @@ test_that("TBV intervention can be added when resuming", { test_that("MDA intervention can be added when resuming", { set_default_mda <- function(parameters, timesteps) { - parameters %>% set_drugs(list(SP_AQ_params)) %>% set_mda( + parameters %>% set_drugs(list(SP_AQ_params_falciparum)) %>% set_mda( drug = 1, timesteps = timesteps, coverages = rep(0.8, length(timesteps)), @@ -217,7 +217,7 @@ test_that("Correlations can be set when resuming with new interventions", { coverage=tbv_coverage, ages=0:200) - drug <- SP_AQ_params + drug <- SP_AQ_params_falciparum drug[1] <- 1. # Override the drug efficacy to 100% parameters <- warmup_parameters %>% set_drugs(list(drug)) %>% diff --git a/tests/testthat/test-treatment.R b/tests/testthat/test-treatment.R index 9e40c0da..26d5a89d 100644 --- a/tests/testthat/test-treatment.R +++ b/tests/testthat/test-treatment.R @@ -1,7 +1,7 @@ test_that('You can set time varying clinical treatment', { parameters <- get_parameters() - parameters <- set_drugs(parameters, list(DHA_PQP_params, AL_params)) + parameters <- set_drugs(parameters, list(DHA_PQP_params_falciparum, AL_params_falciparum)) parameters <- set_clinical_treatment( parameters, drug = 1, @@ -62,7 +62,7 @@ test_that('You can set time varying clinical treatment', { test_that('You cannot set invalid coverages', { parameters <- get_parameters() - parameters <- set_drugs(parameters, list(DHA_PQP_params, AL_params)) + parameters <- set_drugs(parameters, list(DHA_PQP_params_falciparum, AL_params_falciparum)) parameters <- set_clinical_treatment( parameters, drug = 1, @@ -82,7 +82,7 @@ test_that('You cannot set invalid coverages', { test_that('set_drugs errors if a list is not provided', { parameters <- get_parameters() expect_error( - set_drugs(parameters, AL_params), + set_drugs(parameters, AL_params_falciparum), "is.list(drugs) is not TRUE", fixed = TRUE ) diff --git a/tests/testthat/test-vivax.R b/tests/testthat/test-vivax.R index 58ee404b..4b14f2ad 100644 --- a/tests/testthat/test-vivax.R +++ b/tests/testthat/test-vivax.R @@ -280,11 +280,11 @@ test_that('relapses are recognised with division between bite infections and rel hypnozoites = individual::IntegerVariable$new(c(0, 1, 2, 3)) ) - bernoulli_mock <- mockery::mock(c(1, 3), 2, cycle = TRUE) + bernoulli_mock <- mockery::mock(c(1, 3), 1, 2, cycle = TRUE) calc_mock <- mockery::mock(individual::Bitset$new(4)$insert(2)) mockery::stub(vivax_infection_outcome_process, 'bernoulli_multi_p', bernoulli_mock, depth = 2) mockery::stub(vivax_infection_outcome_process, 'calculate_clinical_infections', calc_mock) - + renderer <- mock_render(1) infected_humans <- individual::Bitset$new(4)$insert(c(1, 2, 3, 4)) diff --git a/vignettes/Antimalarial_Resistance.Rmd b/vignettes/Antimalarial_Resistance.Rmd index 3bd2fb1a..dea04c77 100644 --- a/vignettes/Antimalarial_Resistance.Rmd +++ b/vignettes/Antimalarial_Resistance.Rmd @@ -36,7 +36,7 @@ Simulations capturing the effects of resistance to clinical treatment using anti To illustrate how to parameterise resistance to an ACT using the `set_antimalarial_resistance()` function, we'll set-up and run three simulations. The first simulates malaria transmission in the absence of interventions or resistance. The second simulates a simple regime of clinical treatment in which 80% of clinical cases are treated with artemether lumefantrine (AL), beginning after one year, in the absence of antimalarial resistance. The third simulates the same clinical treatment programme but with resistance to the artemisinin component of AL emerging after two years. For illustrative purposes, we assume that the proportion of infections resistant to the artemisinin component of AL increases from 0% to 80%, and that these infections have a 90% chance of resulting in early treatment failure. ### Parameterisation -First, we load the default `malariasimulation` model parameters, using the `overrides` argument to increase the human population. The human and mosquito population parameters are then calibrated to a user-specified initial EIR using the `set_equilibrium()` function. Next, we load the in-built parameters for the antimalarial drug AL and append them to the parameter list using `set_drugs()`. We can then use `set_clinical_treatment()` to specify a clinical treatment regime, beginning after one year, that treats, on average, 80% of the clinical cases of malaria with AL (`AL_params`). The `set_antimalarial_resistance()` function is then used to specify a scenario in which resistance is initially absent from the population, but after two years the proportion of malaria infections that are resistant to the artemisinin component of AL rises to 80%. We also set the probability that artemisinin-resistant infections result in early treatment failure to 0.9. In the current instance, we've set the proportion of infections resistant to the AL partner drug to 0% and the probabilities of other resistant infection outcomes to zero for simplicity. +First, we load the default `malariasimulation` model parameters, using the `overrides` argument to increase the human population. The human and mosquito population parameters are then calibrated to a user-specified initial EIR using the `set_equilibrium()` function. Next, we load the in-built parameters for the antimalarial drug AL and append them to the parameter list using `set_drugs()`. We can then use `set_clinical_treatment()` to specify a clinical treatment regime, beginning after one year, that treats, on average, 80% of the clinical cases of malaria with AL (`AL_params_falciparum`). The `set_antimalarial_resistance()` function is then used to specify a scenario in which resistance is initially absent from the population, but after two years the proportion of malaria infections that are resistant to the artemisinin component of AL rises to 80%. We also set the probability that artemisinin-resistant infections result in early treatment failure to 0.9. In the current instance, we've set the proportion of infections resistant to the AL partner drug to 0% and the probabilities of other resistant infection outcomes to zero for simplicity. ```{r, eval = TRUE} @@ -62,7 +62,7 @@ simparams <- get_parameters( simparams <- set_equilibrium(parameters = simparams, init_EIR = init_EIR) # Append the parameters for artemether lumefantrine (AL) to the parameter list: -simparams_clin_treatment <- set_drugs(parameters = simparams, drugs = list(AL_params)) +simparams_clin_treatment <- set_drugs(parameters = simparams, drugs = list(AL_params_falciparum)) # Use the set_clinical_treatment() function to specify a treatment regime for AL: simparams_clin_treatment <- set_clinical_treatment(parameters = simparams_clin_treatment, @@ -153,7 +153,7 @@ In the absence of clinical treatment or resistance, prevalence is comparable bet We can also capture scenarios in which resistance to a drug changes through time. To illustrate, we'll establish and simulate a scenario in which resistance to sulfadoxine-pyrimethamine amodiaquine (SP-AQ) is absent from the population in the first year, but emerges in the third year and doubles in proportion each year thereafter until 100% of infections are artemisinin resistant. For simplicity, we'll assume only artemisinin resistance is present in the population, and resistance to artemisinin results only, and always, in early treatment failure. ### Parameterisation -First, we store in vectors the artemisinin resistance proportions and the time steps on which they will be updated in the simulation. We also create a vector of early treatment failure probabilities which, for simplicity, we assume remain at 1 for each update. Next, we load the default `malariasimulation` parameter set, specifying a larger population size and seasonal transmission, and append the parameters for SP-AQ (`SP_AQ_params`) using the `set_drugs()` function. We'll specify a simple treatment regimen using `set_clinical_treatment()` where, on average, 80% of clinical cases are treated with SP-AQ, beginning after one year. We then specify a resistance schedule in which artemisinin resistance is introduced at a proportion of 0.2 after 3 years, and doubles each year thereafter until all infections are artemisinin resistant. Finally, we calibrate the human and mosquito population parameters to a defined entomological inoculation rate (EIR) and are ready to run the simulation. +First, we store in vectors the artemisinin resistance proportions and the time steps on which they will be updated in the simulation. We also create a vector of early treatment failure probabilities which, for simplicity, we assume remain at 1 for each update. Next, we load the default `malariasimulation` parameter set, specifying a larger population size and seasonal transmission, and append the parameters for SP-AQ (`SP_AQ_params_falciparum`) using the `set_drugs()` function. We'll specify a simple treatment regimen using `set_clinical_treatment()` where, on average, 80% of clinical cases are treated with SP-AQ, beginning after one year. We then specify a resistance schedule in which artemisinin resistance is introduced at a proportion of 0.2 after 3 years, and doubles each year thereafter until all infections are artemisinin resistant. Finally, we calibrate the human and mosquito population parameters to a defined entomological inoculation rate (EIR) and are ready to run the simulation. ```{r, eval = TRUE} @@ -183,7 +183,7 @@ simparams <- get_parameters( )) # Append the parameters for sulfadomamine pyrimethaine (SP-AQ) to the parameter list: -simparams <- set_drugs(parameters = simparams, drugs = list(SP_AQ_params)) +simparams <- set_drugs(parameters = simparams, drugs = list(SP_AQ_params_falciparum)) # Use the set_clinical_treatment() function to specify a treatment regime for SP-AQ: simparams <- set_clinical_treatment(parameters = simparams, @@ -278,7 +278,7 @@ get_parameters(overrides = list(human_population = 1000)) -> simulation_paramete # Establish a parameter list with clinical treatment starting after one year: simulation_parameters$base |> - set_drugs(drugs = list(AL_params)) |> + set_drugs(drugs = list(AL_params_falciparum)) |> set_clinical_treatment(drug = 1, timesteps = (365 * 1) + 1, coverages = c(0.8)) |> set_equilibrium(init_EIR = 16) -> simulation_parameters$treatment diff --git a/vignettes/EIRprevmatch.Rmd b/vignettes/EIRprevmatch.Rmd index cdf46b21..5f9101fa 100644 --- a/vignettes/EIRprevmatch.Rmd +++ b/vignettes/EIRprevmatch.Rmd @@ -103,7 +103,7 @@ simparams <- set_species(parameters = simparams, # Use the set_drugs() function to append the in-built parameters for the # drug artemether lumefantrine (AL): -simparams <- set_drugs(simparams, list(AL_params)) +simparams <- set_drugs(simparams, list(AL_params_falciparum)) # Use the set_clinical_treatment() function to parameterise human # population treatment with AL in the first timestep: diff --git a/vignettes/MDA.Rmd b/vignettes/MDA.Rmd index 2da93a6e..bd38d15a 100644 --- a/vignettes/MDA.Rmd +++ b/vignettes/MDA.Rmd @@ -63,7 +63,7 @@ simparams <- set_equilibrium(simparams, starting_EIR) ### Interventions -Having established a base set of parameters (`simparams`), the next step is to add the parameters specifying the MDA campaign. We first use the `set_drugs()` function to update the parameter list (`simparams`) with the parameter values for the drug(s) we wish to simulate, in this case using the in-built parameter set for SP-AQ (`SP_AQ_params`). Note that the `malariasimulation` package also contains in-built parameter sets for dihydroartemisinin-piperaquine (`DHA_PQP_params`) and artemether lumefantrine (`AL_params`), and users can also define their own drug parameters. +Having established a base set of parameters (`simparams`), the next step is to add the parameters specifying the MDA campaign. We first use the `set_drugs()` function to update the parameter list (`simparams`) with the parameter values for the drug(s) we wish to simulate, in this case using the in-built parameter set for SP-AQ (`SP_AQ_params_falciparum`). Note that the `malariasimulation` package also contains in-built parameter sets for dihydroartemisinin-piperaquine (`DHA_PQP_params_falciparum`) and artemether lumefantrine (`AL_params_falciparum`), and users can also define their own drug parameters. We then define the time steps on which we want the MDA to occur (stored here in the vector `mda_events` for legibility), and use the `set_mda()` function to update the parameter list with our MDA campaign parameters. `set_mda()` takes as its first two arguments the base parameter list and the time steps on which to schedule MDA events. This function also requires the user to specify the proportion of the population they want to treat using `coverages`, as well as the age-range of the population we want to treat using `min_ages` and `max_ages`, *for each timestep on which MDA is scheduled*. Note that this enables users to specify individual events to have different drug, coverage, and human-target properties. The `drug` argument refers to the index of the drug we want to distribute in the MDA in the list of parameters (in this demonstration we have only added a single drug, SP-AQ, using `set_drugs()`, but we could have specified additional drugs). @@ -73,7 +73,7 @@ mdaparams <- simparams # Update the parameter list with the default parameters for sulphadoxine-pyrimethamine # amodiaquine (SP-AQ) -mdaparams <- set_drugs(mdaparams, list(SP_AQ_params)) +mdaparams <- set_drugs(mdaparams, list(SP_AQ_params_falciparum)) # Specify the days on which to administer the SP-AQ mda_events <- (c(1, 2) * 365) @@ -180,7 +180,7 @@ While the first step would typically be to establish the base set of parameters, smcparams <- simparams # Append the parameters for SP-AQ using set_drugs -smcparams <- set_drugs(smcparams, list(SP_AQ_params)) +smcparams <- set_drugs(smcparams, list(SP_AQ_params_falciparum)) # Use the peak_season_offset() to calculate the yearly offset (in daily timesteps) for the peak mosq. # season diff --git a/vignettes/Metapopulation.Rmd b/vignettes/Metapopulation.Rmd index 0f3bf776..5101d5d6 100644 --- a/vignettes/Metapopulation.Rmd +++ b/vignettes/Metapopulation.Rmd @@ -47,7 +47,7 @@ ms_parameterize <- function(x){ # index of EIR individual_mosquitoes = FALSE)) # setting treatment - params <- set_drugs(params, list(AL_params)) + params <- set_drugs(params, list(AL_params_falciparum)) params <- set_clinical_treatment(params, drug = 1, timesteps = 1, coverages = 0.40) params <- set_equilibrium(params, init_EIR = EIR_vector[x]) diff --git a/vignettes/Plasmodium_vivax.Rmd b/vignettes/Plasmodium_vivax.Rmd index a9a5b22e..0a474557 100644 --- a/vignettes/Plasmodium_vivax.Rmd +++ b/vignettes/Plasmodium_vivax.Rmd @@ -73,7 +73,9 @@ While the *P. falciparum* model calculates the onward infectivity of asymptomati ### Hypnozoites -The *P. vivax* model tracks the number of hypnozoite batches of each individual which contribute to the rate of new infections. Acquisition of new batches comes from bite infections and are capped (where `kmax = 10` by default). All individuals can acquire new hypnozoite batches via bites, even when these do not result in new blood-stage infection (as in the clinically diseased and treated). Hypnozoite batches are lost probabilistically where an individual's number of batches determines the loss rate of a single batch. +The *P. vivax* model tracks the number of hypnozoite batches of each individual which then contribute to the rate of new infections. Acquisition of new batches come from bite infections, which are mediated by liver-stage drug prophylaxis, and are capped (where `kmax = 10` by default). All individuals can acquire new hypnozoite batches via bites, even when these do not result in new blood-stage infection (as in the clinically diseased and treated). Hypnozoite batches are lost probabilistically where an individual's number of batches determines the loss rate of a single batch. + +Successful liver-stage drug treatment results in the clearing of all hypnozoite batches of an individual. ### Equilibrium diff --git a/vignettes/Treatment.Rmd b/vignettes/Treatment.Rmd index 03efa301..c3e68d64 100644 --- a/vignettes/Treatment.Rmd +++ b/vignettes/Treatment.Rmd @@ -27,9 +27,9 @@ This vignette describes how to implement clinical drug treatments in malariasimu The malariasimulation package contains built-in parameters sets for three anti-malarial drugs: -1. `AL_params`: artemether-lumefantrine (AL) -2. `DHA_PQP_params`: dihydroartemisinin and piperaquine (DHA-PQP) -3. `SP_AQ_params`: sulfadoxine-pyrimethamine and amodiaquine (SP-AQ) +1. `AL_params_falciparum`: artemether-lumefantrine (AL) +2. `DHA_PQP_params_falciparum`: dihydroartemisinin and piperaquine (DHA-PQP) +3. `SP_AQ_params_falciparum`: sulfadoxine-pyrimethamine and amodiaquine (SP-AQ) While all these drugs can be used to treat malaria, DHA-PQP and SP-AQ remain in the body for some time following treatment, making them good candidates for chemoprevention in mass drug administrations (see [Mass Drug Administration and Chemoprevention](https://mrc-ide.github.io/malariasimulation/articles/MDA.html)). Any of these drugs can be included in the parameter list using the `set_drugs()` function (see [drugs_parameters.R](https://github.com/mrc-ide/malariasimulation/blob/master/R/drug_parameters.R) for full parameter details). @@ -46,7 +46,7 @@ calc_P <- function(w, lambda, t){ t <- 1:70 -P_matrix <- lapply(list(AL_params, DHA_PQP_params, SP_AQ_params), function(x){ +P_matrix <- lapply(list(AL_params_falciparum, DHA_PQP_params_falciparum, SP_AQ_params_falciparum), function(x){ calc_P(w = x[3], lambda = x[4], t = t) }) @@ -94,7 +94,7 @@ human_population <- 1000 simparams <- get_parameters(overrides = list(human_population = human_population)) # Update parameter set with chosen drug-specific parameters (AL and DHA/PQP) -drug_params <- set_drugs(simparams, list(AL_params, DHA_PQP_params)) +drug_params <- set_drugs(simparams, list(AL_params_falciparum, DHA_PQP_params_falciparum)) # Choose initial EIR to 10 starting_EIR <- 10