Tool:miniDBG - a Jupyter notebook for teaching De Bruijn Graph assembly
0
7
Entering edit mode
2.1 years ago
Michael 54k

Dear community,

I wanted to share a small Jupyter notebook I just made for teaching in our course on "Genome scale algorithms" at the University of Bergen. De Bruijn Graphs (DBG) are popular, among other applications, for the assembly of NGS short reads. Therefore, they have been included in bioinformatics curricula. When looking for instructive code examples, I found some examples that demonstrate the first step of parsing k-mers into a dictionary but stopped short of implementing real assembly strategies. On the other hand, 'real-world' applications like Velvet or Abyss may be a bit too complex for teaching concepts.

That is where miniDBG could be useful, as 'minimal' implementation of a DBG, good enough for demonstrating the core concepts and assembling some short sequences. Thanks to using the igraph graph analysis library, the code can be very compact and at the same time, allows to visualize small graphs, and to experiment with different strategies and improve and add functionality.

It's meant as a teaching tool and is only suitable for toy examples (don't feed it your NGS files). Hope it could be useful for anyone teaching assembly.

https://github.com/mdondrup/miniDBG

python deBruijnGraph de_bruijn_graph assembly teaching • 1.7k views
ADD COMMENT
1
Entering edit mode

I added a configuration file to my fork of your repo to define an environment so that anyone can run it right on their browser with no installation or login needed. It is a temporary session on a remote instance served via MyBinder.org.
My fork is here. Feel free to use it as a guide to add the ability to your source.
Anyone can try it by clicking this following badge: badge

I'm happy to make a PR if you'd prefer that? You'd have to change the URL of the badge to point at your branch after the pull.
I can update the launch link here point at yours if you add it.

ADD REPLY
0
Entering edit mode

That is great indeed. Any chance to view the plots inline too? I think going via your fork is fine.

ADD REPLY
0
Entering edit mode

Not quite sure what behavior you are seeking here?
The plots show up when you run the notebook after the session opens. Or if you press Trust button in the upper right corner area after the session starts. Or you can somewhat view them in the static notebook rendering, although whatever encoding igraph is using doesn't have the plots show up perfectly in the nbviewer view rendering. Matplotlib and other packages usually are better in nbviewer.

Are you asking for the plots to show up when the session spins up without needing to do anything, like they do in the nbviewer view rendering? I could add a configuration file that sets the Trust to true already.

For some plots to show up without needing to rerun the notebook, with other plotting packages I would output an image as well and have code to render that inline, in another cell just after the cell that actually ran the plot. Showing images survives reloading. Is that what you seek? I don't know enough about igraph to know if it can output a .png format for the figure like matplotlib can.

ADD REPLY
0
Entering edit mode

Hi, you are correct, I needed to press the Trust button then the pre-computed plots appear inline in the notebook without a problem. I should note that seemingly plots only appear if the call to g.viz() is the last call of a code block. That is the reason why some of the blocks are broken up.

I have done some significant bug fixes recently, so maybe I should host a copy myself, too. Could you send the PR?

ADD REPLY
1
Entering edit mode

PR has been made from your current version. I used your current version to add my things.
After pulling you should just need to edit part of the URL in the launch badge to point at your repo.

ADD REPLY
0
Entering edit mode

Thank you very much for your help. I have updated the links, so now the repo should run directly. I will now check if there is still an issue with pycairo and igraph, and test cairocffi as a replacement.

ADD REPLY
0
Entering edit mode

Yes, I thought you were still actively developing it and that is why I figured might be better if you add the MyBinder ability to your source.
I'll try adding the trust setting first (soon) and then send a PR.

About the plots only appearing if the call to g.viz() is the last line of the code block, I suspect there is way to control this more, if you care. I don't have prior experience though with igraph and maybe being overly optimistic based on other more Jupyter-friendly plotting packages. I'll try to keep my eyes open on that since I do have some experience with cairo which this also involves.

ADD REPLY

Login before adding your answer.

Traffic: 2450 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6