JBrowse Linear Genome View
@jbrowse/react-linear-genome-view2 is a React component that embeds a full linear genome browser (tracks, search, zoom/pan, and track selection) in your app. For the parts rather than the finished component, the Build your own examples start from this same engine and add the chrome back one piece at a time.
Live demo
Human genes on hg38, opened at the SHH locus. Everything below is the source that produced it.
View source — 35 lines
import { LinearGenomeView } from '@jbrowse/react-linear-genome-view2'
export default function WithInit() {
return (
<LinearGenomeView
assembly={{
name: 'hg38',
uri: 'https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz',
refNameAliases: {
uri: 'https://jbrowse.org/genomes/GRCh38/hg38_aliases.txt',
},
cytobands: {
uri: 'https://jbrowse.org/genomes/GRCh38/cytoBand.txt',
},
}}
tracks={[
{
type: 'FeatureTrack',
trackId: 'hg38-ncbi-refseq-curated',
name: 'NCBI RefSeq Curated',
assemblyNames: ['hg38'],
adapter: {
type: 'Gff3TabixAdapter',
uri: 'https://jbrowse.org/ucsc/hg38/ncbiRefSeqCurated.gff.gz',
csi: true,
},
},
]}
init={{
loc: 'chr7:155,799,529..155,812,871',
tracks: ['hg38-ncbi-refseq-curated'],
}}
/>
)
}Install
yarn add @jbrowse/react-linear-genome-view2npm install @jbrowse/react-linear-genome-view2 --legacy-peer-depspnpm add @jbrowse/react-linear-genome-view2--legacy-peer-deps silences npm's peer-dep warnings. yarn and pnpm don't need it.
Two things that cost people an hour
It renders on the client only. The view needs a real DOM; server-rendering and hydrating it are not supported. Vite, rsbuild and plain script tags just work. In an SSR framework, mount it client-side — our Next.js demo wraps it in a 'use client' component loaded through next/dynamic with { ssr: false }.
It wants Roboto. Add @fontsource/roboto or the chrome falls back to the host page's font.
A step-by-step build is the embedding tutorial; the embedded components page compares the packages and lists a deployed starter repo per bundler (Vite, rsbuild, Next.js, vanilla JS). The full assembly and track config shape is the config guide.
Browse the examples
Each example renders live and shows its full source.
Getting started
Navigation & search
Tracks & styling
- Colors, labels & sizingHow a feature track looks: color and label per feature with jexl, what it does when rows overflow, and marking one feature.
- AlignmentsOpen a BAM/CRAM track with a chosen display, group reads by SAM tag, and set the display options up front.
- Signal, gene, variantQuantitative signal from a BigWig, gene models from a GTF, and a multi-sample VCF as a matrix.
- Theming & stylingA custom or dark Material UI theme, styling from the host page, or Shadow DOM isolation.
Sessions & integration
- Init & persistenceA richer initial view with advanced init and highlights, then persisting or sharing the live session.
- Multiple viewsReact to the view from your own companion panels, and render several independent views on one page.
- Export & errorsRender the whole view to a vector SVG (or rasterized PNG), and catch and render view errors with your own UI.
- Plugins & accountsPlugins loaded at runtime or defined inline, authenticated data via internet accounts, and the web worker RPC.
- Files from your host processOpen a track on bytes your host already holds — a notebook kernel, an R session — with no web server and no CORS.
Real-world demos
- Human exomeA human exome sequencing dataset on hg38.
- Nextstrain pathogensGenes, diversity, and a per-sample genotype matrix for SARS-CoV-2, Zika, Ebola, measles, and RSV-A.
- LocusZoom-style LDGWAS summary stats colored by LD r² to the lead SNP, LocusZoom-style.
- Single-cell UMAPA UMAP of 5k PBMCs beside per-cell-type coverage: select clusters to filter rows, click a gene to color cells.
- Pan-UKB GWASBrowse Pan-UK Biobank GWAS summary statistics across phenotypes.