Learn R Programming

MGDrivE2: Mosquito Gene Drive Explorer 2

Brief Description

MGDrivE 2 is a new simulation platform which extends capabilities from the MGDrivE simulation package in a new mathematical and computational framework. For more information about MGDrivE, see our publication. Some of the notable capabilities of MGDrivE 2 include incorporation of human populations, epidemiological dynamics, time-varying parameters, and a continuous-time simulation framework with various sampling algorithms for both deterministic and stochastic interpretations.

Computational Features

The design feature that has made it possible to include a rich set of functionality into MGDrivE 2 is using a Petri net (PN) formalism to structure the software. By separating how a model is specified (state space, and events that are allowed to change state), and numerical methods which draw trajectories from a model, numerical methods in MGDrivE 2 are independent of any particular model, as long as it is expressed as a PN. Additionally, the well understood PN formalism, based on a bipartite graph describing how states and events are allowed to affect one another, means that quickly adding new features (such as human populations) can be done without needing to rewrite large parts of the existing codebase.

When assigning to each event a function that gives the current rate that event will occur (fire) at, given the present state and time, and assuming the Markov property, the simulation becomes a continuous-time Markov chain, and the PN is referred to as a stochastic Petri net (SPN). If we assume that rather than describing exponentially distributed random variables, those rate functions describe deterministic (continuous) rates of events firing, the SPN mathematically becomes a set of ordinary differential equations (ODE). In either case we can rely on the wealth of algorithms developed for solving ODEs or simulating CTMCs.

MGDrivE 2 uses the cube data structure from MGDrivE (CRAN link) to parameterize genetic inheritance.

Vignettes

There are a large number of vignettes included in MGDrivE 2 to describe its functionality. Aa a suggestion, we recommend new users to read them in the following rough order to acquaint themselves with the software.

  1. MGDrivE2: One Node Lifecycle Dynamics: this vignette describes the basic use of MGDrivE 2 in a single node, with only mosquitoes present (no epidemiology). It introduces how to build the Petri net objects, specify parameters, make a vector of hazard functions, and simulate from the SPN using several of the provided simulation algorithms.
  2. MGDrivE2: Metapopulation Network Lifecycle Dynamics: this describes how to set up and simulate metapopulation networks of mosquitoes, without introducing epidemiological dynamics yet.
  3. MGDrivE2: One Node Epidemiological Dynamics: introduces the SIS-SEI (Susceptible Infected Susceptible - Susceptible Exposed Infectious) human-mosquito epidemiological dynamics in a single node.
  4. MGDrivE2: Metapopulation Network Epidemiological Dynamics: shows the user how to simulate SIS-SEI dynamics on a metapopulation of nodes.
  5. MGDrivE2: SEIR Epidemiological Dynamics: demonstrates the SEIR-SEI (Susceptible Exposed Infectious Recovered) option for the human population, to model strongly immunizing arboviruses.
  6. MGDrivE2: Data Storage and Analysis: after a user is familiar with the basic simulation workflow, this vignette introduces the simulation functions that write output to external .CSV files on the user's system, and other functions to analyze those output; writing to external .CSV files is useful for large-scale Monte Carlo simulations.
  7. MGDrivE2: Simulation of Time-inhomogeneous Stochastic Processes (Seasonality): shows the user how to write custom time-varying hazard functions to simulate inhomogeneous (where rates depend on time) models, using temperature-driven adult mosquito mortality as an example.
  8. MGDrivE2: Advanced Topics: shows advanced users how to write their own numerical methods to sample from the SPN; uses a simple explicit Euler method for ODEs as an example.

Copy Link

Version

Install

install.packages('MGDrivE2')

Monthly Downloads

139

Version

2.1.0

License

GPL-3

Maintainer

Agastya Mondal

Last Published

March 4th, 2023

Functions in MGDrivE2 (2.1.0)

base_gen_FE

Base Summary for Latent Females
equilibrium_SEI_SEIR

Calculate Equilibrium for Mosquito SEI - Human SEIR Model
equilibrium_SEI_SIS

