Skip to main content
Fig. 2 | BMC Bioinformatics

Fig. 2

From: Variable-order sequence modeling improves bacterial strain discrimination for Ion Torrent DNA reads

Fig. 2

Finding the alignment using Viterbi: a For each state M, X, Y we calculate an alignment matrix: each matrix position contains the alignment probability V(i,j) up until the position i in Sequence1 and j in Sequence2 (shown in Fig. 1). b Example of how the alignment matrices are traversed using the alignment from Fig. 1. c To find the alignment with the highest probability: V(i,j) is calculated for each of the states M: V M(i,j), X: V X(i,j), Y: V Y(i,j). The probability of transitioning between two states is given by a (e.g. from X to M is a XM ), and is multiplied by the alignment probability V of the state and position we are coming from (for example V M(i,j)=a XM ·V X(i−1,j−1) if going from state X to M). We then transition from the previous state and position which maximizes V M(i,j) for alignment matrix M, and V X(i,j), V Y(i,j) for the X,Y matrices. We perform this for each i,j position and always store which previous state was transitioned from. The alignment with the highest probability V max can then be found using traceback: given a Sequence1 of length n and a Sequence2 of length m, traceback starts from the state given by: V max =max{a ME ·V M(n,m), X: a XE ·V X(n,m), Y: a YE ·V Y(n,m)} where a ME , a XE , and a YE are the transition probabilities from M, X, and Y respectively to E

Back to article page