aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-05-14 16:20:02 -0400
committerCalvin <calvin@EESI>2013-05-14 16:20:02 -0400
commit6f4da548141286f7236823294788c3c18f5153db (patch)
tree2142265674326d71a6e7a3cdbeb9ed6f2dbd76a3 /src
parent799f38571f8f74c92e91e4b383e75f1476267082 (diff)
generate kmers should stand alone
Diffstat (limited to 'src')
-rwxr-xr-xsrc/python/generate_kmers19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/python/generate_kmers b/src/python/generate_kmers
index 8d5bee2..75468cb 100755
--- a/src/python/generate_kmers
+++ b/src/python/generate_kmers
@@ -1,8 +1,23 @@
#!/usr/bin/env python
-import quikr
+import itertools
import sys
+def generate_kmers(kmer):
+ """ generate all possible kmers permutations seperated by newlines
+
+ >>> kmers = generate_kmers(1)
+ >>> generate_kmers(2)
+
+ param kmer: the desired Mer size
+ type kmer: int
+ return: Returns a string of kmers seperated by newlines
+ rtype: string
+ """
+
+ return '\n'.join(''.join(x) for x in itertools.product('acgt', repeat=kmer))
+
if(len(sys.argv) < 2):
print "usage: generate_kmers KMER_SIZE"
exit(1)
-print quikr.generate_kmers(int(sys.argv[1]))
+
+print generate_kmers(int(sys.argv[1]))