Skip to content

Commit b945157

Browse files
committed
weka511#29 Cosmetic changes
1 parent 9617a11 commit b945157

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

BA5L.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,12 @@
2828
#
2929
# Inputs: v
3030
# w
31+
# replace_score
32+
# indel_cost
3133

32-
def alignUsingLinearSpace(v,w,replace_score=substitution_matrices.load("BLOSUM62"),indel_cost=5):
33-
# LinearSpaceAlignment
34-
#
35-
# Find longest path between a substring of v[top] v[bottom-1]
36-
# and w[left] and w[right-1]
37-
#
38-
# Inputs: top
39-
# bottom
40-
# left
41-
# right
34+
def alignUsingLinearSpace(v,w,
35+
replace_score = substitution_matrices.load("BLOSUM62"),
36+
indel_cost = 5):
4237

4338
def isRightOrDownRight(midEdge):
4439
return midEdge==RIGHT or midEdge==DOWNRIGHT
@@ -54,6 +49,15 @@ def MiddleNodeAndEdge(top, bottom, left, right):
5449
direction = RIGHT if i1==i2 else DOWN if j1==j2 else DOWNRIGHT
5550
return j1,direction
5651

52+
# LinearSpaceAlignment
53+
#
54+
# Find longest path between a substring of v[top] v[bottom-1]
55+
# and w[left] and w[right-1]
56+
#
57+
# Inputs: top
58+
# bottom
59+
# left
60+
# right
5761

5862
def LinearSpaceAlignment(top, bottom, left, right):
5963
if left==right:
@@ -74,7 +78,7 @@ def LinearSpaceAlignment(top, bottom, left, right):
7478
RIGHT = 0
7579
DOWN = 1
7680
DOWNRIGHT = 2
77-
LinearSpaceAlignment(0,len(v),0,len(w))
81+
LinearSpaceAlignment(0,len(v)+1,0,len(w)+1)
7882

7983

8084
if __name__=='__main__':

align.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,10 @@ def explore(s,t,limit):
657657

658658
middle_column = len(t)//2
659659
from_source,_ = explore(s,t,middle_column)
660-
to_sink,_ = explore(s[::-1],t[::-1],len(t) - middle_column)
660+
to_sink,_ = explore(s[::-1],t[::-1],len(t) - middle_column)
661661
length = [a+b for (a,b) in zip(from_source,to_sink[::-1])]
662662

663-
return ((argmax(length), middle_column),
663+
return ((argmax(length), middle_column),
664664
(argmax(length)+1, middle_column+1))
665665

666666
# FindHighestScoringMultipleSequenceAlignment

0 commit comments

Comments
 (0)