From: martinahansen Date: Wed, 16 Jan 2013 09:47:10 +0000 (+0000) Subject: fixed bad tests in match.rb X-Git-Url: https://git.donarmstrong.com/?p=biopieces.git;a=commitdiff_plain;h=723c21eda3eccc2af806d925ac57bf5fb367e6c6 fixed bad tests in match.rb git-svn-id: http://biopieces.googlecode.com/svn/trunk@2078 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_ruby/lib/maasha/align/match.rb b/code_ruby/lib/maasha/align/match.rb index 784a2d1..47a5fbd 100644 --- a/code_ruby/lib/maasha/align/match.rb +++ b/code_ruby/lib/maasha/align/match.rb @@ -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 diff --git a/code_ruby/test/maasha/align/test_match.rb b/code_ruby/test/maasha/align/test_match.rb index 79df7cd..40e84f2 100755 --- a/code_ruby/test/maasha/align/test_match.rb +++ b/code_ruby/test/maasha/align/test_match.rb @@ -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