next up previous
Next: Forward and Backward Probabilities Up: Profile Alignment Previous: Profile HMMs

   
Aligning Sequences to a Profile HMM

To align the string $X=(x_{1},\ldots,x_{m})$ against a profile $\mathcal{P}$ of length L, we will use a variant of the Viterbi algorithm. For each $1 \leq j \leq L$ and $1 \leq i \leq m$ we use the following definitions: The initial value of the special begin state is:

vbegin(0) = 0 (6.41)

To calculate the values of vMj(i), vIj(i) and vDj(i) we use the same technique as in the Viterbi algorithm. There are however two major differences: The three predecessors of the match state Mj are the three states of the previous layer, j-1:

\begin{displaymath}v^{M}_{j}(i) = \log\frac{e_{M_{j}}(x_{i})}{p(x_{i})} + \max
...
... \\
v^{D}_{j-1}(i-1)+\log(a_{D_{j-1},M_{j}})
\end{cases}
\end{displaymath} (6.42)

The three predecessors of the insertion state Ij are the three states of the same layer, j:

\begin{displaymath}v^{I}_{j}(i) = \log\frac{e_{I_{j}}(x_{i})}{p(x_{i})} + \max
...
...j}}) \\
v^{D}_{j}(i-1)+\log(a_{D_{j},I_{j}})
\end{cases}
\end{displaymath} (6.43)

The three predecessors of the deletion state Dj are the three states of the layer j-1. Since Dj is a silent state, we should not consider the emission likelihood score for xi in this case:

\begin{displaymath}v^{D}_{j}(i) = \max
\begin{cases}
v^{M}_{j-1}(i)+\log(a_{...
...}) \\
v^{D}_{j-1}(i)+\log(a_{D_{j-1},D_{j}})
\end{cases}
\end{displaymath} (6.44)

We conclude by calculating the optimal score:

\begin{displaymath}Score(X,\Pi^{\ast}) = \max
\begin{cases}
v^{M}_{L}(m)+\lo...
...L},end}) \\
v^{D}_{L}(m)+\log(a_{D_{L},end})
\end{cases}
\end{displaymath} (6.45)

Complexity: We have to calculate $O(L \cdot m)$ values, while calculating each value takes O(1) operations (since we only need to consider the scores at most three predecessors). We therefore need $O(L \cdot m)$ time and $O(L \cdot m)$ space.

  
Figure 6.6: Profile HMM for local alignment

\fbox{\epsfig{figure=lec06_fig/lec06_HMM_LocalAlign.eps,width=13cm}}





We can use a similar approach for the problem of local alignment of a sequence versus a profile HMM. This is achieved by adding four additional states (the lightly shaded states in figure 6.6) corresponding to the alignment of a sub-string of X to a part of the profile.
next up previous
Next: Forward and Backward Probabilities Up: Profile Alignment Previous: Profile HMMs
Itshack Pe`er
1999-01-24