immuneML.simulation.implants package¶
Submodules¶
immuneML.simulation.implants.ImplantAnnotation module¶
-
class
immuneML.simulation.implants.ImplantAnnotation.
ImplantAnnotation
(signal_id=None, motif_id=None, motif_instance: Optional[immuneML.simulation.implants.MotifInstance.MotifInstance] = None, position=None)[source]¶ Bases:
object
immuneML.simulation.implants.Motif module¶
-
class
immuneML.simulation.implants.Motif.
Motif
(identifier: str, instantiation: immuneML.simulation.motif_instantiation_strategy.MotifInstantiationStrategy.MotifInstantiationStrategy, seed: Optional[str] = None, seed_chain1: Optional[str] = None, name_chain1: Optional[immuneML.data_model.receptor.receptor_sequence.Chain.Chain] = None, seed_chain2: Optional[str] = None, name_chain2: Optional[immuneML.data_model.receptor.receptor_sequence.Chain.Chain] = None)[source]¶ Bases:
object
Class describing motifs where each motif is defined by a seed and a way of creating specific instances of the motif (instantiation_strategy);
When instantiation_strategy is set, specific motif instances will be produced by calling instantiate_motif(seed) method of instantiation_strategy
- Parameters
seed (str) – An amino acid sequence that represents the basic motif seed. All implanted motifs correspond to the seed, or a modified
thereof (version) –
specified in it's instantiation strategy. If this argument is set (as) –
and seed_chain2 arguments are not used. (seed_chain1) –
instantiation (
MotifInstantiationStrategy
) –strategy to use for implanting the seed. It should be one of the classes inheriting MotifInstantiationStrategy. (Which) –
the YAML specification this can either be one of these values as a string in which case the default parameters will be used. (In) –
Alternatively –
can be specified with parameters as in the example YAML specification below. For the detailed list of (instantiation) –
parameters –
the specific instantiation strategies below. (see) –
seed_chain1 (str) – in case when representing motifs for paired chain data, it is possible to define a motif seed per chain; if this parameter
set (is) –
generated motif instances will include a motif instance for both chains; for more details on how it works see seed argument (the) –
Used only if the seed argument is not set. (above.) –
seed_chain2 (str) – used for paired chain data, for the other receptor chain; for more details on how it works see seed argument. This
is used only if the seed argument is not set. (argument) –
name_chain1 – name of the first chain if paired receptor data are simulated. The value should be an instance of
:param
Chain
. This argument is used only if the seed argument is not set.: :param name_chain2: name of the second chain 2 if paired receptor data are simulated. The value should be an instance of :paramChain
. This argument is used only if the seed argument is not set.:YAML specification:
motifs: # examples for single chain receptor data my_simple_motif: # this will be the identifier of the motif seed: AAA instantiation: GappedKmer my_gapped_motif: seed: AA/A instantiation: GappedKmer: min_gap: 1 max_gap: 2 # examples for paired chain receptor data my_paired_motif: seed_chain1: AAA # seed for chain1 or chain2 can optionally include gap, same as for single chain receptor data name_chain1: ALPHA # alpha chain of TCR seed_chain2: CCC name_chain2: BETA # beta chain of TCR instantiation: GappedKmer # same as for single chain receptor data
-
identifier
: str¶
-
instantiate_motif
(chain_name: Optional[immuneML.data_model.receptor.receptor_sequence.Chain.Chain] = None)[source]¶ Creates a motif instance based on the seed; if seed parameter is defined for the motif, it is assumed that single chain data are used for the analysis. If seed is None, then it is assumed that paired chain receptor data are required in which case this function will return a motif instance per chain along with the names of the chains
- Returns
a motif instance if single chain immune receptor data are simulated or a dict where keys are chain names and values are motif instances for the corresponding chains
-
instantiation
: immuneML.simulation.motif_instantiation_strategy.MotifInstantiationStrategy.MotifInstantiationStrategy¶
-
name_chain1
: immuneML.data_model.receptor.receptor_sequence.Chain.Chain = None¶
-
name_chain2
: immuneML.data_model.receptor.receptor_sequence.Chain.Chain = None¶
-
seed
: str = None¶
-
seed_chain1
: str = None¶
-
seed_chain2
: str = None¶
immuneML.simulation.implants.MotifInstance module¶
immuneML.simulation.implants.Signal module¶
-
class
immuneML.simulation.implants.Signal.
Signal
(identifier: str, motifs: List[immuneML.simulation.implants.Motif.Motif], implanting_strategy: immuneML.simulation.signal_implanting_strategy.SignalImplantingStrategy.SignalImplantingStrategy)[source]¶ Bases:
object
This class represents the signal that will be implanted during a Simulation. A signal is represented by a list of motifs, and an implanting strategy.
A signal is associated with a metadata label, which is assigned to a receptor or repertoire. For example antigen-specific/disease-associated (receptor) or diseased (repertoire).
- Parameters
motifs (list) – A list of the motifs associated with this signal.
implanting (
SignalImplantingStrategy
) –strategy that is used to decide in which sequences the motifs should be implanted (The) –
how. (and) –
values for this argument are class names of different signal implanting strategies. (Valid) –
YAML specification:
signals: my_signal: motifs: - my_simple_motif - my_gapped_motif implanting: HealthySequence sequence_position_weights: 109: 0.5 110: 0.5
-
implant_in_receptor
(receptor: immuneML.data_model.receptor.Receptor.Receptor, is_noise: bool) → immuneML.data_model.receptor.Receptor.Receptor[source]¶
-
implant_to_repertoire
(repertoire: immuneML.data_model.repertoire.Repertoire.Repertoire, repertoire_implanting_rate: float, path: pathlib.Path) → immuneML.data_model.repertoire.Repertoire.Repertoire[source]¶