next up previous
Next: The Traceback Up: Global Alignment Previous: Global Alignment

   
Tabular computation of optimal alignment

The problem can be evaluated systematically using a tabular computation. In this approach, we compute V(i,j) for the all possible values for i and j starting from smaller such values and increasing them in a row-wise manner.

We use a table of size $(n+1)\times(m+1)$ in which we store the values of V(i,j) for all choices of i and j. Finally V(n, m) is the required alignment score.

The following pseudo code describes the algorithm:

    for i=1 to n do
    begin
      for j=1 to m do
      begin
        Calculate V(i,j) using V(i-1,j-1), V(i,j-1), V(i-1,j)
      end
    end

Example 2.8   Figure 2.1 illustrates a snapshot at some point during the computation. In this example and the following one the value of $\sigma$ is -1 for a mismatch and 2 for a match.


  
Figure 2.1: Snapshot of computing the table

\fbox{ \input{lec02_figs/lec02_alignment.latex}}







Itshack Pe`er
1999-01-03