Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Trying to construct all possible strings from 4 bases [ATCG]

by Molt (Chaplain)
on Feb 21, 2005 at 10:57 UTC ( #433014=note: print w/ replies, xml ) Need Help??


in reply to Trying to construct all possible strings from 4 bases [ATCG]

On the basis that you're more interested in getting the results rather than doing it yourself you may want to use the String::Combination module on CPAN which does what you need.

The following code seems to do the job..

#!/usr/bin/perl use strict; use warnings; use String::Combination; # Get all the combinations of bases which have a prescribed length. my $length=2; my @combinations=String::Combination::combination('atcg',$length); # Output the results. print "$_\n" for @combinations;


Comment on Re: Trying to construct all possible strings from 4 bases [ATCG]
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://433014]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-07-28 09:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls