Gene Model
A gene's transcripts as exons and introns: coding blocks and thinner UTRs joined like a connected button group, dotted introns with strand chevrons, exon numbers, compressed introns, isoform stacks, variant lollipops and keyboard focus on exons.
Install
npx shadcn@latest add @nelumbo/gene-modelA gene
HBB, β-globin: three exons on the minus strand. Coding sequence is the tall block, the UTRs the thinner tonal ends; chevrons point the way it is read.
Compressed introns
TP53 spans 19 kb but its exons only 2.5 kb. introns="compressed" shrinks every intron to a short stretch so the exons get the room. The ruler only shows at true scale.
Isoforms
Several transcripts share one scale. The canonical one takes the color, the others stay neutral, so the differences read at a glance: exon 9β in p53β, Δ133p53 starting in intron 4.
Orientation
Genome browsers draw minus-strand genes right to left. orientation="transcript" turns them so 5' is on the left and exon 1 comes first.
Variants
markers stand on a transcript as lollipops with pill labels, stacked when they would collide. Here, TP53 hotspots in the DNA-binding domain.
Protein domains
domains takes residue ranges, as UniProt gives them, and maps them through the coding sequence onto the exons that encode them. A domain split by an intron keeps tight corners at the cut and round ones at its true ends, with a dotted line across the gap. Here, p53's domains on TP53.
- Transactivation1–44
- DNA-binding102–292
- NLS305–321
- Oligomerization325–356
- Basic368–387
Selection
selectable makes the model one keyboard stop, like a chart: Left and Right move between exons, Up and Down between transcripts, Escape clears. The readout follows the pointer.
Colors and sizes
Any accent role colors the coding blocks; the small size suits lists and tables.
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
transcripts | GeneModelTranscript[] | id, name, description, strand, exons, cds, canonical. 1-based, inclusive. | |
introns | "scaled" | "compressed" | "scaled" | Compressed shrinks introns so exons get the room. |
orientation | "genome" | "transcript" | "genome" | Transcript turns minus-strand genes so 5' is on the left. |
exonNumbers | boolean | false | In transcription order: inside the coding block where it fits, under it otherwise. |
ruler | boolean | false | Genomic coordinates along the top. Scaled introns only. |
markers | GeneModelMarker[] | position, label, color, description: lollipops with pill labels. | |
markersOn | string | first transcript | The transcript id the markers stand on. |
color | accent role | "blue" | The coding blocks of the canonical (or only) transcript. |
size | "sm" | "default" | "default" | 14 or 20 px coding blocks. |
region | { start, end } | the transcripts' span | The stretch shown. |
selectable / onActiveChange | boolean, (focus | null) => void | Keyboard and pointer focus on exons; focus has transcript, exon and count. | |
domains | ProteinDomain[] | Residue ranges (start, end, name, color), mapped through the coding sequence. | |
domainsOn / domainLegend | string, boolean | canonical, true | The transcript whose protein the domains are on; the legend under the model. |
Helpers | numberExons, domainSegments, formatGenomic | Exons in transcription order; a domain's genomic stretches; coordinates as 7,675,088. |