d6e6be93ecb8e47d1b6fb564a1a085e2b4e963c2 wong Tue Feb 7 11:21:24 2012 -0800 added mismatch penalty to encourage contiguous segments of alignment more diff --git python/lib/ucscgenomics/ucscUtils.py python/lib/ucscgenomics/ucscUtils.py index e6d4ab4..8399505 100644 --- python/lib/ucscgenomics/ucscUtils.py +++ python/lib/ucscgenomics/ucscUtils.py @@ -56,31 +56,31 @@ """ m,n = len(list1),len(list2) score = zeros(m+1,n+1) pointer = zeros(m+1,n+1) penalty = -1 max_i = 0 max_j = 0 maxScore = 0 #print "len_i = %s, len_j = %s" % (m,n) for i in range(1,m+1): for j in range(1,n+1): scoreUp = score[i-1][j]+penalty scoreDown = score[i][j-1]+penalty - scoreDiagonal = score[i-1][j-1] + scoreDiagonal = score[i-1][j-1]-5 if list1[i-1] == list2[j-1]: scoreDiagonal = scoreDiagonal + 10 score[i][j] = max(0,scoreUp,scoreDown,scoreDiagonal) if score[i][j] == 0: pointer[i][j] = 0 if score[i][j] == scoreUp: pointer[i][j] = 1 if score[i][j] == scoreDown: pointer[i][j] = 2 if score[i][j] == scoreDiagonal: pointer[i][j] = 3 ##if score[i][j] >= maxScore: ## max_i = i ## max_j = j ## maxScore = score[i][j]