jorussell-idm / updated_infection_and_immunity Goto Github PK
View Code? Open in Web Editor NEWmalaria_two_pt_oh
malaria_two_pt_oh
What does an initialized demographics file look like in Malaria 2?
Write a simulation framework to draw Malaria2 infections within the context of transmission that is driven by forced monthly EIR.
Plot the outputs of inset chart
Plot the individual level behaviors of a few simulated people
Plot the distribution of infection durations.
We will assert that in instances of complex infection, one infection becomes the founding dominant infection while the remaining infections are co-incident and inhibited relative to their predicted independent growth in a phase dependent manner.
Infections that are concurrent and in phase (peaks overlap with a window of days (3?), akin to constructive interference) should be discounted such that their respective parastemia sum to the maximum total parasite density that the dominant strain would have contributed independently. (something like find max that founding dominant infection would have allowed and discount its density by a fraction (x) and allow co-incident infections to attain densities that sum to (1-x). This will be most important for complex infections resulting from a single bite.
As soon as these two coincident infections are out of phase (peak index >3 days away from the preceding dominant infection peak), we have to allow for subsequent peaks of parasitemia to obtain high values given that their cresting is antigenically specific and different than the adjacent peak from the dominant infection.
When completely out of phase (peak index day of dominant infection = trough index of coincident infection akin to destructive interefence) , complex infections should follow the behavior that for the dominant strain peak day and several days afterwards there is an increased chance of clearance for inhibited infections that are at or near a troughs.
RESEARCH NOTE: is there any evidence for synchronization of antigenic waves? or is out-of-phase behavior the stable equilibrium? If no data, what makes the most sense?
In general this feature highlights the need for the model to allow for interruption, modification, or truncation of predicted shapes.
A baseline Transition Matrix is specified in the model config file using density transition probability values specified by malariatherapy infection analysis.
These values are read in as a TM object in InfectionMalaria2::get_infection() using the values from InfectionMalaria2Config::parasite_peak_density_probabilities;
This TM object is passed through a matrix_multiplication_module function at every instance of get infection and returns an immune transition matrix object (iTM)
Future consideration: for now this object has a rigid 6x6 shape corresponding to orders of magnitude of parasite density, ideally in the future the level of resolution (literally the shape of this square matrix and the size of the corresponding bin edges array) is a configurable parameter. The goal here would be to allow for finer fidelity of infection transitions in the low to submicroscopic transition space.
Publish plots demonstrating functional fit to data (PRISM?) of changing degree of multiplicity of infection as a function of age and EIR setting using addinputEIR driven simulated infection shapes
PPP_scale_factor should be calculated by a function with three default behaviors:
The first_peak_value in InfectionMalaria2::get_infection() is effectively scaled by PPP_scale_factor and that value still falls between the clamped min and max of InfectionMalaria2::get_infection()
Node level:
The count of distinct strains circulating in a population should be available to all individuals in a node.
These could be given weights as a proxy for relatedness
Individual level:
Individuals should keep a count of all strains seen (probability(!seen) += counter)
Infection level:
Infections should carry a unique strain identifier
Publish plots demonstrating functional fit to data of prevalence by age bin using addinputEIR driven simulated infection shapes
Need to specify a way to allow individuals to draw nonzero cumulative exposure, recent exposure, and malaria free intervals (as well as Complexity of Infection!) upon individual initialization at the start of a sim in a manner directly related to aEIR and seasonality (for recent exposure and MFI in particular)
It seems easy enough to calculate the average aEIR/mFOI for a setting and use that times age for the number of discrete infections that goes into a cumulative exposure counter, but how to assess the number of waves? Its difficult to calculate even from a synthetic simulation standpoint because the number of waves will be affected by the immune effect of the cumulative exposure modifier.
For malaria free interval, calculate a probability of being negative for malaria in the start month (if mEIR is specified) given a survival probability of infections occurring with EIR and average duration in the preceding 12 months?
For recent exposure, this ought to be some similar function that uses information like the node prevalence and the estimated duration of infection for that age of individual in that site?
With what resolution can we distinguish data generated from scaled immune matrices when the data are sampled from off-peak values in simulated infections?
Using a particular heuristic for scaling the matrix, generate synthetic infections.
Censor the synthetic infections using a mask with randomly sampled index days.
Collect transitions from single censored synthetic infections
Ask calibrator for MLE immune modifier to generate these transitions
https://www.nature.com/articles/nature02486
"stronger cross-reactive immune responses can, paradoxically, be more likely to sustain chronic infections. Antigenic variation has always been seen as an adaptation of the parasite to evade host defence: we show that the coordination necessary for the success of this strategy might be provided by the host."
Can we capture this level of detail in our model?
A multi-iteration attempt to restricting parameter space to those that describe EIR-dependent prevalence differences in Sugungum, Rafin Marke and Matsari, Garki, Nigeria from the Garki Project.
Related to Gametocytemia #5, asexual and gametocyte stage parasites should be apportioned into stage bins that are linked via temporal progression (2 day lags) and are acted on by different classes of drugs.
Gametocytes should progress through each of 6 stages at a fixed rate with a configurable rate of survival between stages. stages 0-2 are immature gametocytes, stage 3-4 are intermediate gametocytes, and stage 5 are mature gametocytes, each impacted by a configurable drug effect kill rate.
Mature gametocytes (stage 5) should be apportioned into male and female compartments.
RESEARCH NOTE: Asexual parasites could be divided into peripheral and circulating populations with different accessibility to immune/drug effects? I think this is likely too much detail but logging this idea for future. Do we need to track the fraction of asexual parasites at a given time that are cicrulating as exposed merozoites?
At Ln 733 instead of returning a call to a nonspecific calculate_scale_factor()
It should return a call to a new function with its own configurable set of immune parameters?
Defining the structure of the spec:
Highest level Objective
Resolution of testable model behaviors
Behaviors that the model elicits or expresses?
Inputs and outputs as sections, modifications from templates?
DanB for sourcing of spec template? review?
How its built and implemented into the DTK?
Change the malaria model type in the config?
Theory of control
How do the novel functions we've written
Focus on expressed model output and how the model knobs change that output
Curves are shaped and averaged?
Related to the TM/PPP scale factor debugging, it would be helpful to make configurable the width of the antigenic wave gaussian shapes that are appended to infections when choosing next peak height, so that individuals are still able to achieve realistic high densities (on order of 10^4 to 10^3) but the surrounding days/weeks arent all too high as well, giving reasonable timescales on which to sample submicroscopic density (as in Garki data).
This param is in line 268 of InfectionMalaria2.cpp
density += wave_peak_value * gaussian_pdf(time, wave_peak_time, FLOAT TO MAKE CONFIGURABLE);
The pyrogenic threshold represents the asexual parasite density that triggers fever.
Pyrogenic threshold is a susceptibility object particular to an individual that can be updated daily.
A Base Pyrogenic threshold (m_base_pyrogenic_threshold_draw) is initizalized by accounting for both the individual's age, cumulative exposure (number of infections and number of waves experienced; these are (or should be!) tracked susceptibility parameters) along with an individual_innate_variability which accounts for how heterogeneous this threshold can be between individuals of a similar susceptibility stratums.
A individuals particular Pyrogenic threshold for a given infection m_ind_pyrogenic_threshold is then drawn upon each infection allowing some heterogeneity across differently virulent strains.
The value of this Pyrogenic threshold should be updated during every update step UpdatePyrogenicThreshold() to account for the effect of recent exposure and malaria free interval (a MFI effect should be added parallel to m_RecentExposure * SusceptibilityMalariaConfig::exposureScaleFactor_PT, may necessitate adding a new scalefactor to the config)
In fact now that I see this having such a sprawling structure, I think that from a high level we need in the config:
a base pyrogenic threshold value (base_PT)
a age specific scale factor for pyrogenic threshold (age_PT)
a number of infections specific scale factor for pyrogenic threshold (discreteinfections_PT)
a number of waves specific scale factor for pyrogenic threshold (waves_PT)
a malaria free-interval specific scale factor for pyrogenic threshold (MFI_PT)
a recent exposure specific scale factor for pyrogenic threshold (recentexposure_PT)
This seems like a lot but we will want to make sure that through calibration to reference parasite density/fever measurements that the right combination of susceptibility params does an ok job at predicting fever status. It may come out that one of these scale factors adds no new information in which case, great lets scrub it.
Testing workspace creation
Account for decrease in immunity that is documented in primigravid women
Should primarily affect the PT
But pending evidence for effect on infection shape through TM and PPP
Each strain that circulates and initiates an infection should be given a unique strain ID (allowing for integration of spatial genetic epi modelling (with Albert/Josh)
Each infection that an individual receives draws from a pool of infections that are contained with that node, and the individual's susceptibility retains the unique identifier for that strain.
Make sure that from-cfg.json is baselined to appropriate default values for generic sims.
Compile the shortlist of the config params that are relevant for a new user of malaria2 to consider changing per site/setting.
An ever expanding list of considerations to keep in mind for extended model development.
Gametocyte differentiation is updated daily to transform a proportion of the asexual density compartment into gametocyte compartment. This subtraction from the asexual compartment should be treated as a true subtraction prior to reporting the asexual density at this update, for when differentiation rate is high for a particular wave this will significantly change the asexual density!
My own analyses are consistent with Diebner and Eichner's conclusions that the differentiation rate at each antigenic wave has high variance across the age of infection. One biologically based feature we should maintain is that gametocytes concurrent with high asexual densities (>10000 parasites/uL) should have shorter circulation times as a result of the stimulated immune environment (a higher clearance rate, effectively a lower effective differentiation rate).
Our desired behavior is then that fold decrease between asexuals and gametocyte waves should sample from a distribution (lognormal, mean of roughly 1.8) for the differentiation for that wave, and that this is attenuated linearly by log(asexual density) when asexual density exceeds pyrogenic threshold.
Successive stages of gametocytes should be just time lagged progressions of previous density with the capacity to be attenuated by drug effects and a configurable survival rate as in 1.0
within Regression\Malaria2
generate a MalariaPatientReport.json
Individuals of a given parameterization (age, exposure, strain diversity) shall exhibit a nondeterministic distribution of infection durations.
Structurally, this requirement is met by individuals receiving infection objects, by those infection objects having at least one peak index and peak value in the waves object in described by InfectionMalaria2::get_infection()
Verification method: Running the whole model as a challenge trial, we compare infection durations between simulation and a particular reference using a KS test.
Sweep over configurable gaussian wave shape width param and show the resulting changes in age binned PfPR at a fixed immune scaling.
The model should yield a rate for age- and exposure-stratified incidence and prevalence of clinical disease that matches a mean reference values where data exists
In general, severe disease and mortality are progressive sigmoidal relations to asexual parasite density.
Anemia should be similar to how it was implemented in 1.0, with hemoglobin as an output.
In future, how can we track/report on non febrile symptoms which may have impart on health seeking?
Gather observations from literature on how strains and antigen types within strains compete and are affected by immunity.
Should be some overlap with Philip's initial 1.0 mechanism for search in var gene space.
Should also be some valuable information in longitudinal parasitemiae (as in PRISM) for dominance by strain amidst complex infections.
Publish plots demonstrating functional fit to data of changing infection durations as a function of age using addinputEIR driven simulated infection shapes
A family of functions (structurally homologous) should exist that uses as input a particular individual parameter (i.e. age) and outputs the estimated scale factor that this dimension should impose on the immune operator.
A separate function should exist that uses a weighted averaging of the scale factors as mapped to individual parameters to output a particular immune modifier value, or array of immune modifier values that will be used to generate an individual's immune status.
Building on the logic used to combine the effects of the 5 primary dimensions defined by susceptibility (biological age, cumulative exposure, recent exposure, strain diversity, malaria free interval)
We ought to extend this to include contributions from interaction terms between these different dimensions.
This means that the claculation of immune modifier there would be 15 terms, each with a weighted coefficient that could be calibrated accordingly.
Gather evidence for multiple blood feeds and potential overlap for rate of recombination amidst co-infecting strains
Identify where in the vector model life cycle we allow for multiple or partial blood feeds
Ensure that the handling of strain outcrossing during mosquito stages are appropriately allowed/disallowed depending on stage progression
Publish plots that demonstrate functionality of immune model in matching data using addinputEIR driven infection shapes over a range of EIRs (sites from Garki)
Strain diversity should accomodate the behavior of an imported strain who's novelty weights the draw on probability of having seen.
In order to modify the campaign and config files to account for changes to multisite calibration, write functionality in commissioning scripts to handle the read, edit, write function of config and campaign files that are used as templates for HM's modfn functionality.
Generate a MPR.json to be able to ensure correct drug activity on parasites.
Malaria free interval should be its own counter held by an indiviudal (in their susceptibility?) which either increments 1 every update (dt) that an individual is uninfected and resets to zero upon infection Initialize()
or
calculates a subtraction whenever it is called that is either 0 if currently infected or (current timestep - last clearance event timestep) if that is less computatations.
This may necessitate Susceptibility listening for clearance events. and holding in memory the last clearance event timestep, not sure how easy that would be? I think infections may already be recorded as part of Events Reporter? I don't know much about that space if its just logging, or if it is a locally available information to individuals in Update.
The period between asexual waves will be drawn randomly from between 8 and 30 days.
Using a flag in config, distances between peaks can be set to exactly 21 days for synthetic calibration purposes
Inspect the window around peaks that contribute to asexual density and post here?
FUTURE WORK:
The period should be allowed to be controlled by an individual parameter (infection age? immune status?)
The spacing between gaussian shaped waves will be the direct contributor to trough density.
Individuals stratified by individual properties (age, exposure, strain diversity) shall experience first wave primary peak parasitemiae (PPP) statistically to reference distributions of PPP.
Structurally, this requirement is satisfied if individuals upon receiving an infection draw a first_peak_value from the distribution specified by a mu and a sigma in the config, and that value is effectively clamped between the specified upper and lower bounds in InfectionMalaria2::get_infection()
Verification Method: KS test showing statistically similar PPP across individual strata.
The concatenation of each reference data source containing longitudinal parasite density transitions and which dimensions of immune acquisition they may have insight on.
Ideally these are first used in isolation as ways to calibrate roughly the shape parameters governing the functional forms of immune modifiers as specified for the TM matrix.
If no longitudinal data exist, we can instead isolate the magnitude of effect on primary peak density across these same dimensions as a proxy for their relative contribution to immunity generally.
We want to make space in the model for individual strains (with unique identifiers) to also retain the capacity for association with a drug resistance marker of different flavors (for each antimalarial drug class).
This should attenuate the filtering effects as specified in the new Drug Effects logic specific to each subcompartment of parasite density.
A transient window (whos duration is defined by drug PK/PD) that dampens the appropriate parasite density compartment by a degree specified by the library of PK/PD values as used in Malaria 1.0
Based on discussion of reducing complexity of the Drug Model we will try to reduce the number of parasite stage/developmental compartments. This may reduce our fidelity to the action of particular drug classes, but its a simplifying assumption I'm willing to take for the time being!
We will draw the shape of gametocytemia as we draw asexual density trajectories as a tabular list of indices, conversion probabilities and peak densities.
The function to go from asexual to gametocytes for each of these fields is
index_gametocyte = index_asexuals + lag(8 days)
conversion_fraction_gametocytes = conversion_probability(random variable, drawn from a lognormal distribution who's mean is a configurable parameter (default value of 1.8))
value_gametoctye = value_asexuals*conversion_gametocytes
At every Update we will by default report each density evaluated at dt given the set of Gaussian peak indices.
If a drug effect is present:
if that drug acts on asexuals, filter the reported asexual density by a fraction determined from the C50 of the drug, the ending concentration as reported from the DrugModel.cpp for all waves during the time period at which the drug has appreciable concentration in the body.
IN ADDITION: revise down the gametocyte values at each index of waves that were affected by the asexual acting drug.
if the drug acts on any stage of gametocyte development, filter the reported gametocyte density by a fraction determined from the C50 of the drug, the ending concentration as reported from the DrugModel.cpp for all waves during the time period at which the drug has appreciable concentration in the body.
if the drug acts on infected hepatocytes, reduce the number of infected hepatocytes by a fraction determined from the C50 of the drug, the ending concentration as reported from the DrugModel.cpp for all waves during the time period at which the drug has appreciable concentration in the body.
I guess my questions the naive one: is it possible to take the parameters of killrate, c50, and starting and ending concentrations to calculate the fraction of parasites that ought to be cleared over a timestep dt
In each case the function of
https://github.com/InstituteforDiseaseModeling/DtkTrunk/blob/master/interventions/Drugs.cpp#L355
should be able to calculate the efficacy in units of log reduction in IRBCs per day. How this should be handled at the level of sub wave changes to parasite density is important to get right.
RESEARCH NOTE: What about the effect of drugs on dynamic changes to gametocyte differentiation rate? Evidence from literature?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.