JBrowse 2 · Linear Genome View examples

Multi-sample variant display

One row per sample, colored by a samples TSV column.

rowColor is a config slot, read once when sources load, so it goes on the display config rather than a displaySnapshot. A track opens its first configured display, so LinearMultiSampleVariantDisplay has to come first in displays.

View source — 39 lines
import { LinearGenomeView } from '@jbrowse/react-linear-genome-view2'

export default function MultiSampleVariants() {
  return (
    <LinearGenomeView
      assembly={{
        name: 'volvox',
        uri: 'https://jbrowse.org/genomes/volvox/volvox.2bit',
      }}
      tracks={[
        {
          type: 'VariantTrack',
          trackId: 'volvox_multisample_sv',
          name: 'volvox multi-sample SV',
          assemblyNames: ['volvox'],
          adapter: {
            type: 'VcfTabixAdapter',
            uri: 'https://raw.githubusercontent.com/GMOD/jbrowse-components/main/test_data/volvox/volvox.sv.vcf.gz',
            samplesTsvLocation: {
              uri: 'https://raw.githubusercontent.com/GMOD/jbrowse-components/main/test_data/volvox/volvox.sv.samples.tsv',
            },
          },
          displays: [
            {
              type: 'LinearMultiSampleVariantDisplay',
              displayId:
                'volvox_multisample_sv-LinearMultiSampleVariantDisplay',
              rowColor: 'population',
            },
          ],
        },
      ]}
      view={{
        loc: 'ctgA:1..50,000',
        tracks: ['volvox_multisample_sv'],
      }}
    />
  )
}