Skip to content

Instantly share code, notes, and snippets.

@indapa
Created July 6, 2012 02:51
Show Gist options
  • Save indapa/3057780 to your computer and use it in GitHub Desktop.
Save indapa/3057780 to your computer and use it in GitHub Desktop.
Enumerate the possible genotypes for a given ploidy
from itertools import *
ploidys=[2,3,4]
for p in ploidys:
l=[ combo for combo in combinations_with_replacement(['A','C','G','T'],p) ]
for g in l:
print "".join( list(g) ), "ploidy: ", p
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment