def __init__(<EOL>self,<EOL>alleles,<EOL>allele_to_fixed_length_sequence=None):
alleles = pandas.Series(alleles)<EOL>all_alleles = list(sorted(alleles.unique()))<EOL>self.allele_to_index = dict(<EOL>(allele, i)<EOL>for (i, allele) in enumerate(all_alleles))<EOL>self.indices = alleles.map(self.allele_to_index)<EOL>self.fixed_length_sequences = pandas.Series(<EOL>[allele_to_fixed_length_sequence[a] for a in all_alleles],<EOL>index=all_alleles)<EOL>self.encoding_cache = {}<EOL>
A place to cache encodings for a (potentially large) sequence of alleles.

Parameters
----------
alleles : list of string
    Allele names

allele_to_fixed_length_sequence : dict of str -> str
    Allele name to fixed lengths sequence ("pseudosequence")