What did the model learn? Variant effects

Attribution, in-silico mutagenesis, and predicting the effect of non-coding variants

Epigenetics

About this lecture

How a CNN reads DNA trained a small network that tells GM12878 CTCF peaks from GC-matched background (test AUC 0.97). Two questions follow:

  • What did it learn? Which bases of a sequence drive its prediction: in-silico mutagenesis (ISM), gradients, DeepLIFT/SHAP; from many sequences to motifs (TF-MoDISco).
  • What does a variant do? Predicted effect = prediction(alt) − prediction(ref), checked against real SNPs with allele-specific CTCF binding.
  • The big models (Enformer, Borzoi, AlphaGenome, chromBPNet): what they add, and what they still get wrong.

Two questions about a trained model

  • Local: for this sequence, which bases matter for this prediction? (an attribution per base)
  • Global: across all sequences, which patterns does the model rely on? (motifs and their arrangement)
  • The first-layer filters of How a CNN reads DNA answered the global question for a one-layer model. Attribution works for any model, however deep.

In-silico mutagenesis

  • Change every base to each of the 3 others, run the model again, record Δ = z(mutant) − z(reference) on the logit scale.
  • The result is a mutation map (4 × L). The importance of a position is −mean Δ of its three mutants.
  • An experiment in silico: exactly what a saturation mutagenesis assay does in the lab, at the cost of 3L + 1 predictions.

ISM by hand

  • One filter (best 4-mer CCAG), bias −4, max pooling, z = -2 + \max. For ACCAGT: z = 2.0.
  • Mutating a base outside the best window changes nothing; inside, the cost follows the filter weights.
  • This is the kind of calculation asked in the exam: given a model and a sequence, compute Δ for a mutation.

Real data: a mutation map of a CTCF peak

  • A typical test peak on chr8 (z = 4.3, the median of the test peaks). 48 of 600 mutations change z by more than 1; the strongest (C→T at position 105) by −5.8.
  • The important bases form the CTCF motif a few bases from the summit; the rest of the window hardly matters.
  • Some reference bases have negative importance: there, a mutation would strengthen the predicted binding.

Real data: attribution logos of three more peaks

  • Three random test peaks with a good PWM match: in each, the model’s attribution is the CTCF motif, in either orientation.
  • Outside the motif the letters are tiny: the model barely uses the flanks (quantified two slides on).

When ISM fails: redundancy

  • With two copies of the motif and max pooling, no single mutation changes the output: ISM says nothing matters.
  • Biology has the same problem: redundant (shadow) enhancers and backup sites hide each other in single knock-outs.
  • Remedies: mutate pairs or whole motifs, or measure contributions against a reference in which all motifs are removed.

Gradients: attribution in one pass

  • The gradient ∂z/∂x says how fast the output changes with each input: one backward pass gives it for all 4 × 200 inputs.
  • Gradient × input keeps the value at the reference base: one number per position, a linear approximation of ISM.
  • Cheap, but local: where the model saturates, the slope is flat although the effect of a mutation is large.

Real data: gradient × input agrees with ISM

  • For the peak of the mutation map: correlation 0.95 between gradient × input and ISM importance.
  • Over 200 test peaks: median correlation 0.93; the lowest 10% still above 0.89.
  • For our shallow model they agree; for deep models and saturated outputs they can differ, and ISM is the reference.

DeepLIFT and SHAP: compare with a reference

  • Explain the difference between the prediction for the sequence and for a neutral reference (often shuffled versions of the same sequence).
  • Contributions of all bases add up to that difference, so redundant motifs share the credit instead of both getting zero.
  • DeepSHAP (DeepLIFT averaged over many references) is the standard for BPNet and chromBPNet.

From attributions to motifs: TF-MoDISco

  • Collect contribution scores over thousands of sequences, cut out the high-scoring stretches (seqlets), cluster them, and average each cluster into a motif.
  • The motifs are what the model uses, and their positions give spacing and orientation rules (motif syntax).
  • Match them to JASPAR; patterns that match nothing are candidates for new motifs, or for artefacts of the data.

Real data: what the model uses around the motif

  • ISM importance in 200 test peaks, aligned on the best CTCF match (minus-strand sites flipped), averaged.
  • The model’s importance profile has the shape of the JASPAR logo: peaks at motif positions 3, 8 and 11.
  • Outside the 15-bp motif importance drops to almost zero within a few bases.

Real data: core versus flanks

  • Per motif position, the model’s importance follows the information content of the JASPAR column (r = 0.94).
  • Mutating a high-information core base costs on average 3.2 logit units, a low-information motif position 1.3, the flanks 0.07 (1–10 bp) and 0.01 (11–20 bp).

