def _get_aa_regex(codon_table, stop='*', unknown='X'):
 from Bio.Data.CodonTable import CodonTable
 if (not isinstance(codon_table, CodonTable)):
  raise TypeError('Input table is not a instance of Bio.Data.CodonTable object')
 aa2codon = {}
 for (codon, aa) in codon_table.forward_table.items():
  aa2codon.setdefault(aa, []).append(codon)
 for (aa, codons) in aa2codon.items():
  aa2codon[aa] = _codons2re(codons)
 aa2codon[stop] = _codons2re(codon_table.stop_codons)
 aa2codon[unknown] = '...'
 return aa2codon

def _get_aa_regex ( codon_table , stop = '*' , unknown = 'X' ) : from Bio . Data . CodonTable import CodonTable if ( not isinstance ( codon_table , CodonTable ) ) : raise TypeError ( 'Input table is not a instance of Bio.Data.CodonTable object' ) aa2codon = { } for ( codon , aa ) in codon_table . forward_table . items ( ) : aa2codon . setdefault ( aa , [ ] ) . append ( codon ) for ( aa , codons ) in aa2codon . items ( ) : aa2codon [ aa ] = _codons2re ( codons ) aa2codon [ stop ] = _codons2re ( codon_table . stop_codons ) aa2codon [ unknown ] = '...' return aa2codon
set up the regular expression of a given codontable for further use .