Reading DNA and interpreting sequence models
2026-09-27
Primers on reading a DNA sequence, and on interpreting genomic sequence models with DeepLIFT and DeepExplainer.
These chapters started as learning notes and primers.
DNA is written in an alphabet of just four letters - A, T, G, and C - representing the nucleotides adenine, thymine, guanine, and cytosine. Everything from a protein’s shape to a crop’s nitrogen-use efficiency is ultimately encoded in long strings of these four characters.
Interactive widget on the live site: DnaHelix
(example sequence ATGGCATTACGTGACTTCGGC). See
https://www.musfirajamil.com/primers/reading-a-dna-sequence.
The two strands of DNA are complementary: A always pairs with T, and G always pairs with C. Given one strand, you can always reconstruct the other - try editing the sequence below and hover any base to see its partner.
Interactive widget on the live site: SequenceViewer
(example sequence ATGGCATTACGT). See
https://www.musfirajamil.com/primers/reading-a-dna-sequence.
Ribosomes read DNA (via messenger RNA) three letters at a time. Each
triplet - a codon - specifies an amino acid.
ATG is special: it’s the start codon that
signals where translation begins, and TAA,
TAG, TGA are stop codons.
Shift the reading frame below and watch how completely the encoded protein changes - a single-base shift rewrites everything downstream.
Interactive widget on the live site: CodonTranslator
(example sequence ATGGCATTACGTTAA). See
https://www.musfirajamil.com/primers/reading-a-dna-sequence.
Not all sequences are alike. The proportion of G and C bases - the GC content - influences DNA stability and is one of the first things a bioinformatician checks when characterising a genome.
Interactive widget on the live site: BaseComposition
(example sequence ATGGCATTACGTGACTTCGGCGCTA). See
https://www.musfirajamil.com/primers/reading-a-dna-sequence.
These widgets are plain React components embedded directly in this Markdown file - no change to the site’s architecture. The same approach scales up to richer tools: a 3D protein-structure viewer (NGL Viewer), a genome-track browser (igv.js), or interactive phylogenetic trees, all of which can drop straight into future tutorials.
A primer on DeepLIFT and DeepExplainer for genomic sequence models, why reference-based attributions matter, how simulated motifs teach you to trust (or distrust) highlight tracks, and what explanations can and cannot claim.
When a neural network scores a DNA or RNA sequence, the prediction alone rarely tells you why. Was the model attending to a known motif, a GC-rich stretch, or something spurious in the flanks? Attribution methods assign credit to individual bases so you can inspect that question. This primer introduces DeepLIFT and its SHAP-facing wrapper DeepExplainer at a conceptual level, enough to read genomic interpretability plots with confidence.
Convolutional and related models for genomics often take one-hot encoded sequences and output a binding, accessibility, or expression score. They can capture combinatorial patterns that simple motifs miss, but a high score does not reveal which nucleotides drove the decision. Spurious correlations can look like biology until you inspect attributions. Attribution is therefore a quality-control and hypothesis-generation tool: it does not replace wet-lab validation or prove causality, but it helps you ask better follow-up questions.
DeepLIFT explains a prediction by comparing the network’s activations on the real input to activations on a reference input. Rather than exhaustively flipping every base, it propagates difference-from-reference signals backward through the layers using rules designed for common nonlinearities.
That framing is the conceptual heart of the method. Pure gradient saliency can miss saturated units; DeepLIFT was designed to stay informative when activations sit in flat regions of a nonlinearity.
DeepExplainer in the SHAP library approximates
Shapley-style attributions for deep models using DeepLIFT-style rules
and a background set. For one-hot DNA you typically get signed per-base
scores: positive where bases raised the prediction relative to
background, negative where they lowered it.
Simulated genomic data is the cleanest teacher because you know the planted signal. Embed a motif in background sequence, train a small CNN on the label, then ask whether attributions light up the planted positions on held-out sequences. Recovery supports that model and explainer are aligned; failure is equally informative, the model may have learned GC composition, the reference may be poorly chosen, or the network may be underpowered.
DeepLIFT attributes deep sequence predictions by propagating differences from a reference; DeepExplainer exposes that idea in a SHAP-friendly API. Use simulated motifs to learn what trustworthy attributions look like, then treat real-data peaks as clues to interrogate, not as finished biology.