← Lucas B. C. Rocha

PhD research · UFMS · interactive demo

Mapping a DNA sequence onto a de Bruijn graph

Given a sequence s and a de Bruijn graph G, find the walk in G whose spelled sequence is as close as possible to s. This page runs the exact algorithm from the thesis, ported line by line from the C++ in variante1/bmt, on a small example, step by step.

1 Input

  1. de Bruijn graph
  2. Multilayer graph
  3. Dijkstra
  4. Traceback
  5. Result

2 de Bruijn graph G

3 Terminal


        

4 Multilayer graph and Dijkstra

one row per base of s, one column per node of the sequence graph

How the multilayer graph works

Each k-mer of G becomes a chain of k nodes, one per base: this is the sequence graph. The multilayer graph stacks one copy of it per base of s, plus a dummy column for skipping bases. Every edge has cost 0 or 1:

  • down-diagonal to a neighbour in the next layer: read the next base of s against a base of the graph (0 if equal, 1 otherwise);
  • straight down: drop a base of s (cost 1);
  • sideways inside a layer: spend a base of the graph without reading s (cost 1).

The cheapest source-to-sink path, found with Dijkstra, is an optimal mapping. The method follows Rautiainen and Marschall, Aligning sequences to general graphs in O(V + mE) time.

5 Alignment