immuneML.simulation.signal_implanting_strategy package

Submodules

immuneML.simulation.signal_implanting_strategy.FullSequenceImplanting module

class immuneML.simulation.signal_implanting_strategy.FullSequenceImplanting.FullSequenceImplanting(implanting: SequenceImplantingStrategy = None, sequence_position_weights: dict = None, implanting_computation: ImplantingComputation = None)[source]

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

Note: when providing the sequence to be implanted, check if the import setting regarding the sequence type (CDR3 vs IMGT junction) matches the sequence to be implanted. For example, if importing would convert junction sequences to CDR3, but the sequence specified here for implanting would be the junction, the results of the simulation could be inconsistent.

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_receptor(receptor, signal, is_noise: bool)[source]
implant_in_repertoire(repertoire: Repertoire, repertoire_implanting_rate: float, signal, path: Path)[source]

immuneML.simulation.signal_implanting_strategy.HealthySequenceImplanting module

class immuneML.simulation.signal_implanting_strategy.HealthySequenceImplanting.HealthySequenceImplanting(implanting: SequenceImplantingStrategy = None, sequence_position_weights: dict = None, implanting_computation: ImplantingComputation = None)[source]

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

  • set (receptor sequence. If sequence_position_weights are not) –

  • likely (then SequenceImplantingStrategy will make all of the positions equally) –

  • sequence. (for each receptor) –

  • implanting_computation (str) – defines how to determine the number of sequences to implant the signal in a repertoire; it relies on

  • repertoire_implanting_rate

  • integer (but in case where the number of sequences for implanting is not an) –

  • useful. (this option can be) –

  • 'round' (If implanting rate is set to) –

  • the (then the number of sequences for implanting in a repertoire will be rounded to the nearest integer value of) –

  • (e.g. (product of repertoire implanting rate and the number of sequences in a repertoire) –

  • 1.2 (if the product value is) –

  • be (the signal will) –

  • 'Poisson' (implanted in one sequence only). If implanting rate is set to) –

  • sampled (the number of sequences for implanting will be) –

  • sequences (from the Poisson distribution with the value of the lambda parameter being repertoire implanting rate multiplied by the number of) –

  • repertoire. (in the) –

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_receptor(receptor, signal, is_noise: bool)[source]
implant_in_repertoire(repertoire: Repertoire, repertoire_implanting_rate: float, signal, path: Path) Repertoire[source]

immuneML.simulation.signal_implanting_strategy.ImplantingComputation module

class immuneML.simulation.signal_implanting_strategy.ImplantingComputation.ImplantingComputation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

POISSON = 'Poisson'
ROUND = 'round'
immuneML.simulation.signal_implanting_strategy.ImplantingComputation.get_implanting_function(implanting_computation: ImplantingComputation)[source]

immuneML.simulation.signal_implanting_strategy.ReceptorImplanting module

class immuneML.simulation.signal_implanting_strategy.ReceptorImplanting.ReceptorImplanting(implanting: SequenceImplantingStrategy = None, sequence_position_weights: dict = None, implanting_computation: ImplantingComputation = None)[source]

Bases: 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_receptor(receptor, signal, is_noise: bool)[source]
implant_in_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: SequenceImplantingStrategy = None, sequence_position_weights: dict = None, implanting_computation: ImplantingComputation = None)[source]

Bases: object

abstract implant_in_receptor(receptor, signal, is_noise: bool)[source]
abstract implant_in_repertoire(repertoire: Repertoire, repertoire_implanting_rate: float, signal, path: Path)[source]
implant_in_sequence(sequence: ReceptorSequence, signal, motif=None, chain=None) ReceptorSequence[source]

Module contents