I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
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
class DeBruijnGraph: | |
""" A de Bruijn multigraph built from a collection of strings. | |
User supplies strings and k-mer length k. Nodes of the de | |
Bruijn graph are k-1-mers and edges correspond to the k-mer | |
that joins a left k-1-mer to a right k-1-mer. """ | |
@staticmethod | |
def chop(st, k): | |
""" Chop a string up into k mers of given length """ | |
for i in xrange(0, len(st)-(k-1)): |