Jesús Gabriel y Galán
1/16/2009 2:11:00 PM
On Fri, Jan 16, 2009 at 2:56 PM, George George
<george.githinji@gmail.com> wrote:
>
>> => nil
>> irb(main):015:0> expand "ac[ta]cct"
>> => ["actcct", "acacct"]
>>
>> It's probably overkill for your needs.
>>
>> Jesus.
>
> hi Jesus!
> Thank you for referencing me to that quiz, its nice to study the code.
> That exactly solves one of the problems that i had while looking for dna
> motifs which are represented as regular expressions, but need to be
> expanded if you gonna use them as possible dna primers. and then such
> back and see which one gives the best predictive value ... blah blah ...
> Sorry for the bio talk :)
You are welcome. Just a comment on the above: I have realized that if
each position of the sequence is just one character, then your
original string is already a valid regexp for the problem, so no need
to change [ta] to (t|a) as I was doing, cause [ta] is a character
class with those two possibilities and those work too:
irb(main):001:0> require 'quiz143'
=> true
irb(main):002:0> /#{"ac[ta]cc"}/.generate
=> ["actcc", "acacc"]
:-)
Jesus.