JBrowse 2 · Linear Genome View examples

The simplest example

One component, three props: assembly, tracks, view.

npm install @jbrowse/react-linear-genome-view2

The view renders on the client only: in Next.js, load it through next/dynamic with { ssr: false }. Add @fontsource/roboto, or the chrome falls back to the theme’s next font, Helvetica or Arial.

view is read once, at creation: a new loc on re-render does not move it. To drive the view, take a ref and call its navigation actions.

Show source · 30 linesHide source · 30 lines
import { LinearGenomeView } from '@jbrowse/react-linear-genome-view2'

export default function OneLinearGenomeView() {
  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={[
        {
          trackId: 'hg38-ncbi-refseq-curated',
          name: 'NCBI RefSeq Curated',
          uri: 'https://jbrowse.org/ucsc/hg38/ncbiRefSeqCurated.gff.gz',
          csi: true,
        },
      ]}
      view={{
        loc: 'chr7:155,799,529..155,812,871',
        tracks: ['hg38-ncbi-refseq-curated'],
      }}
    />
  )
}