admin管理员组文章数量:1403355
This is my code for the Gap Alignment/Traceback. I need help to fix it.
The input is GATTACA,GTCGACGCA
The expected output is :
GATTAC--A GTCGACGCA -3
But I keep getting:
GATTA--CA GTCGACGCA -3
I don't know how to fix it.
while i> 0 or j> 0 :
curr_score = matrix[i,j]
match_score = 0
if i > 0 and j > 0 :
if (sequence1[i-1] == sequence2[j-1]):
match_score = Reward_match
else:
match_score = Penality_mismatch
if curr_score == matrix[i-1, j-1] + match_score:
alg1= sequence1[i-1] + alg1
alg2 = sequence2[j-1]+alg2
i-=1
j-=1
continue
if (i > 0):
if (curr_score == matrix[i-1,j] + Gap_penality):
alg1 = sequence1[i-1] + alg1
alg2 = "-" + alg2
i-=1
continue
if(j > 0):
alg1 ="-" +alg1
alg2 = sequence2[j-1] + alg2
j-= 1
return alg1, alg2, int(matrix[sequence1_Length, sequence2_Length])
本文标签: NeedlemanWunsch Algorithm AlignmentStack Overflow
版权声明:本文标题:Needleman-Wunsch Algorithm Alignment - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744332037a2601010.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论