@options = options
@options[:mismatches_max] ||= 0
@options[:overlap_min] ||= 1
- @options[:overlap_max] ||= entry1.length
- @options[:overlap_max] = [@options[:overlap_max], entry1.length, entry2.length].min
end
# Method to locate overlapping matches between two sequences.
def match
- overlap = @options[:overlap_max]
+ if @options[:overlap_max]
+ overlap = [@options[:overlap_max], @entry1.length, @entry2.length].min
+ else
+ overlap = [@entry1.length, @entry2.length].min
+ end
while overlap >= @options[:overlap_min]
mismatches_max = (overlap * @options[:mismatches_max] * 0.01).round
+
+ offset1 = @entry2.length - overlap
+ offset2 = 0
- if match_C(@entry1.seq, @entry2.seq, @entry1.length - overlap, 0, overlap, mismatches_max)
+ if match_C(@entry1.seq, @entry2.seq, offset1, offset2, overlap, mismatches_max)
entry_left = @entry1[0 ... @entry1.length - overlap]
entry_right = @entry2[overlap .. -1]