Tracks
A track is a trackId, a uri and the assemblyNames it sits on; JBrowse
reads the track type and adapter off the file's extension. Write type and
adapter out when the extension does not say enough, and put appearance
settings (encoding, height, etc.) in a displayDefaults object, which
JBrowse routes to the right display.
A complete config.json with one assembly and one BigBed track, showing where a
track sits:
{
"$schema": "https://jbrowse.org/jb2/schema/v5/config.json",
"assemblies": [
{
"name": "hg19",
"uri": "https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz"
}
],
"tracks": [
{
"type": "FeatureTrack",
"trackId": "repeats_hg19",
"name": "Repeats",
"assemblyNames": ["hg19"],
"category": ["Annotation"],
"adapter": {
"type": "BigBedAdapter",
"uri": "https://jbrowse.org/genomes/hg19/repeats.bb"
}
}
]
}trackIdis the unique id every session and link names the track by, and a renamed track lists its old ids inaliases;assemblyNamesties it to the assembly above;categorynests it in the track selector. Every slot common to all track types is on the BaseTrack config docs.- The adapter uses the
urishorthand (longhand here:"bigBedLocation": { "uri": "..." }). A{ "uri": "..." }location needs"locationType"only where the type cannot be inferred, such as a local file path on desktop.
The shortest track
The repeats track above, written short:
{
"$schema": "https://jbrowse.org/jb2/schema/v5/config.json",
"assemblies": [
{
"name": "hg19",
"uri": "https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz"
}
],
"tracks": [
{
"trackId": "repeats_hg19",
"uri": "https://jbrowse.org/genomes/hg19/repeats.bb"
}
]
}The type, adapter and index location come from the extension, the same guess the
"Add track" dialog makes, name defaults to the file name, and a config with
one assembly supplies assemblyNames. Any key written beside uri wins over
the guess
(the whole-track shorthand
lists the extensions). Two places imply no assembly: a session's
sessionTracks, where a track without assemblyNames has no assembly, and a
config with several assemblies. Name it there.
Configuring displays
Appearance settings belong to a track's displays, the ways a track can be
drawn. A displayDefaults object routes each setting to every display whose
slot by that name takes the value:
Goes in the tracks array of config.json. See Tracks.
{
"type": "VariantTrack",
"trackId": "variants_hg19",
"name": "Variants",
"assemblyNames": ["hg19"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://yourhost/file.vcf.gz"
},
"displayDefaults": {
"encoding": { "color": { "value": "green" } },
"height": 200
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://yourhost/file.vcf.gz \
--trackId variants_hg19 \
--name Variants \
--assemblyNames hg19 \
--displayDefaults '{"encoding":{"color":{"value":"green"}},"height":200}'In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add track from pasted JSON, and paste:
{
"type": "VariantTrack",
"trackId": "variants_hg19",
"name": "Variants",
"assemblyNames": ["hg19"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://yourhost/file.vcf.gz"
},
"displayDefaults": {
"encoding": { "color": { "value": "green" } },
"height": 200
}
}- A name reaches every display that takes the value.
"color": { "value": "green" }paints the linear, multi-sample and circular (chord) displays alike, andheightsets all of them;"color": "type"reaches only the displays whoseencoding.colorpaints by a field, and a value no display takes fails the track's load, naming why. - A name no display defines is ignored, with a console warning so typos show up.
- A
typenarrows it to one display:"type": "LinearVariantDisplay"sends every setting there alone, and a display the track does not offer fails the load.
A displays array gives precise control: two displays with different values for
one setting, a non-default display type, or an explicit displayId (default
{trackId}-{displayType}). An entry wins over displayDefaults for any setting
it names itself.
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "repeats_hg19",
"name": "Repeats",
"assemblyNames": ["hg19"],
"adapter": {
"type": "BigBedAdapter",
"uri": "https://jbrowse.org/genomes/hg19/repeats.bb"
},
"displays": [
{
"type": "LinearBasicDisplay",
"height": 200,
"encoding": { "color": "strand" }
}
]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "repeats_hg19",
"name": "Repeats",
"assemblyNames": ["hg19"],
"adapter": {
"type": "BigBedAdapter",
"uri": "https://jbrowse.org/genomes/hg19/repeats.bb"
},
"displays": [
{
"type": "LinearBasicDisplay",
"height": 200,
"encoding": { "color": "strand" }
}
]
}'In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add track from pasted JSON, and paste:
{
"type": "FeatureTrack",
"trackId": "repeats_hg19",
"name": "Repeats",
"assemblyNames": ["hg19"],
"adapter": {
"type": "BigBedAdapter",
"uri": "https://jbrowse.org/genomes/hg19/repeats.bb"
},
"displays": [
{
"type": "LinearBasicDisplay",
"height": 200,
"encoding": { "color": "strand" }
}
]
}The display types, grouped by the track type they attach to:
Copying a track's config out of the app
- Copy track in the track menu copies the track's full config JSON; "Copy and open track" also opens the copy in the current view.
- Settings in the same menu opens the configuration editor, where every
slot's current value can be read off. A non-admin's edits become a per-session
override of the shared
config.json, and "Reset track settings" clears it.
The "Zoom in to see more features" limits
Two limits guard a region, and either one shows "Zoom in to see features, or force load this track for the rest of the session (may be slow)" with a Force load button: the bytes the fetch would download, and the features that would be drawn on screen. The feature limit never holds back a region under about 20 kb, where the byte limit is doubled, and adapters that summarize at screen resolution (bigWig, Hi-C, MultiWiggle, sequence) are never too large.
Alignments and MAF tracks' cost per reference base scales with read depth or with the number of aligned species instead, which zooming does not reduce, so the message can appear at any zoom. Once zooming in to half the width leaves the byte estimate nearly unchanged, the message drops "Zoom in to see features" and offers only Force load.
Raising the feature limit
maxFeatureScreenDensity
is features per pixel of track width, so the budget grows with the window. Only
top-level features count (a gene, not its transcripts and exons), and the
default of 10 draws a whole bacterial genome. It also draws most whole human
chromosomes without asking: a whole chr10 or chr17 from a RefSeq GFF3 downloads
about 2.8 MB, and "maxFeatureScreenDensity": 1 shows the banner there instead.
A variant track's budget is records.maxFeatureScreenDensity, 1 by default.
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "dense_genes",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": { "maxFeatureScreenDensity": 50 }
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track volvox.sort.gff3.gz \
--trackId dense_genes \
--name Genes \
--assemblyNames volvox \
--displayDefaults '{"maxFeatureScreenDensity":50}' \
--load copyIn JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add track from pasted JSON, and paste:
{
"type": "FeatureTrack",
"trackId": "dense_genes",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": { "maxFeatureScreenDensity": 50 }
}volvox.sort.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
Where nobody can press the button (an embedded view, a notebook, a screenshot),
forceLoad on the display
loads the region regardless.
Raising the byte limit
fetchSizeLimit is a
byte count. The BAM, CRAM and VCF adapters have a fetchSizeLimit slot, which
takes priority over the display's, so for those formats set it on the adapter:
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "volvox_cram",
"name": "volvox CRAM (small fetch size limit)",
"assemblyNames": ["volvox"],
"adapter": {
"type": "CramAdapter",
"uri": "volvox-sorted.cram",
"fetchSizeLimit": 1000
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "AlignmentsTrack",
"trackId": "volvox_cram",
"name": "volvox CRAM (small fetch size limit)",
"assemblyNames": ["volvox"],
"adapter": {
"type": "CramAdapter",
"uri": "volvox-sorted.cram",
"fetchSizeLimit": 1000
}
}'In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add track from pasted JSON, and paste:
{
"type": "AlignmentsTrack",
"trackId": "volvox_cram",
"name": "volvox CRAM (small fetch size limit)",
"assemblyNames": ["volvox"],
"adapter": {
"type": "CramAdapter",
"uri": "volvox-sorted.cram",
"fetchSizeLimit": 1000
}
}volvox-sorted.cram is relative to a config.json. Replace it with its URL or its path on this computer.
Deep reads over a small genome
Amplicon sequencing of a virus puts thousands of reads over every base of a
genome a few tens of kilobases long. A BAM's .bai index has nothing finer than
a 16 kb bin, so the estimate falls as the window narrows only until the window
fits inside one bin, and stops shrinking there. Where one bin's reads outweigh
the limit, as they can at thousands-fold depth, zooming in never clears the
message. Three changes help:
- Use CRAM, or index the BAM with
samtools index -c -m 10and add"csi": trueto the adapter. Both estimate a small window from what that window holds, so zooming in clears the message. A.csibuilt with the default-m 14estimates as a.baidoes. - Raise
fetchSizeLimiton that track's adapter. The limit belongs to the one track, and an assembly this small has no larger window to ask for. - Load a coverage bigWig from
mosdepthor deepToolsbamCoverageas aQuantitativeTrackfor the whole-genome picture, and keep the reads for zoomed-in windows.
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "amplicon_reads",
"name": "Amplicon reads",
"assemblyNames": ["SARS-CoV-2"],
"adapter": {
"type": "CramAdapter",
"uri": "amplicon.cram",
"fetchSizeLimit": 60000000
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "AlignmentsTrack",
"trackId": "amplicon_reads",
"name": "Amplicon reads",
"assemblyNames": ["SARS-CoV-2"],
"adapter": {
"type": "CramAdapter",
"uri": "amplicon.cram",
"fetchSizeLimit": 60000000
}
}'In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add track from pasted JSON, and paste:
{
"type": "AlignmentsTrack",
"trackId": "amplicon_reads",
"name": "Amplicon reads",
"assemblyNames": ["SARS-CoV-2"],
"adapter": {
"type": "CramAdapter",
"uri": "amplicon.cram",
"fetchSizeLimit": 60000000
}
}amplicon.cram is relative to a config.json. Replace it with its URL or its path on this computer.
See also
- Tutorial: Display settings
- Config guide: Supported file types
- Config guide: Hierarchical track selector
- Config guide: Deploying JBrowse Web
- Reference: Config reference, every slot of every track, display and adapter type