immuneML.simulation.signal_implanting_strategy package¶
Submodules¶
immuneML.simulation.signal_implanting_strategy.FullSequenceImplanting module¶
-
class
immuneML.simulation.signal_implanting_strategy.FullSequenceImplanting.
FullSequenceImplanting
(implanting: Optional[immuneML.simulation.sequence_implanting.SequenceImplantingStrategy.SequenceImplantingStrategy] = None, sequence_position_weights: Optional[dict] = None, implanting_computation: Optional[immuneML.simulation.signal_implanting_strategy.ImplantingComputation.ImplantingComputation] = None)[source]¶ Bases:
immuneML.simulation.signal_implanting_strategy.SignalImplantingStrategy.SignalImplantingStrategy
This class represents a
SignalImplantingStrategy
where signals will be implanted in the repertoire by replacing repertoire_implanting_rate percent of the sequences with sequences generated from the motifs of the signal. Motifs here cannot include gaps and the motif instances are the full sequences and will be a part of the repertoire.Arguments: this signal implanting strategy has no arguments.
YAML specification:
motifs: my_motif: # cannot include gaps ... signals: my_signal: motifs: - my_motif implanting: FullSequence
-
implant_in_repertoire
(repertoire: immuneML.data_model.repertoire.Repertoire.Repertoire, repertoire_implanting_rate: float, signal, path: pathlib.Path)[source]¶
-
immuneML.simulation.signal_implanting_strategy.HealthySequenceImplanting module¶
-
class
immuneML.simulation.signal_implanting_strategy.HealthySequenceImplanting.
HealthySequenceImplanting
(implanting: Optional[immuneML.simulation.sequence_implanting.SequenceImplantingStrategy.SequenceImplantingStrategy] = None, sequence_position_weights: Optional[dict] = None, implanting_computation: Optional[immuneML.simulation.signal_implanting_strategy.ImplantingComputation.ImplantingComputation] = None)[source]¶ Bases:
immuneML.simulation.signal_implanting_strategy.SignalImplantingStrategy.SignalImplantingStrategy
This class represents a
SignalImplantingStrategy
where signals will be implanted in ‘healthy sequences’, meaning sequences in which no signal has been implanted previously. This ensures that there is only one signal per receptor sequence.If for the given number of sequences in the repertoire and repertoire implanting rate, the total number of sequences for implanting turns out to be less than 1 (e.g. for 12000 sequences and repertoire implanting rate 0.00005, it should implant the signal in 0.6 sequences), the signal will not be implanted in that repertoire and a warning with repertoire identifier along with the repertoire implanting rate and number of sequences in the repertoire will be raised.
- Parameters
implanting – name of the implanting strategy, here HealthySequence
sequence_position_weights (dict) – A dictionary describing the relative weights for implanting a signal at each given IMGT position in the
sequence. If sequence_position_weights are not set (receptor) –
SequenceImplantingStrategy will make all of the positions equally likely (then) –
each receptor sequence. (for) –
implanting_computation (str) – defines how to determine the number of sequences to implant the signal in a repertoire; it relies on
repertoire_implanting_rate –
in case where the number of sequences for implanting is not an integer (but) –
option can be useful. (this) –
implanting rate is set to 'round' (If) –
the number of sequences for implanting in a repertoire will be rounded to the nearest integer value of the (then) –
of repertoire implanting rate and the number of sequences in a repertoire (e.g. (product) –
the product value is 1.2 (if) –
signal will be (the) –
in one sequence only) If implanting rate is set to 'Poisson' (implanted) –
number of sequences for implanting will be sampled (the) –
the Poisson distribution with the value of the lambda parameter being repertoire implanting rate multiplied by the number of sequences (from) –
the repertoire. (in) –
YAML specification:
motifs: my_motif: ... signals: my_signal: motifs: - my_motif - ... implanting: HealthySequence implanting_computation: Poisson sequence_position_weights: 109: 1 110: 2 111: 5 112: 1
-
implant_in_repertoire
(repertoire: immuneML.data_model.repertoire.Repertoire.Repertoire, repertoire_implanting_rate: float, signal, path: pathlib.Path) → immuneML.data_model.repertoire.Repertoire.Repertoire[source]¶
immuneML.simulation.signal_implanting_strategy.ImplantingComputation module¶
-
class
immuneML.simulation.signal_implanting_strategy.ImplantingComputation.
ImplantingComputation
(value)[source]¶ Bases:
enum.Enum
An enumeration.
-
POISSON
= 'Poisson'¶
-
ROUND
= 'round'¶
-
-
immuneML.simulation.signal_implanting_strategy.ImplantingComputation.
get_implanting_function
(implanting_computation: immuneML.simulation.signal_implanting_strategy.ImplantingComputation.ImplantingComputation)[source]¶
immuneML.simulation.signal_implanting_strategy.ReceptorImplanting module¶
-
class
immuneML.simulation.signal_implanting_strategy.ReceptorImplanting.
ReceptorImplanting
(implanting: Optional[immuneML.simulation.sequence_implanting.SequenceImplantingStrategy.SequenceImplantingStrategy] = None, sequence_position_weights: Optional[dict] = None, implanting_computation: Optional[immuneML.simulation.signal_implanting_strategy.ImplantingComputation.ImplantingComputation] = None)[source]¶ Bases:
immuneML.simulation.signal_implanting_strategy.SignalImplantingStrategy.SignalImplantingStrategy
This class represents a
SignalImplantingStrategy
where signals will be implanted in both chains of immune receptors. This class should be used only when simulating paired chain data.- Parameters
implanting – name of the implanting strategy, here Receptor
sequence_position_weights (dict) – A dictionary describing the relative weights for implanting a signal at each given IMGT position in the receptor sequence. If sequence_position_weights are not set, then SequenceImplantingStrategy will make all of the positions equally likely for each receptor sequence.
YAML specification:
motifs: my_motif: ... signals: my_signal: motifs: - my_motif - ... implanting: Receptor sequence_position_weights: 109: 1 110: 2 111: 5 112: 1
-
implant_in_repertoire
(repertoire: immuneML.data_model.repertoire.Repertoire.Repertoire, repertoire_implanting_rate: float, signal, path)[source]¶
immuneML.simulation.signal_implanting_strategy.SignalImplantingStrategy module¶
-
class
immuneML.simulation.signal_implanting_strategy.SignalImplantingStrategy.
SignalImplantingStrategy
(implanting: Optional[immuneML.simulation.sequence_implanting.SequenceImplantingStrategy.SequenceImplantingStrategy] = None, sequence_position_weights: Optional[dict] = None, implanting_computation: Optional[immuneML.simulation.signal_implanting_strategy.ImplantingComputation.ImplantingComputation] = None)[source]¶ Bases:
object
-
abstract
implant_in_repertoire
(repertoire: immuneML.data_model.repertoire.Repertoire.Repertoire, repertoire_implanting_rate: float, signal, path: pathlib.Path)[source]¶
-
implant_in_sequence
(sequence: immuneML.data_model.receptor.receptor_sequence.ReceptorSequence.ReceptorSequence, signal, motif=None, chain=None) → immuneML.data_model.receptor.receptor_sequence.ReceptorSequence.ReceptorSequence[source]¶
-
abstract