require 'maasha/seq/trim'
require 'narray'
+autoload :BackTrack, 'maasha/seq/backtrack.rb'
+autoload :Dynamic, 'maasha/seq/dynamic.rb'
+
# Residue alphabets
DNA = %w[a t c g]
RNA = %w[a u c g]
end
raise BackTrackError, "Bad pattern: #{pattern}" unless pattern.downcase =~ OK_PATTERN
- raise BackTrackError, "start: #{start} out of range (0 .. #{self.length - 1})" unless (0 .. self.length).include? start
- raise BackTrackError, "stop: #{stop} out of range (0 .. #{self.length - 1})" unless (0 .. self.length).include? stop
+ raise BackTrackError, "start: #{start} out of range (0 .. #{self.length - 1})" unless (0 ... self.length).include? start
+ raise BackTrackError, "stop: #{stop} out of range (0 .. #{self.length - 1})" unless (0 ... self.length).include? stop
raise BackTrackError, "max_mismatches: #{max_mismatches} out of range (0 .. #{MAX_MIS})" unless (0 .. MAX_MIS).include? max_mismatches
raise BackTrackError, "max_insertions: #{max_insertions} out of range (0 .. #{MAX_INS})" unless (0 .. MAX_INS).include? max_insertions
raise BackTrackError, "max_deletions: #{max_deletions} out of range (0 .. #{MAX_DEL})" unless (0 .. MAX_DEL).include? max_deletions
require 'test/unit'
require 'maasha/seq'
-require 'maasha/seq/backtrack'
-
-class Seq
- include BackTrack
-end
class BackTrackTest < Test::Unit::TestCase
def setup
# 0 1
# 01234567890123456789
@seq = Seq.new("test", "tacgatgctagcatgcacgg")
+ @seq.extend(BackTrack)
end
def test_BackTrack_patscan_with_bad_pattern_raises
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
require 'maasha/seq'
-require 'maasha/seq/dynamic'
require 'test/unit'
require 'pp'
-class Seq
- include Dynamic
-end
-
class TestDynamic < Test::Unit::TestCase
def setup
@p = Seq.new("test", "atcg")
+ @p.extend(Dynamic)
end
def test_Dynamic_no_match_returns_nil
def test_Dynamic_patscan_locates_three_patterns_ok
p = Seq.new("test", "ataacgagctagctagctagctgactac")
+ p.extend(Dynamic)
assert_equal(3, p.patscan("tag").count)
end
def test_Dynamic_patscan_with_pos_locates_two_patterns_ok
p = Seq.new("test", "ataacgagctagctagctagctgactac")
+ p.extend(Dynamic)
assert_equal(2, p.patscan("tag", 10).count)
end
end