emodpy_malaria.vector_config module

emodpy_malaria.vector_config.set_team_defaults(config, manifest)[source]

Set configuration defaults using team-wide values, including drugs and vector species.

Parameters:
  • config – schema-backed config smart dict

  • manifest – manifest file containing the schema path

Returns:

configured config

emodpy_malaria.vector_config.get_species_params(config, species: str | None = None)[source]

Returns the species parameters dictionary with the matching species Name

Parameters:
  • config – schema-backed config smart dict

  • species – Species to look up

Returns:

Dictionary of species parameters with the matching name

emodpy_malaria.vector_config.set_species_param(config, species, parameter, value, overwrite=False)[source]

Sets a parameter value for a specific species. Raises value error if species not found

Parameters:
  • config – schema-backed config smart dict

  • species – name of species for which to set the parameter

  • parameter – parameter to set

  • value – value to set the parameter to

  • overwrite – if set to True and parameter is a list, overwrites the parameter with value, appends by default

Returns:

Nothing

emodpy_malaria.vector_config.configure_linear_spline(manifest, max_larval_capacity: float = 100000000, capacity_distribution_number_of_years: int = 1, capacity_distribution_over_time: dict | None = None)[source]

Configures and returns a ReadOnlyDict of the LINEAR_SPLINE habitat parameters

Parameters:
  • manifest – manifest file containing the schema path

  • max_larval_capacity – The maximum larval capacity. Sets Max_Larval_Capacity

  • capacity_distribution_number_of_years – 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

  • capacity_distribution_over_time

    “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:

    {
        "Times": [0,  30,  60,   91,  122, 152, 182, 213, 243, 274, 304, 334, 365 ],
        "Values": [3, 0.8, 1.25, 0.1, 2.7, 8,    4,   35, 6.8, 6.5, 2.6, 2.1, 2]
    }
    

Returns:

“LINEAR_SPLINE” parameters to be passed directly to “set_species_params” function

Return type:

Configured Habitat_Type

emodpy_malaria.vector_config.add_species(config, manifest, species_to_select)[source]

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:
  • config – schema-backed config smart dict

  • manifest – manifest file containing the schema path

  • species_to_select – a list of species or a name of a single species you’d like to set from malaria_vector_species_params.py

Returns:

configured config

emodpy_malaria.vector_config.add_genes_and_alleles(config, manifest, species: str | None = None, alleles: list | None = None)[source]

Adds alleles to a species

Example:

"Genes": [
    {
        "Alleles": [
            {
                "Name": "X1",
                "Initial_Allele_Frequency": 0.5,
                "Is_Y_Chromosome": 0
            },
            {
                "Name": "X2",
                "Initial_Allele_Frequency": 0.25,
                "Is_Y_Chromosome": 0
            },
            {
                "Name": "Y1",
                "Initial_Allele_Frequency": 0.15,
                "Is_Y_Chromosome": 1
            },
            {
                "Name": "Y2",
                "Initial_Allele_Frequency": 0.1,
                "Is_Y_Chromosome": 1
            }
        ],
        "Is_Gender_Gene": 1,
        "Mutations": []
    }
]
Parameters:
  • config – schema-backed config smart dict

  • manifest – manifest file containing the schema path

  • species – species to which to assign the alleles

  • alleles

    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. Example:

    [("X1", 0.25), ("X2", 0.35), ("Y1", 0.15), ("Y2", 0.25)]
    [("X1", 0.25, 0), ("X2", 0.35, 0), ("Y1", 0.15, 1), ("Y2", 0.25, 1)]
    

Returns:

configured config

emodpy_malaria.vector_config.add_mutation(config, manifest, species, mutate_from, mutate_to, probability)[source]

Adds to Mutations parameter in a Gene which has the matching Alleles

Parameters:
  • config – schema-backed config smart dict

  • manifest – manifest file containing the schema path

  • species – Name of vector species to which we’re adding mutations

  • mutate_from – The allele in the gamete that could mutate

  • mutate_to – The allele that this locus will change to during gamete generation

  • probability – The probability that the allele will mutate from one allele to the other during the creation of the gametes

Returns:

configured config

