]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bad tests in match.rb
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 16 Jan 2013 09:47:10 +0000 (09:47 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 16 Jan 2013 09:47:10 +0000 (09:47 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2078 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/lib/maasha/align/match.rb
code_ruby/test/maasha/align/test_match.rb

index 784a2d12f2a1916adb8a216c821769683697a19a..47a5fbd523aecba4ab81b51394a656eb4362c770 100644 (file)
@@ -23,7 +23,6 @@
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 require 'inline'
-require 'maasha/math_aux'
 
 # Class for describing a match between two sequences q and s.
 class Match
@@ -58,20 +57,8 @@ class Match
     self
   end
 
-  def redundant?(matches)
-    # Speed-up with binary search
-
-    matches.each do |m|
-      if Math.dist_point2line(self.q_beg, self.s_beg, m.q_beg, m.s_beg, m.q_end, m.s_end) == 0
-        return true
-      end
-    end
-
-    false
-  end
-
   def to_s(seq = nil)
-    s = "q: #{@q_beg}, s: #{@s_beg}, l: #{@length}, s: #{@score}"
+    s = "q: #{@q_beg} #{self.q_end} s: #{@s_beg} #{self.s_end} l: #{@length} s: #{@score}"
     s << " #{seq[@q_beg .. q_end]}" if seq
 
     s
index 79df7cd144c1ebdf1fd8205c59beb640547bc6b1..40e84f28acaef8f8a403ea109f2a41e549228bfd 100755 (executable)
@@ -43,32 +43,32 @@ class MatchTest < Test::Unit::TestCase
   end
 
   def test_Match_to_s_returns_correctly
-    assert_equal("q: 1, s: 1, l: 3, s: 0.0",     @match.to_s)
-    assert_equal("q: 1, s: 1, l: 3, s: 0.0 tcg", @match.to_s("atcg"))
+    assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0",     @match.to_s)
+    assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0 tcg", @match.to_s("atcg"))
   end
 
   def test_Match_expand_to_left_end_returns_correctly
-    assert_equal("q: 0, s: 0, l: 4, s: 0.0", @match.expand("atcg", "atcg", 0, 0, 3, 3).to_s)
+    assert_equal("q: 0 3 s: 0 3 l: 4 s: 0.0", @match.expand("atcg", "atcg", 0, 0, 3, 3).to_s)
   end
 
   def test_Match_expand_to_left_mismatch_returns_correctly
-    assert_equal("q: 1, s: 1, l: 3, s: 0.0", @match.expand("gtcg", "atcg", 0, 0, 3, 3).to_s)
+    assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.expand("gtcg", "atcg", 0, 0, 3, 3).to_s)
   end
 
   def test_Match_expand_to_left_space_beg_returns_correctly
-    assert_equal("q: 1, s: 1, l: 3, s: 0.0", @match.expand("atcg", "atcg", 1, 1, 3, 3).to_s)
+    assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.expand("atcg", "atcg", 1, 1, 3, 3).to_s)
   end
 
   def test_Match_expand_to_right_end_returns_correctly
-    assert_equal("q: 0, s: 0, l: 5, s: 0.0", @match.expand("atcga", "atcga", 0, 0, 4, 4).to_s)
+    assert_equal("q: 0 4 s: 0 4 l: 5 s: 0.0", @match.expand("atcga", "atcga", 0, 0, 4, 4).to_s)
   end
 
   def test_Match_expand_to_right_mismatch_returns_correctly
-    assert_equal("q: 1, s: 1, l: 3, s: 0.0", @match.expand("gtcga", "atcgg", 0, 0, 4, 4).to_s)
+    assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.expand("gtcga", "atcgg", 0, 0, 4, 4).to_s)
   end
 
   def test_Match_expand_to_right_space_end_returns_correctly
-    assert_equal("q: 1, s: 1, l: 3, s: 0.0", @match.expand("atcga", "atcga", 1, 1, 3, 3).to_s)
+    assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.expand("atcga", "atcga", 1, 1, 3, 3).to_s)
   end
 end