Method: String#nt_parser
- Defined in:
- lib/viral_seq/string.rb
#nt_parser ⇒ Regexp
parse the nucleotide sequences as a String object
and return a Regexp object for possible matches
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/viral_seq/string.rb', line 45 def nt_parser match = "" self.each_char.each do |base| base_array = base.to_list if base_array.size == 1 match += base_array[0] else pattern = "[" + base_array.join("|") + "]" match += pattern end end Regexp.new match end |