]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixing up backtrack code
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 28 Nov 2012 18:08:46 +0000 (18:08 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 28 Nov 2012 18:08:46 +0000 (18:08 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2008 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/remove_primers
code_ruby/lib/maasha/seq.rb
code_ruby/lib/maasha/seq/backtrack.rb
code_ruby/test/maasha/seq/test_backtrack.rb

index 720d943ee6db515b49980342afb96a8717a0fa22..5f26eb6051a3bc2092c5c6a1dc882be7dd2f1efc 100755 (executable)
@@ -33,6 +33,8 @@ require 'pp'
 require 'maasha/biopieces'
 require 'maasha/seq'
 
+include BackTrack
+
 casts = []
 casts << {:long=>'forward',    :short=>'f', :type=>'string', :mandatory=>true,  :default=>nil, :allowed=>nil, :disallowed=>nil}
 casts << {:long=>'reverse',    :short=>'r', :type=>'string', :mandatory=>true,  :default=>nil, :allowed=>nil, :disallowed=>nil}
index a8646019ffb17833cb256a85a4f945ef9a556c0d..57d70b27cc5b5cd0b29cb88a20be7f3c9cec3a0c 100644 (file)
@@ -78,7 +78,6 @@ class SeqError < StandardError; end
 class Seq
   #include Patscan
   include PatternMatcher
-  include BackTrack
   include Digest
   include Trim
 
index 0bb578920f14c4351f5f37c5b4bac31162956295..714cb226ef00dbaa642aaf10be7d0d1298a0113c 100644 (file)
@@ -65,13 +65,16 @@ module BackTrack
     matches = []
 
     while result = track_C(self.seq, self.length, pattern, offset, max_mismatches, max_insertions, max_deletions)
-      match = Match.new(result[0], result[1], result[2], result[3], result[4], self.seq[result[0] ... result[0] + result[1]])
+      pos, length, mis, ins, del = result
+
+      match = Match.new(pos, length, mis, ins, del, self.seq[pos ... pos + length])
 
       if block_given?
         yield match
       else
         matches << match
       end
+
       offset = match.pos + 1
     end
 
index 43af1def2702c2997a1aa9a14df6d9f88d4d0786..02260e89d8dcf869cd0c9fe28751a5fe75bb407d 100644 (file)
@@ -28,6 +28,8 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
 require 'test/unit'
 require 'maasha/seq'
 
+include BackTrack
+
 class BackTrackTest < Test::Unit::TestCase
   def setup
     #                       0         1