X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=code_ruby%2Flib%2Fmaasha%2Fseq%2Fassemble.rb;h=c6f528b8ce9800061cd5aabdfada95b1911a5c11;hb=f2b18307294690cf1376b51357469910b509e695;hp=de14b64c1fe080fdcf65c34dd61c6e3dafc9e51f;hpb=a5d19041b1dcfe481eef2747058f63173a36aaf3;p=biopieces.git diff --git a/code_ruby/lib/maasha/seq/assemble.rb b/code_ruby/lib/maasha/seq/assemble.rb index de14b64..c6f528b 100644 --- a/code_ruby/lib/maasha/seq/assemble.rb +++ b/code_ruby/lib/maasha/seq/assemble.rb @@ -42,18 +42,23 @@ class Assemble @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]