immuneML.encodings.kmer_frequency.sequence_encoding package

Submodules

immuneML.encodings.kmer_frequency.sequence_encoding.GappedKmerSequenceEncoder module

class immuneML.encodings.kmer_frequency.sequence_encoding.GappedKmerSequenceEncoder.GappedKmerSequenceEncoder[source]

Bases: SequenceEncodingStrategy

static encode_sequence(sequence: ReceptorSequence, params: EncoderParams)[source]

creates all overlapping gapped k-mers from a sequence as features for use in KmerFrequencyEncoder. this gap length goes from min_gap to max_gap inclusive, and there is a k-mer of length k_left on the left side of the gap and a k-mer of length k_right on the right side of the gap. :param sequence: ReceptorSequence :param params: EncoderParams (within the “model”, the following keys are used: “k_left”, “k_right”, “max_gap”,

“min_gap”)

Returns:

SequenceEncodingResult

static get_feature_names(params: EncoderParams)[source]

immuneML.encodings.kmer_frequency.sequence_encoding.IMGTGappedKmerEncoder module

class immuneML.encodings.kmer_frequency.sequence_encoding.IMGTGappedKmerEncoder.IMGTGappedKmerEncoder[source]

Bases: SequenceEncodingStrategy

static encode_sequence(sequence: ReceptorSequence, params: EncoderParams)[source]

creates all overlapping gapped k-mers and IMGT position pairs from a sequence as features for use in KmerFrequencyEncoder. this gap length goes from min_gap to max_gap inclusive, and there is a k-mer of length k_left on the left side of the gap and a k-mer of length k_right on the right side of the gap. :param sequence: ReceptorSequence :param params: EncoderParams (within the “model”, the following keys are used: “k_left”, “k_right”, “max_gap”,

“min_gap”)

Returns:

SequenceEncodingResult

static get_feature_names(params: EncoderParams)[source]

immuneML.encodings.kmer_frequency.sequence_encoding.IMGTKmerSequenceEncoder module

class immuneML.encodings.kmer_frequency.sequence_encoding.IMGTKmerSequenceEncoder.IMGTKmerSequenceEncoder[source]

Bases: SequenceEncodingStrategy

static encode_sequence(sequence: ReceptorSequence, params: EncoderParams)[source]

creates overlapping continuous k-mers from a sequence as features for use in KmerFrequencyEncoder object of type EncoderParams, same object as passed into KmerFrequencyEncoder :param sequence: ReceptorSequence :param params: EncoderParams (where params[“model”][“k”] is used) :return: SequenceEncodingResult consisting of features and feature information names

static get_feature_names(params: EncoderParams)[source]

immuneML.encodings.kmer_frequency.sequence_encoding.IdentitySequenceEncoder module

class immuneML.encodings.kmer_frequency.sequence_encoding.IdentitySequenceEncoder.IdentitySequenceEncoder[source]

Bases: SequenceEncodingStrategy

static encode_sequence(sequence: ReceptorSequence, params: EncoderParams)[source]

Encodes a ReceptorSequence based on information from within the ReceptorSequence and SequenceMetadata instances. This allows for looking at frequency for whole sequences, with flexible definition of what a unique whole sequence is. :param sequence: ReceptorSequence :param params: EncoderParams (params[“model”][“sequence”] and params[“model”][“metadata_fields_to_include”] are

used)

Returns:

list with only single feature

static get_feature_names(params: EncoderParams)[source]

immuneML.encodings.kmer_frequency.sequence_encoding.KmerSequenceEncoder module

class immuneML.encodings.kmer_frequency.sequence_encoding.KmerSequenceEncoder.KmerSequenceEncoder[source]

Bases: SequenceEncodingStrategy

static encode_sequence(sequence: ReceptorSequence, params: EncoderParams)[source]

Encodes a receptor sequence into a sequence of k-mers

Parameters:
  • sequence – ReceptorSequence object

  • params – EncoderParams object with information on k-mer length

Returns:

static get_feature_names(params: EncoderParams)[source]

immuneML.encodings.kmer_frequency.sequence_encoding.SequenceEncodingStrategy module

class immuneML.encodings.kmer_frequency.sequence_encoding.SequenceEncodingStrategy.SequenceEncodingStrategy[source]

Bases: object

abstract static encode_sequence(sequence: ReceptorSequence, params: EncoderParams)[source]
abstract static get_feature_names(params: EncoderParams)[source]

immuneML.encodings.kmer_frequency.sequence_encoding.SequenceEncodingType module

class immuneML.encodings.kmer_frequency.sequence_encoding.SequenceEncodingType.SequenceEncodingType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

CONTINUOUS_KMER = 'KmerSequenceEncoder'
GAPPED_KMER = 'GappedKmerSequenceEncoder'
IDENTITY = 'IdentitySequenceEncoder'
IMGT_CONTINUOUS_KMER = 'IMGTKmerSequenceEncoder'
IMGT_GAPPED_KMER = 'IMGTGappedKmerEncoder'

Module contents