immuneML.simulation.motif_instantiation_strategy package

Submodules

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.

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

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

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

  • the values represent the probabilities for (and) –

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

  • be modified (will) –

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

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

  • position_weights (dict) – A dictionary containing the relative probabilities of choosing

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

  • where

  • starts at 0. If the index of a gap is specified in position_weights (counting) –

  • will be removed. The values (it) –

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

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

  • in hamming_distance_probabilities) (specified) –

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

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

GappedKmer:
    min_gap: 1
    max_gap: 2
    hamming_distance_probabilities:
        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
    alphabet_weights:
        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