Traceback In Smith-Wateman Algorithm With Affine Gap Penalty
Solution 1:
The important thing to remember about traceback in Smith-Waterman is that the matrix a value is in determines the direction that you move. So, if you are in F
you're moving diagonally, if you're in Ix
, you're moving horizontally, and if you're in Iy
, you're moving vertically. This means that all you need to store in the pointer matrix is the matrix that you arrived at a square from. The matrix that you are coming from, not the one that you are going to, determines the dirction which to go.
For example:
Say you are at F[5][5]
:
- If pointer matrix says to go to
Ix
, go toIx[4][4]
- If pointer matrix says to go to
Iy
, go toIy[4][4]
- If pointer matrix says to go to
F
, go toF[4][4]
Whereas if you are at Ix[5][5]
:
- If pointer matrix says to go to
Ix
, go toIx[4][5]
- If pointer matrix says to go to
F
, go toF[4][5]
Or if you are at Iy[5][5]
:
- If pointer matrix says to go to
Iy
, go toIy[5][4]
- If pointer matrix says to go to
F
, go toF[5][4]
Assuming that the first index is the x coordinate and the second is the y coordinate.
Continue tracing back until you reach a cell with a maximum value of 0.
Building the pointer matrix:
You need one pointer matrix each for F
, Ix
, and Iy
. These matrices only need to indicate which matrix a value came from, because that tells you which direction you were moving in. So, as you're running through the dynamic programming phase of the algorithm, you should also be building up the pointer matrices. Every time you store a new maximum value in a cell in F
, Ix
, or Iy
, you should update the corresponding matrix to indicate where it came from. If, for instance, the highest value you can have in F[5][5]
comes by aligning the two next bases when you're in F[4][4]
, the Fpointer[5][5] should be set to F
, because you got there from the F
matrix.
Post a Comment for "Traceback In Smith-Wateman Algorithm With Affine Gap Penalty"