biotite.sequence.align.Permutation

class biotite.sequence.align.Permutation[source]

Bases: object

Provides an order for k-mers, usually used by k-mer subset selectors such as MinimizerSelector. The method how such order is computed depends on the concrete subclass of this abstract base class.

Without a Permutation subset selectors usually resort to the symbol order in the KmerAlphabet. That order is often the lexicographical order, which is known to yield suboptimal k-mer selection many cases 1.

Attributes
min, max: int

The minimum and maximum value, the permutated value (i.e. the return value of permute()) can take. Must be overriden by subclasses.

abstract permute(kmers)

Give the given k-mers a new order.

Parameters
kmersndarray, dtype=np.int64

The k-mers to reorder given as k-mer code.

Returns
orderndarray, dtype=np.int64

The sort key for the new order, i.e. a k-mer A is smaller than k-mer B, if order[A] < order[B] The order value may not only contain positive but also negative integers. The order is unambiguous: If A != B, then order[A] != order[B].