JBrowse 2 · Linear Genome View examples

Highlight regions

view.highlight shades regions, with a color and label each.

A highlight is a locstring, or an object with its own color and label.

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

export default function HighlightRegions() {
  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',
        },
      }}
      tracks={[
        {
          trackId: 'ncbi-refseq-genes',
          name: 'NCBI RefSeq Genes',
          uri: 'https://jbrowse.org/genomes/GRCh38/ncbi_refseq/GCA_000001405.15_GRCh38_full_analysis_set.refseq_annotation.sorted.gff.gz',
        },
      ]}
      view={{
        loc: 'chr1:11,106,077-11,261,675',
        tracks: ['ncbi-refseq-genes'],
        highlight: [
          'chr1:11,130,000-11,145,000',
          {
            refName: 'chr1',
            start: 11_200_000,
            end: 11_220_000,
            color: 'rgba(0, 128, 255, 0.25)',
            label: 'Region of interest',
          },
        ],
      }}
    />
  )
}