emodpy_malaria.vector_config.create_trait(manifest, trait: str | None = None, modifier: float | None = None, sporozoite_barcode_string: str | None = None, gametocyte_a_barcode_string: str | None = None, gametocyte_b_barcode_string: str | None = None)[source]

Configures and returns a modifier trait.

Parameters:
  • manifest – manifest file containing the schema path

  • trait – 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”

  • modifier – The multiplier to use to modify the given trait for vectors with the given allele combination.

  • sporozoite_barcode_string – TBD

  • gametocyte_a_barcode_string – TBD

  • gametocyte_b_barcode_string – TBD

Returns:

trait parameters that can be added to a list and passed to add_trait() function

emodpy_malaria.vector_config.add_trait(config, manifest, species, allele_combo: list | None = None, trait_modifiers: list | None = None)[source]

Use this function to add traits as part of vector genetics configuration, the trait is assigned to the species’ Gene_To_Trait_Modifiers parameter Should produce something like Example:

{
    "Allele_Combinations" : [
        [  "X",  "X" ],
        [ "a0", "a1" ]
    ],
    "Trait_Modifiers" : [
        {
            "Trait" : "FECUNDITY",
            "Modifier": 0.7
        }
    ]
}
Parameters:
  • config – schema-backed config smart dict

  • manifest – manifest file containing the schema path

  • speciesName of species for which to add this Gene_To_Trait_Modifiers

  • allele_combo

    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" ]]
    

  • trait_modifiers – list of trait modifier parameters created with create_trait() function.

Returns:

configured config

emodpy_malaria.vector_config.add_insecticide_resistance(config, manifest, insecticide_name: str = '', species: str = '', allele_combo: list | None = None, blocking: float = 1.0, killing: float = 1.0, repelling: float = 1.0, larval_killing: float = 1.0)[source]

Use this function to add to the list of Resistances parameter for a specific insecticide Add each resistance separately. Example:

