160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'lib/bio/data/na.rb', line 160
def to_re(seq, rna = false)
replace = {
'y' => '[tcy]',
'r' => '[agr]',
'w' => '[atw]',
's' => '[gcw]',
'k' => '[tgk]',
'm' => '[acm]',
'b' => '[tgcyskb]',
'd' => '[atgrwkd]',
'h' => '[atcwmyh]',
'v' => '[agcmrsv]',
'n' => '[atgcyrwskmbdhvn]'
}
replace.default = '.'
str = seq.to_s.downcase
str.gsub!(/[^atgcu]/) { |na|
replace[na]
}
if rna
str.tr!("t", "u")
end
Regexp.new(str)
end
|