diff options
author | Calvin <calvin@EESI> | 2013-03-05 12:33:52 -0500 |
---|---|---|
committer | Calvin <calvin@EESI> | 2013-03-05 12:33:52 -0500 |
commit | c9692a2c6656ac2fc8b7ae885fd93489e9fd5f14 (patch) | |
tree | 52f78aa6a8f954789ec5ce660562885d82d63a8a | |
parent | 42df9367bfb0e12f4d32067b6764bfa34ebaaff8 (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;
-rwxr-xr-x | generate_kmers.py | 7 |
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 |