Connections
A connection makes an external hub's tracks available in the track selector
without configuring each track by hand. Admin-defined connections go in the
top-level connections array. A connection a visitor adds to a JBrowse website
is stored in their session; JBrowse Desktop and the embedded components add it
to the config they opened. The config format is below; the
Connections user guide covers in-app behavior.
Connection config format
Every connection has the BaseConnection slots (type,
connectionId, name, and an assemblyNames that limits which of a hub's
genomes load, or for JBrowse 1 names its one assembly), plus one location slot
per type. jbrowse add-connection writes one from the command line
(CLI reference).
UCSC track hub
Points at a hub's hub.txt (UCSCTrackHubConnection):
{
"type": "UCSCTrackHubConnection",
"connectionId": "ucsc_example",
"name": "UCSC example hub",
"hubTxtLocation": {
"uri": "https://example.com/hub.txt"
}
}JB2 track hub
Points at another JBrowse 2 config.json, whose tracks array becomes the
connection's track list and whose assemblies are added where the session lacks
them. assemblyNames lists genomes by name or alias. A track whose type comes
from a plugin this JBrowse does not have is left out, and a warning names the
type (JB2TrackHubConnection):
{
"type": "JB2TrackHubConnection",
"connectionId": "jb2_example",
"name": "JB2 example hub",
"configJsonLocation": {
"uri": "https://example.com/config.json"
}
}JBrowse 1 data directory
Points at a JBrowse 1 data directory holding trackList.json and tracks.conf,
either of which may be absent, and translates its tracks on connect. A JBrowse 1
connection serves one assembly, so assemblyNames is required and holds a
single entry (JBrowse1Connection):
{
"type": "JBrowse1Connection",
"connectionId": "jb1_example",
"name": "JBrowse 1 data",
"assemblyNames": ["hg19"],
"dataDirLocation": {
"uri": "https://example.com/jbrowse1/data/"
}
}Migrating a JBrowse 1 instance
This gist
converts a directory once: it reads trackList.json and tracks.conf, follows
their includes, and writes the tracks into a JBrowse 2 config.json using the
same table as
jb1ToJb2.ts.
An unrecognized storeClass is matched on the filename, and a format with no
JBrowse 2 equivalent leaves a placeholder track naming it. Check the result with
jbrowse validate config.json.
How connections are stored in a session
JBrowse fetches the hub's track list when the connection loads and holds it in
memory, and does not write it into a saved or shared session. The session
stores only the tracks you open or edit (under connectionTrackConfigs, keyed
by trackId), so a shared session stays small even for a very large hub.
See also
- User guide: Connections user guide
- Config guide: Configuring tracks
- Config guide: Hierarchical track selector
- Reference: BaseConnection