]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bit fields in pattern matcher
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 19 Apr 2011 15:04:09 +0000 (15:04 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 19 Apr 2011 15:04:09 +0000 (15:04 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1346 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/Maasha/lib/patternmatcher.rb

index 8dfc66e7b2c81c2814b066435b07ab033b06f0b5..6d9db38da4712a625ea1fb97e9f40a9c2a9135e6 100644 (file)
@@ -32,21 +32,37 @@ BIT_G = 1 << 3
 
 EQUAL          = Array.new(256, 0)
 EQUAL['A'.ord] = BIT_A 
+EQUAL['a'.ord] = BIT_A 
 EQUAL['T'.ord] = BIT_T 
+EQUAL['t'.ord] = BIT_T 
 EQUAL['U'.ord] = BIT_T 
+EQUAL['u'.ord] = BIT_T 
 EQUAL['C'.ord] = BIT_C 
+EQUAL['c'.ord] = BIT_C 
 EQUAL['G'.ord] = BIT_G 
+EQUAL['g'.ord] = BIT_G 
 EQUAL['M'.ord] = (BIT_A|BIT_C)
+EQUAL['m'.ord] = (BIT_A|BIT_C)
 EQUAL['R'.ord] = (BIT_A|BIT_G)
+EQUAL['r'.ord] = (BIT_A|BIT_G)
 EQUAL['W'.ord] = (BIT_A|BIT_T)
+EQUAL['w'.ord] = (BIT_A|BIT_T)
 EQUAL['S'.ord] = (BIT_C|BIT_G)
+EQUAL['s'.ord] = (BIT_C|BIT_G)
 EQUAL['Y'.ord] = (BIT_C|BIT_T)
+EQUAL['y'.ord] = (BIT_C|BIT_T)
 EQUAL['K'.ord] = (BIT_G|BIT_T)
+EQUAL['k'.ord] = (BIT_G|BIT_T)
 EQUAL['B'.ord] = (BIT_C|BIT_G|BIT_T)
+EQUAL['b'.ord] = (BIT_C|BIT_G|BIT_T)
 EQUAL['D'.ord] = (BIT_A|BIT_G|BIT_T)
+EQUAL['d'.ord] = (BIT_A|BIT_G|BIT_T)
 EQUAL['H'.ord] = (BIT_A|BIT_C|BIT_T)
+EQUAL['h'.ord] = (BIT_A|BIT_C|BIT_T)
 EQUAL['V'.ord] = (BIT_A|BIT_C|BIT_G)
+EQUAL['v'.ord] = (BIT_A|BIT_C|BIT_G)
 EQUAL['N'.ord] = (BIT_A|BIT_C|BIT_G|BIT_T)
+EQUAL['n'.ord] = (BIT_A|BIT_C|BIT_G|BIT_T)
 
 # Module containing code to locate nucleotide patterns in sequences allowing for
 # ambiguity codes and a given maximum edit distance.
@@ -152,7 +168,7 @@ module PatternMatcher
 
   # Method to determine if a match occurred.
   def match?(char1, char2)
-    (EQUAL[char1.upcase.ord] & EQUAL[char2.upcase.ord]) != 0
+    (EQUAL[char1.ord] & EQUAL[char2.ord]) != 0
   end
 
   # Method to determine if a mismatch occured.