ArtPoon / gotoh2

Lightweight and customizable Python/C extension for pairwise alignment of genetic sequences using the Gotoh algorithm
GNU Affero General Public License v3.0
5 stars 2 forks source link

Wrong path calculation #1

Closed ArtPoon closed 7 years ago

ArtPoon commented 7 years ago

Working through some test cases, I've come across the following error. For sequences ACGT and ACT, match/mismatch scores of -5/+4 and gap open/extend penalties +5,+1, we get the following cost matrix:

    *   A   C   T
*   0   6   7   8 
A   6  -5   1   2 
C   7   1 -10  -4 
G   8   2  -4  -6 
T   9   3  -3  -9 

results in the following traceback:

  i j type
0 4 3 Diagonal
1 3 2 Vertical
2 2 2 Diagonal
3 1 1 Diagonal

But the best path should be V, D, D, D (-9, -6, -10, -5, 0). no it's not

ArtPoon commented 7 years ago

I've double-checked the R, P and Q matrices and they look ok. The problem seems to be in the bit matrix. Here is the matrix prior to edge assignment:

 0 16 16 16 
64 84 50 18 
64 73 84 18 
64 73 73 20 
64 65 65  4 

and here it is after

 0 16 16  7 
64 84 55 18 
64 79 84 18 
71 73 73 23 
 7 65  7  4 

Note that the lower right cell was initialized to 4, i.e., 100 setting the c-bit to True.

ArtPoon commented 7 years ago

Ugh. I was up too late when I wrote this issue. Traceback is fine.