]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bug in pair assembler
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 30 Oct 2013 21:37:08 +0000 (21:37 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 30 Oct 2013 21:37:08 +0000 (21:37 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2253 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/lib/maasha/seq/assemble.rb

index de14b64c1fe080fdcf65c34dd61c6e3dafc9e51f..c6f528b8ce9800061cd5aabdfada95b1911a5c11 100644 (file)
@@ -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]