needleman_wunsch_aligner 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/needleman_wunsch_aligner.rb +10 -7
- data/lib/needleman_wunsch_aligner/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b038fdcd831fb5de1e7d749633c39c15220d0ae
|
|
4
|
+
data.tar.gz: f2d023f45f941cc6e04b9bd6954f882d00b32968
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd404a2146c193de74202b83706c6d205ecfa3fcf2dc79b648b068ca283fb7ba67e79db593fbbd6b89114449cf396a8ddd8883a8375597664ed2225eae135746
|
|
7
|
+
data.tar.gz: 9c42647c54ce3d85908cfed82d4fdac5cc73afd5ceeb6346679a8a55025e7b9fb8f8c2d9968fedf4034f7348a2a00bf70ea741592605c7f70312aa12058f13ca
|
data/CHANGELOG.md
CHANGED
|
@@ -20,8 +20,10 @@ class NeedlemanWunschAligner
|
|
|
20
20
|
|
|
21
21
|
# Returns two arrays that represent the optimal alignment.
|
|
22
22
|
def get_optimal_alignment
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
@get_optimal_alignment ||= (
|
|
24
|
+
construct_score_matrix_and_traceback_matrix
|
|
25
|
+
compute_optimal_alignment
|
|
26
|
+
)
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
# This is a basic implementation of the scoring algorithm. See
|
|
@@ -67,7 +69,7 @@ class NeedlemanWunschAligner
|
|
|
67
69
|
# @param col_width [Integer, optional], defaults to 3
|
|
68
70
|
# @return [String]
|
|
69
71
|
def inspect_matrix(which_matrix, col_width = 3)
|
|
70
|
-
get_optimal_alignment
|
|
72
|
+
get_optimal_alignment # make sure we have computed the matrices
|
|
71
73
|
the_matrix = case which_matrix
|
|
72
74
|
when :traceback
|
|
73
75
|
@traceback_matrix
|
|
@@ -140,21 +142,22 @@ protected
|
|
|
140
142
|
left = Array.new
|
|
141
143
|
top = Array.new
|
|
142
144
|
while row > 0 or col > 0
|
|
143
|
-
|
|
145
|
+
case @traceback_matrix[row][col]
|
|
146
|
+
when '⬉'
|
|
144
147
|
left.push(@left_seq[row-1])
|
|
145
148
|
top.push(@top_seq[col-1])
|
|
146
149
|
row -= 1
|
|
147
150
|
col -= 1
|
|
148
|
-
|
|
151
|
+
when '←'
|
|
149
152
|
left.push(gap_indicator)
|
|
150
153
|
top.push @top_seq[col-1]
|
|
151
154
|
col -= 1
|
|
152
|
-
|
|
155
|
+
when '↑'
|
|
153
156
|
left.push @left_seq[row-1]
|
|
154
157
|
top.push(gap_indicator)
|
|
155
158
|
row -= 1
|
|
156
159
|
else
|
|
157
|
-
|
|
160
|
+
raise "Handle this"
|
|
158
161
|
end
|
|
159
162
|
end
|
|
160
163
|
[left.reverse, top.reverse]
|