Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong DP matrix init? #94

Open
sjanssen2 opened this issue Feb 19, 2021 · 0 comments
Open

wrong DP matrix init? #94

sjanssen2 opened this issue Feb 19, 2021 · 0 comments

Comments

@sjanssen2
Copy link

sjanssen2 commented Feb 19, 2021

I assume you intend to compute global pairwise alignments, i.e. Needleman Wunsch. Implicitly, you are initializing your first row and first column with 0, which I think is not correct. Traditionally, it is initialized as i * gapcost (c.f. http://rna.informatik.uni-freiburg.de/Teaching/index.jsp?toolName=Needleman-Wunsch#), in your code that should translate to V[i-1, 0] + A[i-1, 0]. Otherwise, leading gaps in both sequences do NOT get penalized and it would be half way towards an "end gap free" algorithm.

V = new(N + 1, M + 1).zero_() # N x M
Q = new(N + 2, M + 2, 3).zero_() # N x M x S
Q[N + 1, M + 1] = 1
for i in range(1, N + 1):
for j in range(1, M + 1):

What's missing for a real "end gap free" implementation is that you find your global optimum as the max in the last col and row of your DP matrix.
Therefore, I am confused about what version you really want to implement here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant