Created
June 24, 2014 13:13
-
-
Save Winterflower/6468220450cc7ab9466d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
def kmer(sequence,k): | |
length=len(sequence) | |
#if the kmer size if greater than the lenght of the sequene | |
if k>=length: | |
print "You specified a kmer size, which if greater or equal to the length of the sequence" | |
return | |
stepsize=k-1 | |
i=0 | |
kmers=[] | |
while i+stepsize<length: | |
kmers.append(sequence[i:i+k]) | |
i+=1 | |
print kmers | |
kmer("ABCDGFGFGFGFGFGG",90) | |
#OUTPUT ALL OF THE POSSIBLE KMERS FROM A PREDEFINED ALPHABET | |
def all_kmers(alphabet,k): | |
nodenumber=len(alphabet) | |
kmerTree=[] | |
return kmerTree | |
def kmer_subtree(rootnode, length): | |
return [rootnode,[]*length] | |
maintree=kmer_subtree('/',4) | |
print maintree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment