immuneML.simulation.motif_instantiation_strategy package


immuneML.simulation.motif_instantiation_strategy.GappedKmerInstantiation module

class immuneML.simulation.motif_instantiation_strategy.GappedKmerInstantiation.GappedKmerInstantiation(hamming_distance_probabilities: Optional[dict] = None, min_gap: int = 0, max_gap: int = 0, alphabet_weights: Optional[dict] = None, position_weights: Optional[dict] = None)[source]

Bases: immuneML.simulation.motif_instantiation_strategy.MotifInstantiationStrategy.MotifInstantiationStrategy

Creates a motif instance from a given seed and additional optional parameters. Currently, at most a single gap can be specified in the sequence.

  • min_gap (int) – The minimum gap length, in case the original seed contains a gap.

  • max_gap (int) – The maximum gap length, in case the original seed contains a gap.

  • hamming_distance_probabilities (dict) – The probability of modifying the given seed with each

  • modifications (number of modifications. The keys represent the number of) –

  • motif (between the original seed and the implanted) –

  • for (and the values represent the probabilities) –

  • {0 (For example) – 0.7, 1: 0.3} means that 30% of the time one position

  • modified (then 60% of the time the amino acid at index 0 is) –

  • respect (and the remaining 70% of the time the motif will remain unmodified with) –

  • 1. (to the seed. The values of hamming_distance_probabilities must sum to) –

  • position_weights (counting starts at 0. If the index of a gap is specified in) – A dictionary containing the relative probabilities of choosing

  • seed (each position for hamming distance modification. The keys represent the position in the) –

  • where

  • position_weights

  • values (it will be removed. The) –

  • modification. (represent the relative probabilities for modifying each position when it gets selected for) –

  • {0 – 0.6, 1: 0, 2: 0.4} means that when a sequence is selected for a modification (as

  • hamming_distance_probabilities) (specified in) –

  • modified

:param : :param and the remaining 40% of the time the amino acid at index 2. If the values of position_weights do not sum: :param to 1: :param the remainder will be redistributed over all positions: :param including those not specified.: :param alphabet_weights: A dictionary describing the relative probabilities of choosing each amino acid :type alphabet_weights: dict :param for hamming distance modification. The keys represent the amino acids and the values the relative: :param probabilities for choosing this amino acid. If the values of alphabet_weights do not sum to 1: :param the remainder: :param will be redistributed over all possible amino acids: :param including those not specified.:

YAML specification:

    min_gap: 1
    max_gap: 2
        0: 0.7
        1: 0.3
    position_weights: # note that index 2, the position of the gap, is excluded from position_weights
        0: 1
        1: 0
        3: 0
        A: 0.2
        C: 0.2
        D: 0.4
        E: 0.2
get_max_gap() int[source]
instantiate_motif(base) immuneML.simulation.implants.MotifInstance.MotifInstance[source]
set_default_weights(weights, keys)[source]

immuneML.simulation.motif_instantiation_strategy.MotifInstantiationStrategy module

class immuneML.simulation.motif_instantiation_strategy.MotifInstantiationStrategy.MotifInstantiationStrategy[source]

Bases: object

abstract get_max_gap() int[source]
abstract instantiate_motif(base) immuneML.simulation.implants.MotifInstance.MotifInstance[source]

Module contents