There's more than one way to do things  
PerlMonks 
Re^3: How can one generate all possible combinations with reference to string positions?by BrowserUk (Pope) 
on Feb 21, 2013 at 05:39 UTC ( #1019892=note: print w/ replies, xml )  Need Help?? 
First. You haven't answered my question: What do you start with in terms of the groups and positions. But forget that for now. Actually there will be 20 major groups (i.e. 20 amino acids) and each group will have synonymous number of codons (except methionine & tryptophan). That also doesn't tell us how many groups and how many positions for each group you are hoping to deal with, so for sake of somewhere to start I'm going to use your description from the OP. If the string contains, say 500 positions with 10 main groups and each group with varying number of elements, The way to tackle the problem would be to permute the values in each group independently, then permute each permutation from each group ,against all the permutations from the second group, against all the permutations from the third group; ... and so one. And then substitute the ordered permutations back into the original positions in the composite string. But here is the problemFor the sake of something concrete, let's take that to mean you have 10 groups with 50 positions per group in your 500 position string. Each of those 10 groups has 50! permutations: 1*2*3*...*50 = 30414093201714379654605756361199494046490000000000000000000000000 permutations. And then you have all the combinations of each of those permutations with each of the (same huge number of) permutations in each of the other groups. So your final number of strings is going to be something like 50!**10 =
That number is so big that if you could print 1 per nanosecond; and had as many printers as there are atoms in the universe running day & night, you wouldn't finish before the universe ceased to exist due to heat death. And that's only 10 amino acids and you have 20; and only 500 characters, and genomes are millions or billions in length. Bottom line. You cannot tackle this using brute force. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks  Silence betokens consent  Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom

