JBrowse 2 · Linear Genome View examples

A fixed height, with a side drawer

The height prop bounds the view and the drawer beside it.

height keeps the header pinned and scrolls only the tracks, and sizes the drawer beside the view; without it, an open drawer is the window’s height. Open the track selector with view.tracklist, not activateTrackSelector: the launch waits for the view to resize around the drawer before navigating.

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

export default function FixedHeight() {
  return (
    <LinearGenomeView
      height="400px"
      assembly={{
        name: 'volvox',
        uri: 'https://jbrowse.org/genomes/volvox/volvox.2bit',
      }}
      tracks={[
        {
          trackId: 'volvox_gff3',
          name: 'Volvox genes',
          uri: 'https://jbrowse.org/code/jb2/main/test_data/volvox/volvox.sort.gff3.gz',
        },
        {
          trackId: 'volvox_microarray',
          name: 'Microarray (BigWig)',
          uri: 'https://jbrowse.org/code/jb2/main/test_data/volvox/volvox_microarray.bw',
          displayDefaults: { height: 150 },
        },
        {
          trackId: 'volvox-long-reads-sv-bam',
          name: 'volvox-long reads with SV',
          uri: 'https://jbrowse.org/code/jb2/main/test_data/volvox/volvox-long-reads-sv.bam',
          displayDefaults: { height: 200 },
        },
      ]}
      view={{
        loc: 'ctgA:1..50,000',
        tracks: [
          'volvox_gff3',
          'volvox_microarray',
          'volvox-long-reads-sv-bam',
        ],
        tracklist: true,
      }}
    />
  )
}