Calculate Equilibrium for Mosquito SEI - Human SIS Model
batch_migration_stage

Internal function to sample and set up data structure for batch migration
calc_move_rate

Calculate Outbound Movement Rate
base_sum_F

Base Summary of Infection (SEI) Stages for Adult Females
base_summarize_humans

Base Function for Human Summary
convert_prevalence_to_eir

Generally, pathogen prevalence is a more accesible metric for users, but the Imperial equilibrium function requires an annual EIR. This function converts a given pathogen prevalence to an EIR
base_aquatic_stage

Base Aquatic Function for Erlang-Stage Summary
base_erlang

Base Summary of Erlang Stages for Aquatic Life Stages
batch_migration

Sample Batch Migration Events
equilibrium_SEI_decoupled_human

This function calculates the equilibrium values for the decoupled SIS human states. Currently this only works in one node.
equilibrium_SEI_Imperial

Calculate Equilibrium for Mosquito SEI - Human Imperial Model
make_Q_Imperial

Rate Matrix (Q) for Adult Mosquito SEI Dynamics
equilibrium_Imperial_decoupled_human

This function calculates the human equilibrium values for the decoupled Imperial model. Requires the age structure of the population Currently this only works in one node.
equilibrium_SEI_decoupled_mosy

Calculate Equilibrium for Decoupled Mosquito SEI model. Human states will be handled separately.
make_Q_SEI

Rate Matrix (Q) for Adult Mosquito SEI Dynamics
equilibrium_lifeycle

Calculate Equilibrium for Lifecycle Model (Logistic or Lotka-Volterra)
equilibrium_Imperial_decoupled

This function calculates the human and mosquito equilibrium values for the decoupled Imperial model. Currently this only works in one node.
imperial_model_param_list_create

Model Parameter List Creation
sim_trajectory_base_R_decoupled_SIS

Simulate Trajectory From one SPN Model using Human SIS model
human_Imperial_ODE

ODE describing the age-structured Imperial model used in decoupled sampling, which will pass in values of I_V and return the human states for usein the mosquito portion of the model
sim_trajectory_base_R

Simulate Trajectory From one SPN Model
sim_trajectory_CSV_decoupled

Simulate Trajectory From a SPN Model
sim_trajectory_base_CSV

Simulate Trajectory From one SPN Model
sim_trajectory_CSV

Simulate Trajectory From a SPN Model
sim_trajectory_base_R_decoupled_Imperial

Simulate Trajectory From one SPN Model using Imperial Malaria model
solve_muAqua

Solve for Constant Aquatic Mortality
sim_trajectory_base_CSV_decoupled

Simulate Trajectory From one SPN Model
get_shape

Calculate Erlang shape parameter
spn_P_lifecycle_network

Make Places (P) For a Network (Mosquitoes only)
spn_P_epi_decoupled_node

Make Places (P) For a Node (SEI Mosquitoes). Note in the v2 epi module, we only use the SPN framework for the mosquito component of the model. The human compoenent will be handled separately in the sampler, and will be formulated as an ODE. This function makes the set of places (P) for a SPN. It is used alone if our model is a single-node metapopulation for mosquito SEI and dynamics; This is used by both SIS and Imperial transmission models.
movement_prob2rate

Convert Stochastic Matrix to Rate Matrix
spn_P_epiSIS_node

Make Places (P) For a Node (SEI Mosquitoes - SIS Humans)
spn_P_epiSIS_network

Make Places (P) For a Network (SEI Mosquitoes - SIS Humans)
spn_P_lifecycle_node

Make Places (P) For a Node (Mosquitoes only)
spn_Post

Make Post Matrix For a Petri Net
spn_T_epiSEIR_node

Make Transitions (T) For a Node (SEI Mosquitoes - SEIR Humans)
spn_T_epiSEIR_network

Make Transitions (T) For a Network (SEI Mosquitoes - SEIR Humans)
sim_trajectory_R_decoupled

