# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-# Class containing methods for located all Maximally Extended Matches (MEMs) between
-# two strings.
+require 'profile'
+
+# Class containing methods for located all non-redundant Maximally Extended Matches (MEMs)
+# between two strings.
class Matches
- # Class method to located all MEMs bewteen two sequences within a given search
- # space and seed with kmers of a given size.
+ # Class method to located all non-redudant MEMs bewteen two sequences within a given
+ # search space and seeded with kmers of a given size.
def self.find(q_seq, s_seq, q_min, s_min, q_max, s_max, kmer)
m = self.new
m.matches_find(q_seq, s_seq, q_min, s_min, q_max, s_max, kmer)
s_index[q_oligo].each do |s_pos|
match = Match.new(q_pos, s_pos, kmer)
+
unless match_redundant?(redundant, match)
match_expand(match, q_seq, s_seq, q_min, s_min, q_max, s_max)
matches << match
# Method to check if a match is redundant.
def match_redundant?(redundant, match)
redundant[match.q_beg].each do |s_interval|
- if s_interval.include? match.s_beg and s_interval.include? match.s_end
+ if s_interval.include? match.s_beg and s_interval.include? match.s_end # TODO test if include? is slow
return true
end
end