Git Product home page Git Product logo

debby's Introduction

Debby

Debby is a demonstration of the succinct de Bruijn Graph implementation, in Python. Details can be found on my blog post.

As it is only a demonstration, it doesn't use any efficient data structures for compression or rank/select, and some operations could be shaved off. Perhaps one day Debby will grow up, and I will write tests for, refactor, and optimize her.

Usage

  1. First you need to stream (k+1)-mers (that is, a kmer and an edge label) into format.sh. So, if you want to make a de Bruijn graph with 3-mers, you would need to break your reads into 4-mers. Also, they reads must be padded with $ signs (see the blog for why). I'll leave this up to you, but for testing I have included the file sample-edges.

  2. These need to be sorted, and filtered for unique nodes.

  3. Finally, run reduce.py on the output to format the graph correctly (in plaintext) and output to a file. The format is that the last line is the k value, the second last line is the F-array (how we represent the node labels), and the previous lines represent a (last-flag, edge-label, shared-outgoing-node-flag) tuple, for each edge.

Here is how to do so with the supplied sample-edges file:

$ cat sample-edges | ./format.sh | sort -u | ./reduce.py > my-graph

The reason I split it into stages (and made my Python code operate entirely on streams in a map-reduce fashion) was to demonstrate that these parts can be easily distributed, or the sort phase can be replaced with a more sophisticated k-mer counting method (e.g. bloom filters).

After you have your graph file, you can open a python interpreter, import debby, and play with the interface:

>>> import debby as db
>>> g = db.debruijn_graph.load("my-graph")
>>> g.label(4)
'TAC'
>>> g.indegree(4)
1

and so on...

debby's People

Contributors

alexbowe avatar mmuggli avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.