Simulate Trajectory From a SPN Model
mu_ts

Mosquito Death Rates, Comoros Islands
spn_Pre

Make Pre Matrix For a Petri Net
sim_trajectory_R

Simulate Trajectory From a SPN Model
spn_S

Make stoichiometry Matrix For a Petri Net
spn_hazards

Make Hazards (Lambda) For a MGDrivE2: Node and Network Simulations
spn_T_lifecycle_node

Make Transitions (T) For a Node (Mosquitoes only)
spn_P_epiSEIR_node

Make Places (P) For a Node (SEI Mosquitoes - SEIR Humans)
spn_P_epiSEIR_network

Make Places (P) For a Network (SEI Mosquitoes - SEIR Humans)
step_PTS_decoupled

Make Poisson Time-Step (PTS) Sampler for a SPN Model
spn_T_lifecycle_network

Make Transitions (T) For a Network (Mosquitoes only)
spn_T_epi_decoupled_node

Make Transitions (T) For a Node (SEI Mosquitoes)
step_ODE_decoupled

Make Mean-field Approximation (ODE) Numerical Integrator for a SPN Model for Decoupled Epi Dynamics
step_PTS

Make Poisson Time-Step (PTS) Sampler for a SPN Model
summarize_eggs_stage

Summarize Eggs by Erlang-Stage
summarize_females

Summarize Adult Females (One Node or Metapopulation Network, Lifecycle Model)
summarize_humans_epiSIS

Summarize Humans (One Node or Metapopulation Network, SEI Mosquitoes - SIS Humans)
summarize_humans_epiSEIR

Summarize Humans (One Node or Metapopulation Network, SEI Mosquitoes - SEIR Humans)
summarize_humans_epiImperial

Summarize Humans for Imperial Model
summarize_females_epi

Summarize Adult Females (One Node or Metapopulation Network, SEI Mosquitoes)
summarize_larvae_geno

Summarize Larvae by Genotype
summarize_larvae_stage

Summarize Larval by Erlang-Stage
split_aggregate_CSV_decoupled

Split CSV output for decoupled sampling with Imperial malaria model
spn_T_epiSIS_node

Make Transitions (T) For a Node (SEI Mosquitoes - SIS Humans)
spn_T_epiSIS_network

Make Transitions (T) For a Network (SEI Mosquitoes - SIS Humans)
split_aggregate_CSV

Split CSV output by Patch and Aggregate by Mate or Dwell-Stage
step_DM

Make Gillespie's Direct Method (DM) Sampler for a SPN model
step_ODE

Make Mean-field Approximation (ODE) Numerical Integrator for a SPN Model
summarize_pupae_stage

Summarize Pupal by Erlang-Stage
summarize_stats_CSV

Summary Statistics for MGDrivE2
track_hinf

Make tracking matrix for human infection events
summarize_stats_CSV_decoupled

Summary Statistics for MGDrivE2 - Decoupled samples
spn_hazards_decoupled

Make Hazards (Lambda) For a MGDrivE2: Node and Network Simulations
step_CLE

Make Chemical Langevin (CLE) Sampler for a SPN model
summarize_eggs_geno

Summarize Eggs by Genotype
summarize_males

Summarize Adult Males (One Node or Metapopulation Network)
summarize_pupae_geno

Summarize Pupal by Genotype
add_interventions

This set of functions modifies mosquito life history parameters in the presence of adult interventions - indoor residual spraying (IRS) and insecticide treated nets (ITN) This is based on the work of Le Menach et al (2007) and Griffin et al (2010). We vary three parameters in the presence of interventions: Egg laying rate (beta), Adult mortality (muF), Mosquito biting rate (av0)
base_MQ

Base Summary Function
base_gen

Base Summary for Eggs, Larvae, Pupae, Susceptible Females, and Infectious Females
base_MUH

Base Summary for Males, Unmated Females, and Humans
base_aquatic_geno

Base Aquatic Function for Genotype Summary
base_erlang_F

Base Summary of Erlang Stages for Adult Females