JBrowseR provides an R interface to the JBrowse 2 genome browser. It renders the interactive, GPU-accelerated JBrowse 2 linear genome view as an htmlwidget, so you can embed a full genome browser in an R Markdown document, a Shiny app, or straight from the R console.
The API is declarative, and what you describe it with is JBrowse’s own config: assemblies, tracks and sessions are the same JSON objects a config.json holds, written as R lists. There are no constructors to learn and nothing imperative to wire up — so what you write here is what the config file holds, and a track type or view type JBrowse gains needs nothing added to the package.
library(JBrowseR)
# an entire human genome browser in one line — assembly, reference name
# aliases, cytobands, and gene-name search all included
JBrowseR("hg38", location = "BRCA1")Released version from CRAN:
install.packages("JBrowseR")Development version from GitHub:
# install.packages("remotes")
remotes::install_github("GMOD/JBrowseR")Point at a hub genome by name and add tracks by URL — the track type and its index files are inferred automatically.
JBrowseR(
"hg38",
tracks = list(
list(
uri =
"https://jbrowse.org/genomes/GRCh38/alignments/NA12878/NA12878.alt_bwamem_GRCh38DH.20150826.CEU.exome.cram",
name = "NA12878 Exome"
)
),
location = "17:43,044,295..43,048,000"
)
View results you computed in R directly on the genome — no files, no web server:
peaks <- data.frame(
chrom = "17",
start = seq(43000000, 43120000, by = 12000),
end = seq(43000000, 43120000, by = 12000) + 4000,
name = paste0("peak", 1: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 track’s display can plot its data — a GWASTrack with a LinearManhattanDisplay draws genome-wide summary statistics as a Manhattan plot in the linear view, no separate plotting widget needed:

Compare whole genomes with JBrowseRApp() — several assemblies stacked, the blocks each pair shares drawn between the rows (here four E. coli strains tied by one all-vs-all alignment), or the same alignment as a whole-genome dotplot. See the comparative synteny vignette, or run it on Colab:


The figures above are screenshots so the package stays inside CRAN’s size budget, but the website hosts the same browsers as real, interactive widgets — pan, zoom, and click features in the page:
For the Shiny side, JBrowseR demos is every example app in one place — gene search, a data frame as a track, a slider that re-runs the analysis, SKBR3 structural variants, a whole config.json, and a plugin.
See the vignettes:
If you use JBrowseR in your research, please cite:
Hershberg et al., 2021. JBrowseR: An R Interface to the JBrowse 2 Genome Browser
@article{hershberg2021jbrowser,
title={JBrowseR: An R Interface to the JBrowse 2 Genome Browser},
author={Hershberg, Elliot A and Stevens, Garrett and Diesh, Colin and Xie, Peter and De Jesus Martinez, Teresa and Buels, Robert and Stein, Lincoln and Holmes, Ian},
journal={Bioinformatics}
}
The R package ships a prebuilt JavaScript bundle in inst/htmlwidgets/. To rebuild it against a local checkout of jbrowse-components (expected as a sibling directory), install pnpm and run:
git clone https://github.com/GMOD/JBrowseR
cd JBrowseR
pnpm install
pnpm build # writes inst/htmlwidgets/JBrowseR.js and .css
R -e 'devtools::install()'