vector_config
Configuration functions for vector biology in malaria simulations.
Covers vector species parameters, larval habitats, vector genetics, gene drives, insecticide resistance, microsporidia, and the team-standard vector defaults used as the foundation for most malaria simulations.
add_blood_meal_mortality(config, manifest, default_probability_of_death=0.0, species='', allele_combo=None, probability_of_death_for_allele_combo=0.0)
Add a probability of death after a mosquito has a blood meal. There are some genetically modified mosquitoes that have a fitness cost associated with the digestion of a blood meal. This affects vectors whether this is a human or animal blood meal. This is a GeneticProbability such that the probability used can depend on the genetic makeup of the mosquito. The deaths from this are added to the "die after feeding" numbers for vectors that have fed on humans and "die before feeding on a human" for vectors that die after animal blood meal.
If you need to add multiple allele combos for the same species, call this method once for each allele combo and associated probability. If you do, please note that the default probability will be combined by OR'ing the different values together [1-((1-p1)*(1-p2))]. Also note that the default probabilities for each species will be OR'd together.
The probability selected for given genome will depend on the "complexity" of the allele combinations. If an entry has more genes/loci positions than another, the combination with more will be considered first. If they have the same number of genes and one has fewer possible genomes, the one with fewer possible genomes will be considered first. For example, if you add a1-a1 in one call and b1-b0 in a second call, EMOD will first check if the genome has a1-a1. If it has a1-a1, it will get that probability. If it does not, it will check if the genome has b1-b0 or b0-b1. The entered values are not combined in any way. It is up to the user to specify the probability for specific combinations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest module containing the schema path |
required |
default_probability_of_death
|
float
|
The probability used if the genome of the mosquito does not match any of the defined allele combinations in Genetic_Probabilities. |
0.0
|
species
|
str
|
Name of the species of vectors to give the specific probability to. |
''
|
allele_combo
|
list
|
The combination of alleles that a mosquito's genome must have in order to apply associated Probability. You do not need to specify alleles for every locus. The ones not defined are not considered in the match This should be a two-dimensional array where each internal array has two strings representing two alleles of the same locus. Each separate internal array represents locus and you can only have one entry per locus. You can use '' for an allele to say any allele. For example, [ ["a1", "a1"], ["b1, ""] ] says any mosquito with a1-a1 in the first locus and b1 in either chromosome of the second locus. |
None
|
probability_of_death_for_allele_combo
|
float
|
The probability to use if the genome of the mosquito has the matching Allele_Combinations. The default is zero. |
0.0
|
Returns:
| Type | Description |
|---|---|
dict
|
configured config |
Source code in emodpy_malaria/vector_config.py
add_genes_and_alleles(config, manifest, species=None, alleles=None)
Adds alleles to a species
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
species
|
str
|
species to which to assign the alleles |
None
|
alleles
|
list
|
List of tuples of (Name, Initial_Allele_Frequency, Is_Y_Chromosome) for a set of alleles or (Name, Initial_Allele_Frequency), 1/0 or True/False can be used for Is_Y_Chromosome, third parameter is assumed False (0). If the third parameter is set to 1 in any of the tuples, we assume, this is a gender gene. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
configured config |
Source code in emodpy_malaria/vector_config.py
add_insecticide_resistance(config, manifest, insecticide_name='', species='', allele_combo=None, blocking=1.0, killing=1.0, repelling=1.0, larval_killing=1.0)
Use this function to add to the list of **Resistances** parameter for a specific insecticide
Add each resistance separately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
insecticide_name
|
str
|
The name of the insecticide to which attach the resistance. |
''
|
species
|
str
|
Name of the species of vectors. |
''
|
allele_combo
|
list
|
List of combination of alleles that vectors must have in order to be resistant. |
None
|
blocking
|
float
|
The value used to modify (multiply) the blocking effectivity of an intervention. |
1.0
|
killing
|
float
|
The value used to modify (multiply) the killing effectivity of an intervention. |
1.0
|
repelling
|
float
|
The value used to modify (multiply) the repelling effectivity of an intervention. |
1.0
|
larval_killing
|
float
|
The value used to modify (multiply) the larval killing effectivity of an intervention. |
1.0
|
Returns:
| Type | Description |
|---|---|
dict
|
configured config |
Source code in emodpy_malaria/vector_config.py
add_maternal_deposition(config, manifest, species, cas9_grna_from, allele_to_cut, likelihood_list)
Adds a maternal deposition element for the specified species.
After meiosis and fertilization, maternal deposition of Cas9 and gRNA can form additional resistance alleles
in the zygote or early embryo from wildtype alleles. These elements define the likelihoods of forming additional
resistance alleles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
species
|
str
|
Name of the species for which we're adding the maternal deposition element. |
required |
cas9_grna_from
|
str
|
This is an allele for presence of which in the mother we will be checking to see if additional resistance alleles will be formed. This is the allele must be one of the 'driving_alleles' from vector_config.add_species_drivers() function. |
required |
allele_to_cut
|
str
|
The allele from which resistance alleles might be formed due to maternal deposition. This must be one of the 'to_replace' alleles defined in the vector_config.add_species_drivers() function. |
required |
likelihood_list
|
list
|
A list of tuples in format: [( |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Config object with maternal deposition parameters added for the specified species. |
Source code in emodpy_malaria/vector_config.py
add_microsporidia(config, manifest, species_name=None, strain_name='Strain_A', female_to_male_probability=0, female_to_egg_probability=0, male_to_female_probability=0, male_to_egg_probability=0, duration_to_disease_acquisition_modification=None, duration_to_disease_transmission_modification=None, larval_growth_modifier=1, female_mortality_modifier=1, male_mortality_modifier=1)
Adds microsporidia parameters to the named species' parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config dictionary, written to config.json |
required |
manifest
|
ModuleType
|
file that contains path to the schema file |
required |
species_name
|
str
|
Species to target, Name parameter |
None
|
strain_name
|
str
|
Strain_Name The name/identifier of the collection of transmission parameters. Cannot be empty string |
'Strain_A'
|
female_to_male_probability
|
float
|
Microsporidia_Female_to_Male_Transmission_Probability The probability an infected female will infect an uninfected male. |
0
|
female_to_egg_probability
|
float
|
Microsporidia_Female_To_Egg_Transmission_Probability The probability an infected female will infect her eggs when laying them. |
0
|
male_to_female_probability
|
float
|
Microsporidia_Male_To_Female_Transmission_Probability The probability an infected male will infect an uninfected female |
0
|
male_to_egg_probability
|
float
|
Microsporidia_Male_To_Egg_Transmission_Probability The probability a female that mated with an infected male will infect her eggs when laying them, independent of her being infected and transmitting to her offspring. |
0
|
duration_to_disease_acquisition_modification
|
dict
|
Microsporidia_Duration_To_Disease_Acquisition_Modification, A dictionary for "Times" and "Values" as an age-based modification that the female will acquire malaria. Times is an array of days in ascending order that represent the number of days since the vector became infected. Values is an array of probabilities with values from 0 to 1 where each probability is the probability that the vector will acquire malaria due to Microsporidia. Example:: |
None
|
duration_to_disease_transmission_modification
|
dict
|
Microsporidia_Duration_To_Disease_Transmission_Modification, A dictionary for "Times" and "Values" as an age-based modification that the female will transmit malaria. Times is an array of days in ascending order that represent the number of days since the vector became infected. Values is an array of probabilities with values from 0 to 1 where each probability is the probability that the vector will acquire malaria due to Microsporidia. Example:: |
None
|
larval_growth_modifier
|
float
|
Microsporidia_Larval_Growth_Modifier A multiplier modifier to the daily, temperature dependent, larval growth progress. |
1
|
female_mortality_modifier
|
float
|
Microsporidia_Female_Mortality_Modifier A multiplier modifier on the death rate for female vectors due to general life expectancy, age, and dry heat |
1
|
male_mortality_modifier
|
float
|
Microsporidia_Male_Mortality_Modifier A multiplier modifier on the death rate for male vectors due to general life expectancy, age, and dry heat |
1
|
Source code in emodpy_malaria/vector_config.py
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | |
add_mutation(config, manifest, species, mutate_from, mutate_to, probability)
Adds to Mutations parameter in a Gene which has the matching Alleles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
species
|
str
|
Name of vector species to which we're adding mutations |
required |
mutate_from
|
str
|
The allele in the gamete that could mutate |
required |
mutate_to
|
str
|
The allele that this locus will change to during gamete generation |
required |
probability
|
float
|
The probability that the allele will mutate from one allele to the other during the creation of the gametes |
required |
Returns:
| Type | Description |
|---|---|
dict
|
configured config |
Source code in emodpy_malaria/vector_config.py
add_species(config, manifest, species_to_select)
Adds species with preset parameters from 'malaria_vector_species_params.py', if species name not found - "gambiae" parameters are added and the new species name assigned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
species_to_select
|
Union[str, list[str]
|
a list of species or a name of a single species you'd like to set from malaria_vector_species_params.py |
required |
Returns:
| Type | Description |
|---|---|
dict
|
configured config |
Source code in emodpy_malaria/vector_config.py
add_species_drivers(config, manifest, species=None, driving_allele=None, driver_type='CLASSIC', to_copy=None, to_replace=None, likelihood_list=None, shredding_allele_required=None, allele_to_shred=None, allele_to_shred_to=None, allele_shredding_fraction=None, allele_to_shred_to_surviving_fraction=None)
Add a gene drive that propagates a particular set of alleles.
Adds one **Alleles_Driven** item to the **Alleles_Driven** list, using 'driving_allele' as key if matching one
already exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
species
|
str
|
Name of the species for which we're setting the drivers |
None
|
driving_allele
|
str
|
This is the allele that is known as the driver |
None
|
driver_type
|
str
|
This indicates the type of driver. CLASSIC - The driver can only drive if the one gamete has the driving allele and the other has a specific allele to be replaced INTEGRAL_AUTONOMOUS - At least one of the gametes must have the driver. Alleles can still be driven if the driving allele is in both gametes or even if the driving allele cannot replace the allele in the other gamete X_SHRED, Y_SHRED - cannot be used in the same species during one simulation/realization. The driving_allele must exist at least once in the genome for shredding to occur. If there is only one, it can exist in either half of the genome. DAISY_CHAIN - can be used for drives that do not drive themselves but can be driven by another allele. |
'CLASSIC'
|
to_copy
|
str
|
The main allele to be copied Allele_To_Copy |
None
|
to_replace
|
str
|
The allele that must exist and will be replaced by the copy Allele_To_Replace |
None
|
likelihood_list
|
list
|
A list of tuples in format: [(Copy_To_Allele, Likelihood),(),()] to assign to Copy_To_Likelyhood list |
None
|
shredding_allele_required
|
str
|
The genome must have this gender allele in order for shredding to occur. If the driver is X_SHRED, then the allele must be designated as a Y chromosome. If the driver is Y_SHRED, then the allele must NOT be designated as a Y chromosome |
None
|
allele_to_shred
|
str
|
The genome must have this gender allele in order for shredding to occur. If the driver is X_SHRED, then the allele must NOT be designated as a Y chromosome. If the driver is Y_SHRED, then the allele must be designated as a Y chromosome |
None
|
allele_to_shred_to
|
str
|
This is a gender allele that the 'shredding' will change the allele_to_shred into. It can be a temporary allele that never exists in the output or could be something that appears due to resistance/failures |
None
|
allele_shredding_fraction
|
float
|
This is the fraction of the alleles_to_Shred that will be converted to allele_to_shred_to. Values 0 to 1. If this value is less than 1, then some of the allele_to_shred will remain and be part of the gametes. |
None
|
allele_to_shred_to_surviving_fraction
|
float
|
A trait modifier will automatically generated for [ Allele_To_Shred_To, * ], the trait ADJUST_FERTILE_EGGS, and this value as its modifier. Values 0 to 1. A value of 0 implies perfect shredding such that no allele_to_Shred_To survive in the eggs. A value of 1 means all of the 'shredded' alleles survive. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
configured config |
Source code in emodpy_malaria/vector_config.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | |
add_trait(config, manifest, species, allele_combo=None, trait_modifiers=None)
Use this function to add traits as part of vector genetics configuration, the trait is assigned to the species' Gene_To_Trait_Modifiers parameter
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
species
|
str
|
Name of species for which to add this Gene_To_Trait_Modifiers |
required |
allele_combo
|
list
|
List of lists, This defines a possible subset of allele pairs that a vector could have. Each pair are alleles from one gene. If the vector has this subset, then the associated traits will be adjusted. Order does not matter. '' is allowed when only the occurrence of one allele is important. Example*:: [[ "X", "X" ], [ "a0", "a1" ]] |
None
|
trait_modifiers
|
list
|
list of trait modifier parameters created with create_trait() function. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
configured config |
Source code in emodpy_malaria/vector_config.py
add_vector_migration(task, species=None, vector_migration_filename_path=None, x_vector_migration=1, vector_migration_modifier_equation=ModifierEquationType.LINEAR, vector_migration_habitat_modifier=0, vector_migration_food_modifier=0, vector_migration_stay_put_modifier=0)
Adds vector migration parameters to the named species' parameters and adds the migration file to the
common_assets in task
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
EMODTask
|
contains config to edit and assets to add migration file to |
required |
species
|
str
|
Species to target, Name parameter |
None
|
vector_migration_filename_path
|
str
|
Path with the filename of the migration file to use for Vector_Migration_Filename |
None
|
x_vector_migration
|
float
|
Scale factor for the rate of vector migration to other nodes. |
1
|
vector_migration_modifier_equation
|
ModifierEquationType
|
Functional form of vector migration modifiers. This applies only to female migrating vectors. Default is ModifierEquationType.LINEAR. |
LINEAR
|
vector_migration_habitat_modifier
|
float
|
Preference of a vector to migrate toward a node with more habitat. This applies only to female migrating vectors. |
0
|
vector_migration_food_modifier
|
float
|
Preference of a vector to migrate toward a node currently occupied by humans, independent of the number of humans in the node. This only applies to female migrating vectors. |
0
|
vector_migration_stay_put_modifier
|
float
|
Preference of a vector to remain in its current node rather than migrate to another node. This applies only to female migrating vectors. |
0
|
Source code in emodpy_malaria/vector_config.py
configure_linear_spline(manifest, max_larval_capacity=pow(10, 8), capacity_distribution_number_of_years=1, capacity_distribution_over_time=None)
Configures and returns a ReadOnlyDict of the LINEAR_SPLINE habitat parameters
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
max_larval_capacity
|
float
|
The maximum larval capacity. Sets Max_Larval_Capacity |
pow(10, 8)
|
capacity_distribution_number_of_years
|
int
|
The total length of time in years for the scaling. If the simulation goes longer than this time, the pattern will repeat. Ideally, this value times 365 is the last value in 'Capacity_Distribution_Over_Time'. Sets Capacity_Distribution_Number_Of_Years |
1
|
capacity_distribution_over_time
|
dict
|
"This allows one to scale the larval capacity over time. The Times and Values arrays must be the same length where Times is in days and Values are a scale factor per degrees squared. The value is multiplied times the max capacity and 'Node_Grid_Size' squared/4. Ideally, you want the last value to equal the first value if they are one day apart. A point will be added if not. Sets Capacity_Distribution_Over_Time Example:: |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
"LINEAR_SPLINE" parameters to be passed directly to "set_species_params" function |
Source code in emodpy_malaria/vector_config.py
create_trait(manifest, trait=None, modifier=None, sporozoite_barcode_string=None, gametocyte_a_barcode_string=None, gametocyte_b_barcode_string=None)
Configures and returns a modifier trait.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
trait
|
str
|
The trait to be modified of vectors with the given allele combination. Available traits are: "INFECTED_BY_HUMAN", "FECUNDITY", "FEMALE_EGG_RATIO", "STERILITY", "TRANSMISSION_TO_HUMAN", "ADJUST_FERTILE_EGGS", "MORTALITY", "INFECTED_PROGRESS", "OOCYST_PROGRESSION", "SPOROZOITE_MORTALITY" |
None
|
modifier
|
float
|
The multiplier to use to modify the given trait for vectors with the given allele combination. |
None
|
sporozoite_barcode_string
|
str
|
TBD |
None
|
gametocyte_a_barcode_string
|
str
|
TBD |
None
|
gametocyte_b_barcode_string
|
str
|
TBD |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
trait parameters that can be added to a list and passed to add_trait() function |
Source code in emodpy_malaria/vector_config.py
get_species_params(config, species=None)
Returns the species parameters dictionary with the matching species Name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
species
|
str
|
Species to look up |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary of species parameters with the matching name |
Source code in emodpy_malaria/vector_config.py
set_max_larval_capacity(config, species_name, habitat_type, max_larval_capacity)
Set the Max_Larval_Capacity for a given species and habitat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
species_name
|
str
|
string. Species_Name to target. |
required |
habitat_type
|
str
|
Habitat_Type to target. |
required |
max_larval_capacity
|
int
|
New value of Max_Larval_Capacity. |
required |
Source code in emodpy_malaria/vector_config.py
set_species_param(config, species, parameter, value, overwrite=False)
Sets a parameter value for a specific species.
Raises value error if species not found
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
species
|
str
|
name of species for which to set the parameter |
required |
parameter
|
str
|
parameter to set |
required |
value
|
Union[Any, list[Any]]
|
value to set the parameter to |
required |
overwrite
|
bool
|
if set to True and parameter is a list, overwrites the parameter with value, appends by default |
False
|
Source code in emodpy_malaria/vector_config.py
set_team_defaults(config, manifest)
Set configuration defaults using team-wide values, including drugs and vector species.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
schema-backed config smart dict |
required |
manifest
|
ModuleType
|
manifest file containing the schema path |
required |
Returns:
| Type | Description |
|---|---|
dict
|
configured config |