emodpy_malaria.vector_config module

emodpy_malaria.vector_config.set_team_defaults(config, manifest)

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

Parameters
  • config

  • manifest

Returns

configured config

emodpy_malaria.vector_config.get_species_params(config, species: str = None)

Returns the species parameters dictionary with the matching species Name

Parameters
  • config

  • 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)

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

Parameters
  • config

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

  • manifest

  • 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, alleles: list = None)

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

  • manifest

  • 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)

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

Parameters
  • config

  • manifest

  • 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.add_trait(config, manifest, species, allele_combo: list = None, trait_modifiers: list = 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 Should produce something like Example:

{
    "Allele_Combinations" : [
        [  "X",  "X" ],
        [ "a0", "a1" ]
    ],
    "Trait_Modifiers" : [
        {
            "Trait" : "FECUNDITY",
            "Modifier": 0.7
        }
    ]
}
Parameters
  • config

  • manifest

  • 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 tuples of (Trait, Modifier) for the Allele_Combinations* Example:

    [("FECUNDITY", 0.5), ("X_SHRED", 0.80)]
    

Returns

configured config

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

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

  • manifest

  • 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, driving_allele: str = None, driver_type: str = 'CLASSIC', to_copy: str = None, to_replace: str = None, likelihood_list: list = None, shredding_allele_required: str = None, allele_to_shred: str = None, allele_to_shred_to: str = None, allele_shredding_fraction: float = None, allele_to_shred_to_surviving_fraction: float = 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.

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

  • manifest

  • 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)

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

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