Every browser on this page is a live, interactive JBrowse 2 — pan, zoom, and click features directly in the page. This article is part of the website only (it is not a package vignette), so it can embed the full widget; the Introduction uses screenshots to stay within CRAN’s size limits.

A hosted genome

Name a genome hub and you get the assembly, reference-name aliases, cytobands, and gene-name search for free. Here location = "BRCA1" resolves through the hub’s search index.

JBrowseR(
  "hg38",
  tracks = tracks(track(
    paste0(
      "https://jbrowse.org/genomes/GRCh38/ncbi_refseq/",
      "GCA_000001405.15_GRCh38_full_analysis_set.refseq_annotation.sorted.gff.gz"
    ),
    name = "NCBI RefSeq Genes"
  )),
  location = "BRCA1"
)

A custom genome from a FASTA URL

No hub needed for your own genome: pass a sequence-file URL straight to assembly. The view builds the assembly from it (naming it after the file), and a bare data-file URL in tracks is inferred into a track — here an alignments track from a BAM.

JBrowseR(
  "https://jbrowse.org/genomes/volvox/volvox.fa",
  tracks = list("https://jbrowse.org/genomes/volvox/volvox.bam"),
  location = "ctgA:1..5,000"
)

An R result as a track

Turn a data frame of features into a track with track_data_frame() — no files, no web server. A score column makes it quantitative.

peaks <- data.frame(
  chrom = "17",
  start = seq(43000000, 43120000, by = 12000),
  end = seq(43000000, 43120000, by = 12000) + 4000,
  name = paste0("peak", seq_len(11)),
  score = round(runif(11, 5, 100))
)

JBrowseR(
  "hg38",
  tracks = list(track_data_frame(peaks, "R_peaks")),
  location = "17:43,000,000..43,125,000"
)

A statistical plot (GWAS Manhattan)

A track isn’t only features and coverage — a display can plot data. Point a GWASTrack at genome-wide summary statistics and give it a LinearManhattanDisplay, and the same linear view becomes a Manhattan plot: the displays block picks the plot; no special widget needed. The adapter’s uri shorthand finds the .tbi index next to the data, and JBrowse fills in displayId, so the config stays short.

JBrowseR(
  "hg19",
  tracks = list(list(
    type = "GWASTrack",
    trackId = "gwas_track",
    name = "GWAS",
    adapter = list(
      type = "GWASAdapter",
      scoreColumn = "neg_log_pvalue",
      uri = "https://jbrowse.org/genomes/hg19/gwas/summary_stats.txt.gz"
    ),
    displays = list(list(type = "LinearManhattanDisplay", height = 250))
  )),
  location = "2"
)

For comparative genomics — synteny and dotplots across two assemblies — see the comparing genomes article, which uses JBrowseRApp().