X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=code_ruby%2Flib%2Fmaasha%2Falign%2Fmatch.rb;h=784a2d12f2a1916adb8a216c821769683697a19a;hb=e95fec9ae319e4da65e7dd5700abf7b4a036b411;hp=d6a800865544267218eb7c4eb5343535f367573c;hpb=3c7f9678a0e3344d809487e5e4af048570b50e26;p=biopieces.git diff --git a/code_ruby/lib/maasha/align/match.rb b/code_ruby/lib/maasha/align/match.rb index d6a8008..784a2d1 100644 --- a/code_ruby/lib/maasha/align/match.rb +++ b/code_ruby/lib/maasha/align/match.rb @@ -23,6 +23,7 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'inline' +require 'maasha/math_aux' # Class for describing a match between two sequences q and s. class Match @@ -57,6 +58,18 @@ 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 << " #{seq[@q_beg .. q_end]}" if seq