Hi-C: from reads to contact matrices

Proximity ligation, chimeric reads, pairs, binning, balancing and distance decay

Epigenetics

About this lecture

3D genome organisation showed what a Hi-C map contains. This lecture shows how a map is made from sequencing reads, and what can go wrong on the way.

  • The chemistry: in situ Hi-C, restriction enzymes and the ligation junction that every valid read pair carries.
  • Reads to pairs: mapping the two ends separately, chimeric reads, pair types, artefacts (dangling ends, self-circles) and duplicates.
  • Pairs to a matrix: binning, resolution versus depth, the .pairs, .cool, .mcool and .hic formats.
  • Normalisation: why maps are balanced (ICE), the distance decay P(s) and observed/expected.

The pipeline

  • The wet-lab steps decide which artefacts appear; each computational step removes or corrects one of them.
  • Output: a contact matrix with balancing weights, and its expected contact frequency at each distance.

In situ Hi-C

  • Crosslink with formaldehyde, cut with a restriction enzyme, fill in the overhangs with a biotinylated nucleotide, ligate the blunt ends, shear, pull down biotin, sequence paired-end.
  • Ligation happens inside intact nuclei (in situ), which reduces random ligations between molecules from different complexes or nuclei.

The ligation junction

  • MboI (and DpnII) cut ^GATC; fill-in and blunt ligation duplicate the overhang: the junction reads GATCGATC.
  • 15% of our 101-bp reads contain GATCGATC: they read through a junction and are chimeric.
  • The enzyme sets the finest possible resolution: one site every ~256 bp (4-cutter) or ~4 kb (6-cutter).

Restriction fragments on chr21

  • chr21 has 91 397 GATC sites (157 000 expected at random) and 11 263 HindIII sites: median fragments 282 bp and 2 284 bp.
  • Hi-C cannot resolve contacts within one fragment, so a 4-cutter allows kilobase maps; a 6-cutter limits them to ~5–10 kb.

Read pairs, chimeras and walks

  • Each side of a pair is represented by the 5′ end of its read’s first (5′-most) alignment: that is the position closest to the junction’s partner fragment.
  • A read that crosses the junction gives two alignments; if both sides agree, the pair is rescued. Several junctions in one molecule make a walk.

Mapping: each end on its own

bwa mem -SP5M -t 8 chr21.fa R1.fastq.gz R2.fastq.gz \
  | pairtools parse --min-mapq 30 --walks-policy 5unique --max-inter-align-gap 30 \
      --drop-sam --drop-seq -c chr21.sizes -o chr21.pairs.gz
  • -SP: do not pair the mates: no mate rescue (-S), no pairing (-P). The two ends are expected to come from anywhere in the genome.
  • -5: for a split read, the 5′-most alignment is the primary one. -M: mark the other parts as secondary.
  • No trimming at the junction is needed: bwa mem’s local alignment splits chimeric reads itself.

Pair types

letter U R M N W
side is unique (MAPQ ≥ 30) rescued chimera multi-mapped unmapped walk
  • UU 70%, rescued UR + RU 9%; pairs with an unmapped or multi-mapped side (NU, MU, MM, …) are dropped.

Ligation artefacts

  • Dangling ends (unligated fragments) and re-ligations of neighbours: reads point inward (+ −), less than ~1 kb apart.
  • Self-circles (a fragment ligated to itself): reads point outward (− +), within one fragment.
  • At large distances all four orientations are equally likely, so an excess of one orientation at short range marks artefacts.

Real data: orientation versus distance

  • Between ~200 and 600 bp, 96% of pairs point inward (+ −): dangling ends and re-ligated neighbours. Outward self-circles are rare in this in situ library.
  • Above ~1 kb, all four orientations are within a few percent of 25%: the pairs are genuine ligation products.

Duplicates

  • PCR and optical duplicates: two read pairs with the same two 5′ positions and strands. Two independent ligations producing exactly the same pair of ends are very unlikely.
  • pairtools dedup removes pairs whose both sides match within 3 bp (--max-mismatch 3).
  • Our 30 M pairs: 1.9% duplicates among mapped pairs; in the deep libraries of the full experiment the rate rises with depth (library complexity).
pairtools sort --nproc 4 -o chr21.sorted.pairs.gz chr21.pairs.gz
pairtools dedup --max-mismatch 3 --output-stats dedup.stats -o chr21.nodups.pairs.gz chr21.sorted.pairs.gz

Real data: where the read pairs go

  • Of 30 M read pairs, 23.8 M (79%) have both sides uniquely mapped; 16.9 M are contacts on the same chromosome more than 1 kb apart.
  • 84% of unique pairs are cis and 16% trans; 56% are cis and more than 20 kb apart.

