JBrowseR() takes JBrowse’s
createLinearGenomeView options as named arguments, and
JBrowseRApp() takes createApp’s, both under
the camelCase names JBrowse gives them. A browser can therefore live in
a JSON file that R, Python and JavaScript all read.
JBrowseR()’s options are assembly,
tracks, location, session,
aggregateTextSearchAdapters, internetAccounts,
plugins and configuration. The package passes
them through unread, so an option JBrowse adds works here without a
package update.
A JBrowse Web config.json is not that shape: it lists
assemblies in the plural and opens a
defaultSession. Its assemblies,
tracks and plugins are
JBrowseRApp() options, though, and its
defaultSession.views is JBrowseRApp()’s
views. To open a genome JBrowse hosts, name its hub instead
— JBrowseR(assembly = "hg19") fetches
https://jbrowse.org/ucsc/hg19/config.json and resolves its
paths.
do.call() hands a list’s entries to a function as named
arguments, so a file read with jsonlite::read_json() is a
whole browser. The load_config_json
example app keeps its assembly in one:
modifyList() overrides a field the file holds:
opts <- jsonlite::read_json("config.json")
do.call(JBrowseR, modifyList(opts, list(location = "10:29,838,737..29,838,819")))read_json() keeps JSON arrays as lists, so a one-element
assemblyNames stays an array on the way back out.
The same object written inline:
opts <- list(
assembly = list(
name = "hg19",
uri = "https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz",
aliases = list("GRCh37")
),
tracks = list(
list(
uri = "https://jbrowse.org/genomes/hg19/GRCh37_latest_genomic.sort.gff.gz",
name = "NCBI RefSeq Genes"
)
),
location = "10:29,838,737..29,838,819"
)
do.call(JBrowseR, opts)