Sequence Aligner

Module for handling sequence alignment.

class yalign.sequencealigner.SequenceAligner(score, gap_penalty)

Bases: object

Aligns two sequences.

class yalign.sequencealigner.SequenceAlignmentSearchProblem(xs, ys, score, gap_penalty)


Represents and manipulates the search space for a sequence alignment problem. Used by simpleai’s graph search algorithm.


Returns the next actions from a given state. A state is an alignment (tuple of indexes from either sequence). An action is a the next alignment to consider with a score for that alignment.

cost(state1, action, state2)

Cost of this action.


A heuristic for A* type searches. Currently we return The distance of this state from the diagonal in a N*M lattice where N and M are the lengths of the two sequences.


Are we finished aligning? True when our when state is the alignment (N, M) where N and M are the lengths of the two sequences.

result(state, action)

Returns the next state for this state, action pair.