Zubair Khalid

Virologist/Molecular Biologist | Veterinarian | Bioinformatician

Conventional & Molecular Virology • Vaccine Development • Computational Biology

Dr. Zubair Khalid is a veterinarian and virologist specializing in conventional and molecular virology, vaccine development, and computational biology. Dedicated to advancing animal health through innovative research and multi-omics approaches.

Dr. Zubair Khalid - Veterinarian, Virologist, and Vaccine Development Researcher specializing in Computational Biology, Multi-omics, Animal Health, and Infectious Disease Research

Blog · Guides · Published 2026-07-12

De Bruijn Graphs in Genome Assembly: An Intuitive Technical Guide

This guide explains how de Bruijn graphs reconstruct genomes from short sequencing reads. It focuses on the core concepts of k-mers, graph branching, repeats, coverage depth, and the practical decisions that determine assembly quality. Researchers, bioinformatics students, and analysts planning a genome assembly project will find actionable explanations rather than abstract theory. The entire framework depends on understanding how fragments of DNA (k-mers) connect into a graph that represents the original genome. For comprehensive background on sequencing technology and assembly fundamentals, the NCBI Bookshelf offers free textbooks on these topics NCBI Bookshelf. The EMBL-EBI Training portal provides structured courses on assembly algorithms and graph theory in bioinformatics EMBL-EBI Training.


At a Glance

Concept Description Relevance
k-mer A subsequence of length k derived from a read The fundamental building block of the graph
de Bruijn graph A directed graph where nodes are k-mers and edges connect overlapping k-mers (k-1 overlap) Captures adjacency information from reads
Graph branch A node with multiple outgoing edges, often caused by repeats or heterozygosity Signals ambiguity in the assembly path
Repeat A sequence that appears two or more times in the genome Creates graph complexity and misassemblies
Coverage Average number of reads (or k-mers) covering a genomic position Affects error correction and graph simplification
Bubble A short alternate path in the graph, often due to sequencing errors or SNPs Must be resolved or removed during assembly

What Are k-mers and De Bruijn Graphs?

A de Bruijn graph is built from fixed length subsequences called k-mers. For each read of length L, you extract every overlapping substring of length k. The graph contains one node for each unique k-mer. A directed edge connects node A to node B if the last (k-1) nucleotides of A match the first (k-1) nucleotides of B. This edge indicates that the k-mers are adjacent in the original DNA. The Galaxy Training Network has an excellent interactive tutorial that shows how reads fragment and how edges form in the graph Galaxy Training Network.

The result is a compact representation of all read overlap information without storing the original reads. Each k-mer must cover a particular genomic region, the depth of coverage for a node is simply the number of reads that contributed that k-mer. When coverage is high and errors are low, the graph forms a single path representing the genome. In practice, coverage varies and sequencing errors introduce spurious nodes, so the graph must be cleaned before traversal.


How Graph Branches and Repeats Complicate Assembly

Graph branches occur at nodes with more than one outgoing edge. These branches arise from three main sources. The first is repeats: if a sequence occurs twice in the genome, the graph will show a branch point where the path splits and later rejoins. The second source is heterozygous variants in diploid genomes: alternate alleles create short parallel paths called bubbles. The third source is sequencing errors, which generate low coverage branches that can often be removed by coverage filtering.

Repeats are the hardest obstacle. A unique repeat of length greater than the read length will cause the graph to become tangled. In such cases, the assembler cannot decide whether the branch leads to one genomic region or another. The Bioconductor documentation on graph based assembly packages describes tools that attempt to resolve repeats using paired end read information or optical maps Bioconductor. Without such extra data, the assembly will end at the repeat boundary.


Why Coverage Matters

Coverage determines how reliably the graph reflects the true genome. Nodes with very low coverage are likely sequencing errors. A typical error correction step removes nodes whose coverage falls below a threshold, often a small multiple of the estimated mean coverage. This cleanup drastically reduces graph complexity.

Coverage also influences the choice of k. Larger k values increase specificity: they make it harder for repeats to confuse the graph because longer k-mers are more likely to be unique. However, larger k also reduces coverage per k-mer because fewer reads contribute to each unique k-mer. The NCBI Sequence Read Archive contains many datasets that exemplify how coverage affects assembly quality across different sequencing platforms NCBI Sequence Read Archive. For a low coverage dataset, a small k (say 21) may give enough connectivity to achieve a decent assembly. For high coverage data, a larger k (e.g., 55) can resolve more repeats.