Quality metrics

metric what it shows good in situ Hi-C
uniquely mapped pairs (UU + UR + RU) mappability, read quality > 70%
duplicates library complexity vs depth low at the depth used
cis / (cis + trans) random ligation is low > 60–80%
cis > 20 kb / all long-range information content > 40%
orientation plot converges artefacts confined to short range by ~1–2 kb
fraction of reads with the junction ligation happened tens of % for 100-bp reads

From pairs to a matrix

  • Cut the genome into bins of fixed size; each valid pair adds 1 to pixel (bin of side 1, bin of side 2).
  • The matrix is symmetric and sparse: store only the upper triangle and only non-zero pixels.
cooler cload pairs -c1 2 -p1 3 -c2 4 -p2 5 chr21.sizes:10000 chr21.valid.pairs.gz chr21_10kb.cool

File formats

  • .pairs: the 4DN text standard, one line per contact; keep it, you can re-bin it at any resolution.
  • .cool / .mcool (HDF5, cooler): one or many resolutions; .hic (Juicer): all resolutions plus normalisation vectors.
  • Convert with hictk or hic2cool; both are read by HiGlass, Juicebox (.hic) and the Python and R ecosystems.

Resolution and depth

  • Our 217 499 chr21 contacts against ENCODE’s 35.2 million (162×): at 250 kb the maps look alike; at 10 kb ours is mostly empty.
  • Rule of thumb (Rao et al. 2014): resolution = the smallest bin size at which 80% of bins have ≥ 1 000 contacts. Ours: 250 kb (82% of bins; 43% at 100 kb); ENCODE: 10 kb or finer (93% at 10 kb).

Why balance?

  • Bins differ in how visible they are: restriction-site density, GC content, mappability, copy number.
  • Model: observed O_{ij} = b_i\, b_j\, T_{ij}, with a bias b per bin and true contacts T.
  • Assumption: every bin is equally visible in truth (equal row sums of T). Bins with too few contacts are masked, not corrected.

Iterative correction (ICE)

  • Divide each row and column by its relative sum; repeat until all sums are equal. The product of the factors is the bias of each bin; cooler balance stores 1/bias as the weight column.
  • Balanced value = count × weight_i × weight_j. KR, VC and SCALE (Juicer) are variants of the same idea.

Real data: raw versus balanced

  • Raw: stripes where bins are seen too often or too rarely; row sums vary from 399 to 3 587 contacts per 250-kb bin.
  • Balanced: equal row sums (bottom), the stripes are gone, and 50 of 187 bins (the short arm and centromere, a few repeat bins) are masked.

The distance decay P(s)

  • Average the balanced matrix along each diagonal: P(s), the expected contact frequency at distance s.
  • Our chr21 map (217 499 contacts) and ENCODE’s give the same curve: slopes −1.02 and −0.97 between 100 kb and 1 Mb.

Observed / expected

  • Divide each pixel by P(s) at its distance: O/E removes the distance decay and shows what is special about a pair of loci.
  • On chr19 the balanced map (left) is dominated by the diagonal; O/E (right) shows the compartment checkerboard over the whole arm.

Pipelines and the shortcut used here

  • Production pipelines: distiller (open2c, Nextflow: bwa + pairtools + cooler), nf-core/hic (HiC-Pro logic), Juicer (Aiden lab, .hic), the 4DN and ENCODE Hi-C pipelines. Same steps, different defaults.
  • Our shortcut: 30 M read pairs of one run were aligned to the whole genome; the pairs with a side on chr21 (and the other on chr21 or unplaced) were kept as FASTQ, so the exercise aligns to chr21 only. Contacts to other chromosomes and true multi-mappers elsewhere are therefore missing.
  • Our map: 217 499 contacts on chr21; ENCODE’s map of the full experiment: 4.6 billion genome-wide. The features unit uses ENCODE’s.

Summary

step key idea
chemistry crosslink, digest (^GATC), biotin fill-in, ligate in situ; junction GATCGATC
mapping each end alone (bwa mem -SP5M); split reads; 5′-most alignment represents a side
pairs types UU/UR/RU kept; NU/MU/MM dropped; walks masked or reduced
artefacts dangling ends (+ −) and self-circles (− +) below ~1–2 kb; PCR duplicates by both ends
QC cis fraction, cis > 20 kb, duplicates, orientation convergence
matrix fixed bins; symmetric, sparse; resolution limited by depth and enzyme
balancing ICE: equal visibility; weight per bin; mask poor bins
expected P(s) per diagonal; O/E removes distance decay

Key papers (optional further reading)

Not required reading and not examined. For those who want the primary literature.