Explaining De Bruijn graphs in genome assembly
De novo assembly reconstructs a genome from short sequencing reads without a reference. Unlike overlap-layout-consensus (OLC), which finds pairwise read overlaps and seeks a Hamiltonian path, De Bruijn graphs break reads into k-mers, create nodes from (k-1)-mers, and edges represent k-mers linking prefix to suffix nodes. An Eulerian path using all edges reconstructs the sequence efficiently. Repeats longer than k collapse in the graph, causing branching and ambiguity, but unique k-mers spanning repeats and coverage multiplicity aid resolution. De Bruijn graphs trade pairwise comparisons for k-mer connectivity, simplifying computations compared to OLC.
High‑throughput sequencing instruments don’t read chromosomes end–to–end, they give you a bag of millions of short strings. A de novo assembler has to reconstruct the original string by finding a way to “stitch” those fragments together without the help of a reference.
Two paradigms have emerged for doing that:
-
In an overlap–layout–consensus (OLC) assembler you treat each read as an indivisible unit. You compute all significant pairwise overlaps between reads, build a graph whose vertices are reads and whose edges are labelled with the length/sequence of the overlap, lay the graph out, and then try to find a path that visits every read exactly once. If you can find a Hamiltonian path through that graph, you have a superstring that contains all the reads in order. This approach worked well when reads were long and few, but the all‑against‑all overlap step is (O(n^2)) in the number of reads and finding Hamiltonian paths is NP‑hard, so it becomes impractical with hundreds of millions of 100 bp Illumina reads.
-
In a de Bruijn graph assembler you cut the reads up before building the graph. Each read is decomposed into its constituent k‑mers, i.e. all substrings of length (k). The de Bruijn graph has a vertex for every distinct ((k!-!1))‑mer seen in the data, and a directed edge for every k‑mer from its ((k!-!1))‑base prefix to its ((k!-!1))‑base suffix. Sequencing coverage turns into edge multiplicities. Instead of looking for a Hamiltonian path through vertices, you now look for an Eulerian path that uses each edge the appropriate number of times. An Eulerian path exists whenever all but at most two vertices are balanced, and it can be found in linear time.
This change of representation has two important consequences for repeats and reconstruction:
-
The choice of (k) determines your ability to resolve repeats. A repeat shorter than (k) bases will be broken by unique flanking k‑mers and will appear as distinct edges in the graph. A repeat longer than (k) bases collapses into a single path through the graph, because all of the k‑mers inside the repeat are identical regardless of how many copies there are. The boundaries of such a repeat show up as branch points where unique flanking sequences converge on and diverge from the repeated path. Assemblers use the multiplicity of edges (coverage), the presence of “bridging” reads with longer inserts, or adjust (k) to decide how many times to traverse the repeat. In contrast, in an OLC graph a long repeat simply produces many reads with highly similar overlaps, and the layout step has to break the tie by looking for reads that span the repeat.
-
Because de Bruijn graphs are built from k‑mers rather than whole reads, sequencing errors are localized. An error creates a handful of low‑abundance k‑mers that form dead–end “tips” or bubbles in the graph that can be pruned. In OLC assemblers an error can corrupt an entire overlap and has to be filtered out up front.
Once the de Bruijn graph is simplified to remove error‑induced branches, contigs are generated by finding Eulerian paths that traverse each edge the number of times suggested by its count. Concatenating the labels along such a path reconstructs a sequence that contains all of the input k‑mers, and, under ideal conditions, the original genome.