newtoperlprog has asked for the wisdom of the Perl Monks concerning the following question:

Dear All, I am trying to generate multiple strings of DNA based on certain rule.
The string length will be of 10 bases based on C)2 N3(A|G)4-6 N7 T8(A|T)9(A|T)10 where N could be (A or T or G or C).
So according to the above rule, 1st and 2nd position could be a combination of (GG or GC or CG or CC) followed by (A or T or G or C) at position 3 followed by a combination of (AAA or AAG or AGG .. and so on).
The thing which I am not able to figure out is do I need to put lot of for loops to do it or is there any short way using perl.
Thank you for any help or suggestions.

Replies are listed 'Best First'.
Re: Multiple string generation
by Eily (Monsignor) on Jul 15, 2014 at 13:04 UTC
Re: Multiple string generation
by hippo (Archbishop) on Jul 15, 2014 at 13:02 UTC

    Hello newtoperlprog,

    Could you possibly use <code> tags so that your regex sample is legible please? It is a bit tricky to comment on it otherwise. Don't forget you can use the "preview" button to see what your post looks like before submitting it.

      newtoperlprog: And could you please also take a look at the apparently malformed C)2 N3(A|G)4-6 N7 T8(A|T)9(A|T)10 sequence generator template (shouldn't it begin with (G|C)2?) and maybe even fix it?