Insecticides = [
{
  "Name": "pyrethroid",
  "Resistances": [
    {
      "Allele_Combinations": [
      [
        "a1",
        "a1"
      ]
     ],
    "Blocking_Modifier": 1.0,
    "Killing_Modifier": 0.85,
    "Repelling_Modifier": 0.72,
    "Larval_Killing_Modifier": 0,
    "Species": "gambiae"
  }
 ]
},
{..}
Parameters:
  • config – schema-backed config smart dict

  • manifest – manifest file containing the schema path

  • insecticide_name – The name of the insecticide to which attach the resistance.

  • species – Name of the species of vectors.

  • allele_combo – List of combination of alleles that vectors must have in order to be resistant.

  • blocking – The value used to modify (multiply) the blocking effectivity of an intervention.

  • killing – The value used to modify (multiply) the killing effectivity of an intervention.

  • repelling – The value used to modify (multiply) the repelling effectivity of an intervention.

  • larval_killing – The value used to modify (multiply) the larval killing effectivity of an intervention.

Returns:

configured config

emodpy_malaria.vector_config.add_species_drivers(config, manifest, species: str | None = None, driving_allele: str | None = None, driver_type: str = 'CLASSIC', to_copy: str | None = None, to_replace: str | None = None, likelihood_list: list | None = None, shredding_allele_required: str | None = None, allele_to_shred: str | None = None, allele_to_shred_to: str | None = None, allele_shredding_fraction: float | None = None, allele_to_shred_to_surviving_fraction: float | None = None)[source]

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.

Example:

{
    "Driver_Type": "INTEGRAL_AUTONOMOUS",
    "Driving_Allele": "Ad",
    "Alleles_Driven": [
        {
            "Allele_To_Copy": "Ad",
            "Allele_To_Replace": "Aw",
            "Copy_To_Likelihood": [
                {
                    "Copy_To_Allele": "Aw",
                    "Likelihood": 0.1
                },
                {
                    "Copy_To_Allele": "Ad",
                    "Likelihood": 0.3
                },
                {
                    "Copy_To_Allele": "Am",
                    "Likelihood": 0.6
                }
            ]
        },
{
    "Driver_Type" : "X_SHRED",
    "Driving_Allele" : "Ad",
    "Driving_Allele_Params" : {
        "Allele_To_Copy"    : "Ad",
        "Allele_To_Replace" : "Aw",
        "Copy_To_Likelihood" : [
            {
                "Copy_To_Allele" : "Ad",
                "Likelihood" : 1.0
            },
            {
                "Copy_To_Allele" : "Aw",
                "Likelihood" : 0.0
            }
        ]
    },
    "Shredding_Alleles" : {
        "Allele_Required"    : "Yw",
        "Allele_To_Shred"    : "Xw",
        "Allele_To_Shred_To" : "Xm",
        "Allele_Shredding_Fraction": 0.97,
        "Allele_To_Shred_To_Surviving_Fraction" : 0.05
    }
    ]
}
Parameters:
  • config – schema-backed config smart dict

  • manifest – manifest file containing the schema path

  • species – Name of the species for which we’re setting the drivers

  • driving_allele – This is the allele that is known as the driver

  • driver_type – 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.

  • to_copy – The main allele to be copied Allele_To_Copy

  • to_replace – The allele that must exist and will be replaced by the copy Allele_To_Replace

  • likelihood_list – A list of tuples in format: [(Copy_To_Allele, Likelihood),(),()] to assign to Copy_To_Likelyhood list

  • shredding_allele_required – 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

  • allele_to_shred – 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

  • allele_to_shred_to – 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

  • allele_shredding_fraction – 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.

  • allele_to_shred_to_surviving_fraction – 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.

Returns:

configured config

emodpy_malaria.vector_config.set_max_larval_capacity(config, species_name, habitat_type, max_larval_capacity)[source]

Set the Max_Larval_Capacity for a given species and habitat. Effectively doing something like: simulation.task.config.parameters.Vector_Species_Params[i][“Habitats”][j][“Max_Larval_Capacity”] = max_larval_capacity where i is index of species_name and j is index of habitat_type.

Parameters:
  • config – schema-backed config smart dict

  • species_name – string. Species_Name to target.

  • habitat_type – enum. Habitat_Type to target.

  • max_larval_capacity – integer. New value of Max_Larval_Capacity.

Returns:

Nothing.

emodpy_malaria.vector_config.add_microsporidia(config, manifest, species_name: str | None = None, strain_name: str = 'Strain_A', female_to_male_probability: float = 0, female_to_egg_probability: float = 0, male_to_female_probability: float = 0, male_to_egg_probability: float = 0, duration_to_disease_acquisition_modification: dict | None = None, duration_to_disease_transmission_modification: dict | None = None, larval_growth_modifier: float = 1, female_mortality_modifier: float = 1, male_mortality_modifier: float = 1)[source]

Adds microsporidia parameters to the named species’ parameters.

Parameters:
  • config – schema-backed config dictionary, written to config.json

  • manifest – file that contains path to the schema file

  • species_name – Species to target, Name parameter

  • strain_nameStrain_Name The name/identifier of the collection of transmission parameters. Cannot be empty string

  • female_to_male_probabilityMicrosporidia_Female_to_Male_Transmission_Probability The probability an infected female will infect an uninfected male.

  • female_to_egg_probabilityMicrosporidia_Female_To_Egg_Transmission_Probability The probability an infected female will infect her eggs when laying them.

  • male_to_female_probabilityMicrosporidia_Male_To_Female_Transmission_Probability The probability an infected male will infect an uninfected female

  • male_to_egg_probabilityMicrosporidia_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.

  • duration_to_disease_acquisition_modification

    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:

    {
        "Times": [    0,   3,   6,   9 ],
        "Values": [ 1.0, 1.0, 0.5, 0.0 ]
    }
    

  • duration_to_disease_transmission_modification

    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:

    {
        "Times": [    0,   3,   6,   9 ],
        "Values": [ 1.0, 1.0, 0.75, 0.5]
    }
    

  • larval_growth_modifierMicrosporidia_Larval_Growth_Modifier A multiplier modifier to the daily, temperature dependent, larval growth progress.

  • female_mortality_modifierMicrosporidia_Female_Mortality_Modifier A multiplier modifier on the death rate for female vectors due to general life expectancy, age, and dry heat

  • male_mortality_modifierMicrosporidia_Male_Mortality_Modifier A multiplier modifier on the death rate for male vectors due to general life expectancy, age, and dry heat

Returns:

Nothing