From c9692a2c6656ac2fc8b7ae885fd93489e9fd5f14 Mon Sep 17 00:00:00 2001 From: Calvin Date: Tue, 5 Mar 2013 12:33:52 -0500 Subject: 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; --- generate_kmers.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 generate_kmers.py (limited to 'generate_kmers.py') 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 -- cgit v1.2.3