SimilarityRule#

class biotite.sequence.align.SimilarityRule[source]#

Bases: object

This is the abstract base class for all similarity rules. A SimilarityRule calculates all similar k-mers for a given k-mer, while the definition of similarity depends on the derived class.

abstract similar_kmers(kmer_alphabet, kmer)#

Calculate all similar k-mers for a given k-mer.

Parameters:
kmer_alphabetKmerAlphabet

The reference k-mer alphabet to select the k-mers from.

kmerint

The symbol code for the k-mer to find similars for.

Returns:
similar_kmersndarray, dtype=np.int64

The symbol codes for all similar k-mers.

Notes

The implementations in derived classes must ensure that the returned array

  1. contains no duplicates and

  2. includes the input kmer itself.