Variant effect = prediction(alt) − prediction(ref)

  • Put the reference and the alternative allele in the same sequence context, predict both, subtract: Δ = z(alt) − z(ref), a log odds ratio.
  • One ISM entry is a variant effect: the mutation map predicts every possible SNP in the window.
  • To check predictions, compare with measured allelic effects: allele-specific binding, QTLs, reporter assays (Epigenomics and genetic variation).

Allele-specific binding: a natural experiment

  • In a heterozygous person, both alleles share the same trans environment. After controlling technical biases and allelic dosage, ChIP imbalance supports a cis effect: a sequence difference on the haplotype or an allele-specific epigenetic state.
  • ADASTRA collects such allele-specific binding (ASB) events from thousands of public ChIP-seq experiments: 29 519 CTCF ASB SNPs at FDR < 0.05.

Real data: does the model predict the preferred allele?

  • Over all 2609 SNPs the CNN gets the direction right 58% of the time: no better than always guessing “reference binds better” (58.5%).
  • Where it predicts a large effect it is mostly right: 82% for |Δ| > 1 (280 SNPs), 95% for |Δ| > 2 (115 SNPs).
  • The PWM only scores the 385 SNPs that change the best motif match: 74–83% correct.

Real data: one SNP up close

  • rs12237222 (chr9), G>T: the reference G is preferred in ChIP-seq in many cell types. The model predicts z = 6.4 → 0.1 (Δ = −6.2); the PWM agrees (−8.1).
  • The G is motif position 8, one of the three most informative (1.9 bits); with T, the core loses its importance around the SNP (red line).

Why most allele-specific SNPs are not explained

  • The SNP is not causal: allelic imbalance is per haplotype; the causal variant may be a neighbour in linkage disequilibrium.
  • Outside the model’s view: effects on nearby sites, cofactors or DNA methylation (a SNP that creates or destroys a CpG can change methylation, and CTCF is methylation-sensitive).
  • Small effects: modest imbalances need modest predicted Δ, where model noise dominates.
  • The model’s limits: 200 bp, one cell line, one experiment, and a training set with no variants at all: it learned from reference sequences only.
  • Measurement: mapping bias, copy number and cell-type differences in the ASB calls.

Bigger models read more DNA

  • From hundreds of bp (motifs) to 196 kb (Enformer), 524 kb (Borzoi) and 1 Mb (AlphaGenome): long enough to include distal enhancers.
  • Outputs grow too: thousands of tracks (expression, accessibility, histone marks, TF binding, contacts) predicted at once.

Enformer: convolutions + attention

  • Convolutions find motifs and compress 196 kb into 1 536 positions of 128 bp; transformer layers let each position use information up to ~100 kb away.
  • Trained on thousands of human and mouse tracks; variant effects = predicted tracks for alt minus ref, for example CAGE at a gene’s TSS.

chromBPNet: accessibility at base resolution

  • A small model learns the enzyme bias (Tn5 or DNase); a BPNet-like model learns the rest: TF motifs, footprints, syntax.
  • Variant effects on accessibility are scored per allele and benchmarked on caQTLs, reporter assays and pioneer-factor binding.

What they still get wrong: differences between people

  • Across genes, models predict expression well (Enformer ρ ≈ 0.57 in LCLs). Across people, for the same gene, correlations are centred near zero.
  • The predicted direction of a person’s regulatory variants is often wrong (Huang et al. 2023; Sasse et al. 2023).

Using predicted variant effects responsibly

  • A predicted effect is a hypothesis about one molecular readout (binding, accessibility, expression) in the cell types the model was trained on.
  • Check it against the evidence: is the variant in a motif (does a PWM agree)? Is there allele-specific signal or a QTL? Is the effect large compared with the model’s typical noise?
  • Ask how the model was evaluated: held-out chromosomes, variant benchmarks (caQTLs, ASB, MPRA), across individuals, not just across genes.
  • Never read Δ as the probability that the variant causes a disease: that needs genetics (fine-mapping) and experiments (editing, reporter assays).

Summary

idea key fact
attribution importance of each input base for one prediction
in-silico mutagenesis Δ = z(mutant) − z(ref) for all 3L substitutions; importance = −mean Δ
saturation redundant motifs (or a saturated output) hide each other from single mutations
gradient × input one backward pass, linear approximation of ISM (r ≈ 0.93 for our model)
DeepLIFT / SHAP contributions relative to a reference; they sum to f(x) − f(ref)
TF-MoDISco cluster high-attribution seqlets into motifs and syntax
our CTCF CNN importance follows JASPAR information content (r = 0.94); flanks ≈ 0
variant effect Δ = z(alt) − z(ref), a log odds ratio
ASB SNPs (ADASTRA) 58% right overall (= baseline); 82% for |Δ| > 1, 95% for |Δ| > 2
big models Enformer 196 kb, Borzoi 524 kb, AlphaGenome 1 Mb; still poor across individuals

Key papers (optional further reading)

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