summaryrefslogtreecommitdiff
path: root/generate_kmers.py
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-03-05 12:33:52 -0500
committerCalvin <calvin@EESI>2013-03-05 12:33:52 -0500
commitc9692a2c6656ac2fc8b7ae885fd93489e9fd5f14 (patch)
tree52f78aa6a8f954789ec5ce660562885d82d63a8a /generate_kmers.py
parent42df9367bfb0e12f4d32067b6764bfa34ebaaff8 (diff)
Added generate_kmers.py
This little script will output all the possible kmer permutations to stdout. The only input is the kmer length desired. Here are some examples. output 2mers ./generate_kmers.py 2 > 2mers.py output N-mers up to 6 with a bit of bash-foo for i in `seq 6`; do ./generate_kmers.py $i > ${i}mers.txt; done;
Diffstat (limited to 'generate_kmers.py')
-rwxr-xr-xgenerate_kmers.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/generate_kmers.py b/generate_kmers.py
new file mode 100755
index 0000000..4cd9aca
--- /dev/null
+++ b/generate_kmers.py
@@ -0,0 +1,7 @@
+#!/usr/bin/python
+import itertools
+import sys
+
+kmer_array ='\n'.join(''.join(x) for x in itertools.product('acgt', repeat=int(sys.argv[1])))
+
+print kmer_array