8  Genome Assembly: Concepts

Concepts

8.1 The problem

Alignment asks where a read came from in a genome you already have. Assembly asks what the genome is, given only the reads. There is no reference to check against, and no way to be told you are wrong.

That difference in available evidence is the whole subject. An aligner that places a read badly produces one bad record among millions. An assembler that joins two sequences that do not belong together produces a chromosome that is wrong, and every analysis run on it afterwards inherits the error silently, because a misassembled genome looks exactly like a correct one.

Assembly is inference about a sequence you never observe directly. You observe fragments; you propose the sequence most consistent with them. Nothing in that procedure can distinguish “this is the arrangement” from “this is an arrangement consistent with the fragments”, and when repeats are involved those are very different statements.

8.2 Repeats are the entire difficulty

If a genome contained no repeated sequence, assembly would be an easy problem solved decades ago. Overlapping fragments would chain unambiguously from one end of a chromosome to the other, and read length would barely matter.

Genomes are not like that. Eukaryotic genomes are substantially repetitive: transposable elements, segmental duplications, tandem arrays, and whole duplicated genes. When a repeat is longer than a read, every read from inside it is compatible with every copy, and the assembler cannot tell which copy it came from. The information required to resolve the repeat is simply not present in the data.

An assembler facing that has three options, and all of them are lossy. It can stop, producing a break and leaving the repeat unresolved. It can collapse the copies into one, losing however many there really were. Or it can guess, and produce a sequence that is confidently wrong.

NoteWhy read length is the master variable

This is why long reads changed assembly more than they changed anything else in this book. A repeat is resolvable when a read spans it entirely, along with enough unique sequence on both sides to anchor it. Nothing else — not more coverage, not better algorithms, not lower error rates — substitutes for that, because the problem is missing information rather than noisy information. Doubling coverage of reads shorter than the repeat adds nothing at all.

8.3 Two ways to organize the problem

Assemblers differ mainly in what they compute overlaps on, and the two traditions come from different constraints.

Overlap–layout–consensus compares reads to each other, builds a graph in which reads are nodes and overlaps are edges, and finds a path. It handles long and error-prone reads naturally because overlaps are approximate by construction. Its cost is that all-against-all comparison, which was prohibitive for the read counts short-read sequencing produced.

De Bruijn graphs avoid pairwise comparison entirely by cutting every read into overlapping k-mers and building a graph over those. Overlap becomes identity, which is a hash lookup rather than an alignment, and the whole thing scales to enormous numbers of short reads. The cost is fragility: a single sequencing error creates a spurious branch, and every k-mer longer than the read is unavailable, so the graph cannot see further than k.

Neither is obsolete, because the choice follows the data. Short reads in large numbers point one way; long reads point the other. What is worth noticing is that both are the same underlying idea — a graph whose paths are candidate sequences — differing in what a node means and therefore in what tangles the graph into knots.

8.4 The output is a graph, and the file is a flattening

An assembler’s real result is a graph in which some paths are certain and others are ambiguous. A FASTA of contigs is that graph with the ambiguity removed by decision.

This is worth stating because the file format encourages forgetting it. A contig is a path the assembler was confident about. A break between contigs is usually a repeat that could not be resolved — information about the genome, recorded as an absence. Assemblers can emit the graph itself, and for anything where structure matters it is the more honest artifact.

8.5 Contigs, scaffolds, chromosomes

Three words for three different things, routinely blurred in reporting.

A contig is contiguous sequence with no gaps, inferred from overlapping reads. A scaffold is an ordered, oriented set of contigs with gaps of estimated size between them, joined using longer-range evidence — mate pairs, Hi-C contact frequency, optical maps, or a related genome. The gaps are written as runs of N, and their length is an estimate rather than a measurement. A chromosome-level assembly is a scaffolding that reaches the size and number of the real chromosomes.

WarningNs are claims

A run of N is not missing data in the way an unsequenced region is. It is an assertion that these two contigs are adjacent, in this orientation, approximately this far apart. That assertion comes from the scaffolding evidence and can be wrong in all three respects. Scaffolds are more contiguous than contigs and less reliable, and a statistic computed on scaffolds is not comparable to one computed on contigs.

8.6 Diploid genomes have two answers

Most eukaryotes carry two copies of each chromosome that differ from each other. A single consensus sequence is therefore not the genome — it is a composite, and in a region where the haplotypes differ structurally it may be a sequence neither parent has.

Older assemblers collapsed heterozygosity by design, which was a reasonable simplification when nothing could do better. Where the haplotypes are similar enough it is nearly harmless, and where they diverge the assembler tends instead to produce both versions as separate contigs — inflating the assembly and duplicating genes, which is why an unexpectedly large assembly with many duplicated genes is a heterozygosity signal rather than a discovery.

Haplotype-resolved assembly instead produces both sequences and says which is which. Doing that requires evidence about which variants travel together: reads long enough to span multiple heterozygous sites, sequencing of the parents, or long-range contact data. This is the direction the field has moved, and it changes what an assembly is — from one sequence per genome to one per haplotype.

8.7 Telling a good assembly from a big one

Assembly quality is not one number, and the most-quoted number is the most misleading.

N50 is the contig length at which half the assembly sits in contigs that long or longer. It measures contiguity, and it is trivially improved by joining things — including by joining them wrongly. An assembler that guesses at repeats scores better on N50 than one that stops honestly.

Contiguity is therefore one axis of three, and the others need separate evidence:

  • Correctness — are the bases right and the joins real? Best assessed against the reads themselves, by asking whether the k-mers in the assembly are the k-mers the reads support. This needs no reference, which matters because for a new genome there isn’t one.
  • Completeness — is the expected content present, once each? Gene-based measures answer this in biological terms, and their most useful signal is duplication: genes found twice usually mean uncollapsed haplotypes rather than real duplication.
  • Phasing — for a diploid assembly, are the haplotypes actually separated, or have blocks been switched?

The three can be traded against each other, which is why any single metric can be gamed. A more contiguous assembly may be less correct. A more complete one may be less contiguous. Reporting one number invites exactly the optimization that damages the others, and reporting all three is the difference between an assembly you can defend and one that merely looks impressive.

8.8 What to take forward

  • Assembly infers a sequence you never observe, and a wrong answer looks exactly like a right one.
  • Repeats longer than a read are unresolvable in principle, not in practice; read length is the variable that matters and coverage does not substitute.
  • Overlap-based and k-mer-based assembly are the same graph idea under different constraints, and the data chooses between them.
  • Contigs, scaffolds and chromosomes are different claims, and the Ns in a scaffold are assertions that can be wrong.
  • A diploid genome has two sequences; a consensus is a composite that may match neither.
  • Contiguity, correctness and completeness are separate axes and trade against each other, so N50 alone is not a quality claim.

Section 9.1 names what to run.