Renders an interactive, GPU-accelerated JBrowse 2 linear genome view as an htmlwidget for use in R Markdown documents, Shiny apps, or the interactive R console.

JBrowseR(
  assembly = NULL,
  tracks = NULL,
  location = NULL,
  default_session = NULL,
  text_search = NULL,
  theme = NULL,
  plugins = NULL,
  config = NULL,
  width = NULL,
  height = NULL,
  elementId = NULL
)

Arguments

assembly

A hub name understood by jbrowse.org (e.g. "hg38", "hg19", or a GenArk accession like "GCF_000001405.40"), a sequence-file URL the view builds an assembly from (".../hg38.fa.gz", .2bit), or an assembly config list — list(name = , uri = ), plus aliases or refNameAliases when needed.

tracks

A list of track entries: a bare data-file URL, a list(uri = ) spec the view expands, a config from track_data_frame(), or a full track config. Entries missing assemblyNames are backfilled with the assembly's name by the view.

location

A region string ("chr1:1-1000") or, when the assembly hub provides a gene-name search index, a gene name ("BRCA1").

default_session

An optional serialized session (advanced); when given it owns the initial track layout instead of tracks.

One or more aggregate text-search adapter configs (e.g. a TrixTextSearchAdapter), enabling gene-name search.

theme

A theme config, the MUI palette JBrowse takes: list(palette = list(primary = list(main = ))).

plugins

A list of JBrowse plugin specs (name + url) to load at runtime.

config

Escape hatch: a whole JBrowse config forming the payload base that explicit arguments override — a list, or the path, URL, or JSON text of a config.json.

width, height, elementId

Standard htmlwidget sizing arguments.

Value

an htmlwidget of the JBrowse 2 linear genome view

Details

The API is declarative, and the thing 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 deliberately no constructors for them — what you write here is what the config file holds, and nothing in this package has to grow when JBrowse gains a track type, an adapter or a display. The one exception is track_data_frame(), for the one thing config JSON cannot express: an R data frame.

One R-specific trap: a length-1 vector serializes to a JSON scalar, so fields JBrowse reads as arrays (assemblyNames, aliases) are written with list()assemblyNames = list("hg38"), not "hg38".

Examples

# a whole human genome browser in one line (gene search included)
JBrowseR("hg38", location = "BRCA1")