Decision Criteria for Graph Based Assembly

Selecting the k value is the primary technical decision. There is no universally correct k. The optimal choice depends on read length, genome complexity, and coverage depth. The EMBL EBI training materials provide a decision framework that includes the following criteria:

  • Read length: k must be less than read length. Use k roughly half of the read length for initial tests.
  • Coverage: k should be small enough that most k-mers are covered several times. A rough guideline: k < log2(total number of sequenced bases).
  • Repeat content: genomes with many repeats benefit from larger k to reduce branch ambiguity, but only if coverage is sufficient.
  • Memory: larger k creates more unique k-mers, increasing memory usage. Software like SPAdes or Velvet can report k mer frequency histograms to help choose.

A practical approach is to run assembly with three or four different k values and pick the assembly with the longest N50 contig length and the fewest misassemblies. Galaxy Training Network tutorials show how to compare assembly metrics using built in tools Galaxy Training Network.


Practical Workflow or Implementation Sequence

  1. Quality control your reads. Use tools like FastQC to check base quality and adapter contamination. Remove adapters and trim low quality bases. Step by step guides for this preprocessing are found in the EMBL EBI training resources.
  2. Estimate coverage and genome size. Use k mer counting software (e.g., Jellyfish) on a subsample of reads. The peak in the k mer frequency histogram gives the mean coverage. The sum of unique k mer counts approximates genome size.
  3. Select candidate k values. Choose at least three k values around the guideline from decision criteria. For example, if mean coverage is 50x, try k=31, k=41, and k=51.
  4. Build the graph and assemble. Run an assembler such as SPAdes (which uses multiple k values internally), Velvet, or ABySS. The assembler will construct the de Bruijn graph, remove low coverage nodes, resolve bubbles, and output contigs.
  5. Evaluate assembly statistics. Compute N50, L50, number of contigs, and total assembly length. Check for completeness with BUSCO.
  6. Refine if needed. If the assembly is fragmented, try a different k range or include paired end information. Some assemblers accept read pairs to scaffold across repeats.
  7. Document decisions. Record the k values, coverage thresholds, and error correction parameters used. This ensures reproducibility when results are revisited.

Common Mistakes

A frequent error is choosing too large a k value for the available coverage. The graph becomes disconnected because many k mers appear only once. The result is thousands of tiny contigs. Another mistake is failing to remove sequencing errors before graph construction. Including erroneous k mers as separate nodes creates artificial branches that confuse the traversal algorithm.

A third mistake is ignoring the effect of repeats on the assembly length. De Bruijn graphs compress repetitive regions because a single node may represent multiple genomic copies. The assembled contig length will be less than the true genome size. Do not interpret a smaller assembly as a sign of a partial genome.


Limits and Uncertainty

De Bruijn based assembly has inherent limitations. It cannot resolve repeats longer than the read length without external information (e.g., mate pairs, long reads). The choice of k introduces a tradeoff between specificity and connectivity that no algorithm can eliminate. Short read assemblies produced from de Bruijn graphs are inherently fragmented and should not be considered finished genomes. They serve as scaffolds for further finishing steps.

Graph complexity also depends on ploidy. In diploid or polyploid genomes, heterozygosity causes parallel paths that can be resolved only if the assembler recognizes bubbles and merges them. The uncertainty remains in regions of high heterozygosity or in collapsed repeats. The NCBI Bookshelf contains a chapter on the mathematical foundations of these limitations.


Frequently Asked Questions

1. Why can't I just use the original reads instead of k mers? Assembling directly from all read overlaps (overlap layout consensus, OLC) becomes computationally prohibitive for genomes with tens of millions of reads. De Bruijn graphs reduce the problem by only considering fixed length overlaps, making the assembly tractable for large datasets.

2. Does a larger k always give a better assembly? No. While larger k can resolve some repeats, it also reduces the coverage depth per k mer. If coverage is low, many true k mers will be missing and the graph will fragment. The optimal k balances specificity and connectivity.

3. How do paired end reads help the de Bruijn graph approach? Paired end reads provide distance information between two k mers that are separated by a known insert size. Assemblers can use this information to resolve branches caused by repeats by confirming which direction the path should take.

4. What is a k mer coverage histogram and what does the peak mean? A histogram plots the frequency of each k mer against the number of times it appears in the reads. The peak at low frequencies (1 to 5) often represents sequencing errors. The main peak at a higher frequency represents the true k mer coverage. The position of this peak is the mean coverage depth used in downstream decisions.


References and Further Reading


Related Articles