SeedExtension#

class biotite.sequence.align.SeedExtension(matrix, threshold, direction='both')[source]#

Bases: object

A reusable local ungapped seed extension (X-Drop).

The scoring scheme, threshold and direction are preprocessed once on construction, so the same SeedExtension can run align() on multiple sequence pairs.

Parameters:
matrixSubstitutionMatrix or tuple(int, int)

Either a substitution matrix or a (match, mismatch) pair of scores.

thresholdint

If the current score falls this value below the maximum score found, the alignment terminates.

direction{‘both’, ‘upstream’, ‘downstream’}, optional

Controls in which direction the alignment extends starting from the seed. If 'upstream', the alignment ends at the seed; if 'downstream', it starts at the seed; if 'both' (default) it extends in both directions. The seed position itself is always included in the alignment.

See also

align_local_gapped

For gapped local alignments with the same X-Drop technique.

Examples

>>> seq1 = ProteinSequence("BIQTITE")
>>> seq2 = ProteinSequence("PYRRHQTITE")
>>> matrix = SubstitutionMatrix.std_protein_matrix()
>>> extension = SeedExtension(matrix, threshold=10)
>>> print(extension.align(seq1, seq2, seed=(4, 7)))
QTITE
QTITE
>>> print(extension.align(seq1, seq2, seed=(4, 7), score_only=True))
24