JBrowse 2 · Linear Genome View examples

Text search

Search by feature name, across every track or per track.

Aggregate text searching

jbrowse text-index --file genes.gff3.gz --fileId volvox_genes \
                   --file vars.vcf.gz   --fileId volvox_vars

--fileId must match the runtime trackId, and each one pairs with the --file in the same position.

View source — 34 lines
import {
  JBrowseLinearGenomeView,
  useCreateViewState,
} from '@jbrowse/react-linear-genome-view2'

export default function WithAggregateTextSearching() {
  const state = useCreateViewState({
    assembly: {
      name: 'volvox',
      uri: 'https://jbrowse.org/genomes/volvox/volvox.2bit',
    },
    aggregateTextSearchAdapters: [
      {
        type: 'TrixTextSearchAdapter',
        uri: 'https://jbrowse.org/code/jb2/main/test_data/volvox/storybook_data/volvox.ix',
        assemblyNames: ['volvox'],
      },
    ],
    tracks: [
      {
        type: 'FeatureTrack',
        trackId: 'gff3tabix_genes',
        name: 'Volvox genes',
        assemblyNames: ['volvox'],
        adapter: {
          type: 'Gff3TabixAdapter',
          uri: 'https://jbrowse.org/code/jb2/main/test_data/volvox/volvox.sort.gff3.gz',
        },
      },
    ],
    location: 'ctgA:1..800',
  })
  return state ? <JBrowseLinearGenomeView viewState={state} /> : null
}

Per-track text searching

jbrowse text-index --file myfile.gff3.gz --fileId my_track

--fileId must match the runtime trackId.

View source — 27 lines
import {
  JBrowseLinearGenomeView,
  useCreateViewState,
} from '@jbrowse/react-linear-genome-view2'

export default function WithPerTrackTextSearching() {
  const state = useCreateViewState({
    assembly: {
      name: 'volvox',
      uri: 'https://jbrowse.org/genomes/volvox/volvox.2bit',
    },
    tracks: [
      {
        trackId: 'gff3tabix_genes',
        name: 'GFF3Tabix genes',
        uri: 'https://jbrowse.org/code/jb2/main/test_data/volvox/volvox.sort.gff3.gz',
        textSearching: {
          textSearchAdapter: {
            uri: 'https://jbrowse.org/code/jb2/main/test_data/volvox/storybook_data/gff3tabix_genes.ix',
          },
        },
      },
    ],
    location: 'ctgA:1..800',
  })
  return state ? <JBrowseLinearGenomeView viewState={state} /> : null
}