Cookbook
Copy-paste recipes for the settings people reach for most. Each is a whole track
config, so it lands the same way in config.json, through the CLI, or pasted
into a running JBrowse. They run against the volvox sample data JBrowse ships
(test_data/volvox).
The smallest config
An assembly to supply the reference sequence, and a track to draw on it:
{
"$schema": "https://jbrowse.org/jb2/schema/v5/config.json",
"assemblies": [{ "name": "volvox", "uri": "volvox.2bit" }],
"tracks": [{ "trackId": "genes", "uri": "volvox.sort.gff3.gz" }]
}JBrowse reads the adapter and the track type off the file's extension, finds the
index sibling, and takes name from the file name
(the shortest track). The same
track written out. Every recipe below starts from this:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "genes",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" }
}jbrowse add-track volvox.sort.gff3.gz \
--trackId genes \
--name Genes \
--assemblyNames volvox \
--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": "genes",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" }
}volvox.sort.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
Display settings go in displayDefaults, which routes each one to the display
that defines it. A jexl: prefix turns any slot into a per-feature callback
(using jexl callbacks). About → Copy config on a
track writes out what you set in the app.
Shorthand and longhand
The one-line { trackId, uri } track above is the whole-track shorthand.
JBrowse unpacks a shorthand one layer at a time until it reaches the longhand
the engine reads, and every layer is also a valid config to write yourself. A
key written at any layer wins over what the layers below would fill in.
The shortest form names the file:
Goes in the tracks array of config.json. See Tracks.
{
"trackId": "genes",
"uri": "volvox.sort.gff3.gz",
"assemblyNames": ["volvox"]
}jbrowse add-track volvox.sort.gff3.gz \
--trackId genes \
--name volvox.sort.gff3.gz \
--assemblyNames volvox \
--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:
{
"trackId": "genes",
"uri": "volvox.sort.gff3.gz",
"assemblyNames": ["volvox"]
}volvox.sort.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
The first unpacking reads the extension and adds the track type, the adapter
with its uri, and a name from the file name:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "genes",
"name": "volvox.sort.gff3.gz",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" }
}jbrowse add-track volvox.sort.gff3.gz \
--trackId genes \
--name volvox.sort.gff3.gz \
--assemblyNames volvox \
--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": "genes",
"name": "volvox.sort.gff3.gz",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" }
}volvox.sort.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
The second unpacking is the adapter's own uri shorthand, which becomes its
location slot and the .tbi index beside it:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "genes",
"name": "volvox.sort.gff3.gz",
"assemblyNames": ["volvox"],
"adapter": {
"type": "Gff3TabixAdapter",
"gffGzLocation": {
"uri": "volvox.sort.gff3.gz",
"locationType": "UriLocation"
},
"index": {
"location": {
"uri": "volvox.sort.gff3.gz.tbi",
"locationType": "UriLocation"
},
"indexType": "TBI"
}
}
}jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "genes",
"name": "volvox.sort.gff3.gz",
"assemblyNames": ["volvox"],
"adapter": {
"type": "Gff3TabixAdapter",
"gffGzLocation": {
"uri": "volvox.sort.gff3.gz",
"locationType": "UriLocation"
},
"index": {
"location": {
"uri": "volvox.sort.gff3.gz.tbi",
"locationType": "UriLocation"
},
"indexType": "TBI"
}
}
}'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": "genes",
"name": "volvox.sort.gff3.gz",
"assemblyNames": ["volvox"],
"adapter": {
"type": "Gff3TabixAdapter",
"gffGzLocation": {
"uri": "volvox.sort.gff3.gz",
"locationType": "UriLocation"
},
"index": {
"location": {
"uri": "volvox.sort.gff3.gz.tbi",
"locationType": "UriLocation"
},
"indexType": "TBI"
}
}
}volvox.sort.gff3.gz, volvox.sort.gff3.gz.tbi are relative to a config.json. Replace each with its URL or its path on this computer.
All three describe one track. Write the layer that says what you mean: the
shortest for a file the extension describes, the middle for a different type
or a displays array, the last for an index that does not sit beside its file.
An assembly unpacks the same way, { "name": "volvox", "uri": "volvox.2bit" }
becoming a sequence adapter
(file types lists
the extensions).
A complete config
A config.json with the settings people usually reach for: a track of each common
type, a defaultSession to open on load,
and a theme. Every recipe below changes one piece of it.
{
"$schema": "https://jbrowse.org/jb2/schema/v5/config.json",
"assemblies": [{ "name": "volvox", "uri": "volvox.2bit" }],
"tracks": [
{
"type": "FeatureTrack",
"trackId": "genes",
"name": "Genes",
"category": ["Annotation"],
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": {
"color": { "field": "strand" },
"height": 200,
"mouseover": "jexl:feature.name"
}
},
{
"type": "AlignmentsTrack",
"trackId": "reads",
"name": "Reads",
"assemblyNames": ["volvox"],
"adapter": { "type": "BamAdapter", "uri": "volvox-sorted.bam" },
"displayDefaults": {
"heightMode": "fit",
"color": { "field": "mapq" },
"filter": { "flagExclude": 1540, "flagInclude": 0 }
}
},
{
"type": "QuantitativeTrack",
"trackId": "coverage",
"name": "Coverage",
"assemblyNames": ["volvox"],
"adapter": { "type": "BigWigAdapter", "uri": "volvox_microarray.bw" },
"displayDefaults": {
"color": "#C8B414",
"scales": { "y": { "type": "log", "domainMin": 0 } }
}
},
{
"type": "VariantTrack",
"trackId": "variants",
"name": "Variants",
"assemblyNames": ["volvox"],
"adapter": { "type": "VcfTabixAdapter", "uri": "volvox.filtered.vcf.gz" },
"displayDefaults": {
"color": "jexl:feature.type=='SNV'?'green':'purple'",
"filter": ["jexl:feature.INFO.AF[0] > 0.05"]
}
}
],
"defaultSession": {
"name": "My session",
"views": [
{
"type": "LinearGenomeView",
"loc": "ctgA:1-50000",
"assembly": "volvox",
"tracks": ["genes", "reads", "coverage", "variants"]
}
]
},
"configuration": {
"theme": { "palette": { "primary": { "main": "#311b92" } } }
}
}Colors
color is a CSS color, or an object that paints each feature by one of its
fields and draws a key saying what each color means. This is the object Color
by... → Strand writes, so forward stays red everywhere in the app, synteny
ribbons included:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "genes_by_strand",
"name": "Genes (colored by strand)",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": {
"color": { "field": "strand" }
}
}jbrowse add-track volvox.sort.gff3.gz \
--trackId genes_by_strand \
--name "Genes (colored by strand)" \
--assemblyNames volvox \
--displayDefaults '{"color":{"field":"strand"}}' \
--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": "genes_by_strand",
"name": "Genes (colored by strand)",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": {
"color": { "field": "strand" }
}
}volvox.sort.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
field names any attribute the track has. On a gene track a transcript's parts
paint in the transcript's value, or the gene's where the transcript has none.
| Recipe | color |
|---|---|
| Solid color | "#6a3d9a" |
| A color per value | { "field": "type" } |
| Chosen colors for some values | { "field": "type", "domain": ["CDS", "exon"], "range": ["#d62728", "#2ca02c"] } |
| Bins of a number | { "field": "score", "scale": "threshold", "domain": ["7.3"], "range": ["#0068d1", "red"] } |
| A gradient along a number | { "field": "score", "scheme": "viridis" } |
| BED file's own colors | leave color unset |
| Anything else | a jexl: expression over feature returning a color |
score paints a gradient unless scale says otherwise, and any other field a
color per value; domainMin and domainMax pin a gradient's ends, which
otherwise follow the loaded features. labels names the domain values in the
key and title heads it:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "rmsk_hg38",
"name": "RepeatMasker",
"assemblyNames": ["hg38"],
"adapter": { "type": "BedTabixAdapter", "uri": "rmsk.bed.gz" },
"displayDefaults": {
"color": {
"field": "repClass",
"domain": [
"SINE",
"LINE",
"LTR",
"DNA",
"Simple_repeat",
"Low_complexity"
],
"range": [
"#e41a1c",
"#377eb8",
"#4daf4a",
"#984ea3",
"#ff7f00",
"#a65628"
],
"labels": [
"SINE",
"LINE",
"LTR",
"DNA",
"Simple repeat",
"Low complexity"
]
}
}
}jbrowse add-track rmsk.bed.gz \
--trackId rmsk_hg38 \
--name RepeatMasker \
--assemblyNames hg38 \
--displayDefaults '{"color":{"field":"repClass","domain":["SINE","LINE","LTR","DNA","Simple_repeat","Low_complexity"],"range":["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#a65628"],"labels":["SINE","LINE","LTR","DNA","Simple repeat","Low complexity"]}}' \
--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": "rmsk_hg38",
"name": "RepeatMasker",
"assemblyNames": ["hg38"],
"adapter": { "type": "BedTabixAdapter", "uri": "rmsk.bed.gz" },
"displayDefaults": {
"color": {
"field": "repClass",
"domain": [
"SINE",
"LINE",
"LTR",
"DNA",
"Simple_repeat",
"Low_complexity"
],
"range": [
"#e41a1c",
"#377eb8",
"#4daf4a",
"#984ea3",
"#ff7f00",
"#a65628"
],
"labels": [
"SINE",
"LINE",
"LTR",
"DNA",
"Simple repeat",
"Low complexity"
]
}
}
}rmsk.bed.gz is relative to a config.json. Replace it with its URL or its path on this computer.
Customizing feature colors covers reading the type list off the file and moving an outgrown callback into a plugin.
Labels, tooltips & details
labels.name and labels.description each name the feature field a label line
reads, such as "note", or take a jexl: expression where the label wants a
fallback. showLabels
pins which lines are drawn at every zoom, and mouseover is rendered as HTML:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "genes_labeled",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": {
"labels": {
"name": "jexl:feature.name || feature.id",
"description": "note"
},
"showLabels": "nameAndDescription",
"mouseover": "jexl:`${feature.name} [${feature.type}] ${feature.start}-${feature.end}`"
}
}jbrowse add-track volvox.sort.gff3.gz \
--trackId genes_labeled \
--name Genes \
--assemblyNames volvox \
--displayDefaults '{"labels":{"name":"jexl:feature.name || feature.id","description":"note"},"showLabels":"nameAndDescription","mouseover":"jexl:`${feature.name} [${feature.type}] ${feature.start}-${feature.end}`"}' \
--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": "genes_labeled",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": {
"labels": {
"name": "jexl:feature.name || feature.id",
"description": "note"
},
"showLabels": "nameAndDescription",
"mouseover": "jexl:`${feature.name} [${feature.type}] ${feature.start}-${feature.end}`"
}
}volvox.sort.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
formatDetails reshapes the click-details panel: the returned object merges
into what is shown, a field set to undefined is hidden, and a bare URL becomes
a link:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "genes_linked_details",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"formatDetails": {
"feature": "jexl:{NCBI:'https://www.ncbi.nlm.nih.gov/gene/?term='+feature.name, type:undefined}"
}
}jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "genes_linked_details",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"formatDetails": {
"feature": "jexl:{NCBI:'\''https://www.ncbi.nlm.nih.gov/gene/?term='\''+feature.name, type:undefined}"
}
}'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": "genes_linked_details",
"name": "Genes",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"formatDetails": {
"feature": "jexl:{NCBI:'https://www.ncbi.nlm.nih.gov/gene/?term='+feature.name, type:undefined}"
}
}volvox.sort.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
Customizing feature details covers subfeatures, the session-wide form, and the About dialog.
Feature tracks
A feature track fits its height by default: a crowded window drops labels and
then squeezes the rows rather than scrolling.
heightMode fixed
keeps every label and scrolls instead. filter draws only the features that
pass every jexl: expression, on variant tracks too:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "long_genes",
"name": "Long genes only",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": {
"height": 200,
"filter": [
"jexl:feature.end - feature.start > 1000",
"jexl:feature.type == 'gene'"
]
}
}jbrowse add-track volvox.sort.gff3.gz \
--trackId long_genes \
--name "Long genes only" \
--assemblyNames volvox \
--displayDefaults "{\"height\":200,\"filter\":[\"jexl:feature.end - feature.start > 1000\",\"jexl:feature.type == 'gene'\"]}" \
--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": "long_genes",
"name": "Long genes only",
"assemblyNames": ["volvox"],
"adapter": { "type": "Gff3TabixAdapter", "uri": "volvox.sort.gff3.gz" },
"displayDefaults": {
"height": 200,
"filter": [
"jexl:feature.end - feature.start > 1000",
"jexl:feature.type == 'gene'"
]
}
}volvox.sort.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
Alignments tracks
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "my_bam",
"name": "Haplotype 1 reads",
"assemblyNames": ["volvox"],
"adapter": { "type": "BamAdapter", "uri": "volvox-sorted.bam" },
"displayDefaults": {
"height": 400,
"color": { "field": "mapq" },
"showSoftClipping": true,
"facet": { "field": "tags.HP", "domain": ["2", "1"] },
"filter": {
"flagExclude": 1540,
"flagInclude": 0,
"tagFilters": [{ "tag": "HP", "value": "1" }]
}
}
}jbrowse add-track volvox-sorted.bam \
--trackId my_bam \
--name "Haplotype 1 reads" \
--assemblyNames volvox \
--displayDefaults '{"height":400,"color":{"field":"mapq"},"showSoftClipping":true,"facet":{"field":"tags.HP","domain":["2","1"]},"filter":{"flagExclude":1540,"flagInclude":0,"tagFilters":[{"tag":"HP","value":"1"}]}}' \
--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": "AlignmentsTrack",
"trackId": "my_bam",
"name": "Haplotype 1 reads",
"assemblyNames": ["volvox"],
"adapter": { "type": "BamAdapter", "uri": "volvox-sorted.bam" },
"displayDefaults": {
"height": 400,
"color": { "field": "mapq" },
"showSoftClipping": true,
"facet": { "field": "tags.HP", "domain": ["2", "1"] },
"filter": {
"flagExclude": 1540,
"flagInclude": 0,
"tagFilters": [{ "tag": "HP", "value": "1" }]
}
}
}volvox-sorted.bam is relative to a config.json. Replace it with its URL or its path on this computer.
color's field also takesstrand,pairOrientation,insertSizeandtags.XX; a string is one color for every read, anddomainwithrangerecolors one level:{ "field": "pairOrientation", "domain": ["RR"], "range": ["#d95f02"] }baseColordraws a per-base layer over the reads, whatevercolorfills them with:"modifications","bisulfite","baseQuality"or"base"facetalso takesstrand,firstOfPairStrand,pairOrientation,split,pairing,mapq, or any read field;domainpins which haplotype (or other value) stacks first — the same slot feature, variant, mark and multiway synteny tracks all takeflagExclude1540 hides unmapped, vendor-failed, and duplicate reads; 3844 also hides secondary and supplementary (flag explainer)- CRAM uses
CramAdapterin place ofBamAdapter
Quantitative (wiggle) tracks
A string in color paints every bar; left alone, a wiggle cuts at its origin
and paints the two sides apart.
mark picks bar, line,
point, or span.
Goes in the tracks array of config.json. See Tracks.
{
"type": "QuantitativeTrack",
"trackId": "coverage",
"name": "Coverage",
"assemblyNames": ["volvox"],
"adapter": { "type": "BigWigAdapter", "uri": "volvox_microarray.bw" },
"displayDefaults": {
"color": "#C8B414",
"scales": { "y": { "type": "log", "domainMin": 0 } }
}
}jbrowse add-track volvox_microarray.bw \
--trackId coverage \
--name Coverage \
--assemblyNames volvox \
--displayDefaults '{"color":"#C8B414","scales":{"y":{"type":"log","domainMin":0}}}' \
--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": "QuantitativeTrack",
"trackId": "coverage",
"name": "Coverage",
"assemblyNames": ["volvox"],
"adapter": { "type": "BigWigAdapter", "uri": "volvox_microarray.bw" },
"displayDefaults": {
"color": "#C8B414",
"scales": { "y": { "type": "log", "domainMin": 0 } }
}
}volvox_microarray.bw is relative to a config.json. Replace it with its URL or its path on this computer.
Multiple signals on one track, each its own color
Goes in the tracks array of config.json. See Tracks.
{
"type": "MultiQuantitativeTrack",
"trackId": "multiwig",
"name": "Grains",
"assemblyNames": ["volvox"],
"adapter": {
"type": "MultiWiggleAdapter",
"subadapters": [
{
"type": "BigWigAdapter",
"name": "Grain1",
"uri": "v1.bw",
"color": "#f00"
},
{
"type": "BigWigAdapter",
"name": "Grain2",
"uri": "v2.bw",
"color": "#f60"
}
]
},
"displayDefaults": { "mark": "line", "rows": "" }
}jbrowse add-track-json '{
"type": "MultiQuantitativeTrack",
"trackId": "multiwig",
"name": "Grains",
"assemblyNames": ["volvox"],
"adapter": {
"type": "MultiWiggleAdapter",
"subadapters": [
{
"type": "BigWigAdapter",
"name": "Grain1",
"uri": "v1.bw",
"color": "#f00"
},
{
"type": "BigWigAdapter",
"name": "Grain2",
"uri": "v2.bw",
"color": "#f60"
}
]
},
"displayDefaults": { "mark": "line", "rows": "" }
}'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": "MultiQuantitativeTrack",
"trackId": "multiwig",
"name": "Grains",
"assemblyNames": ["volvox"],
"adapter": {
"type": "MultiWiggleAdapter",
"subadapters": [
{
"type": "BigWigAdapter",
"name": "Grain1",
"uri": "v1.bw",
"color": "#f00"
},
{
"type": "BigWigAdapter",
"name": "Grain2",
"uri": "v2.bw",
"color": "#f60"
}
]
},
"displayDefaults": { "mark": "line", "rows": "" }
}v1.bw, v2.bw are relative to a config.json. Replace each with its URL or its path on this computer.
rows decides the layout: "source" stacks one row per signal, and "",
above, draws every signal in one shared plot box. Pin
scales.y.domainMin/domainMax when the quantity has an absolute meaning, or
per-row autoscale draws a flat sample at the same height as an amplified one.
Past a handful of samples, generate subadapters from your samplesheet
(multi-quantitative tracks).
Variant tracks
color and filter work as on a feature track, and VCF INFO fields are the
usual thing to branch on. The svType field reads a record's structural-variant
class off its symbolic ALT or INFO/SVTYPE, and paints each class its own color
under a key:
Goes in the tracks array of config.json. See Tracks.
{
"type": "VariantTrack",
"trackId": "svs_by_type",
"name": "SVs by type",
"assemblyNames": ["volvox"],
"adapter": { "type": "VcfTabixAdapter", "uri": "volvox.dup.vcf.gz" },
"displayDefaults": {
"color": { "field": "svType" },
"filter": ["jexl:feature.INFO.AF[0] > 0.05"]
}
}jbrowse add-track volvox.dup.vcf.gz \
--trackId svs_by_type \
--name "SVs by type" \
--assemblyNames volvox \
--displayDefaults '{"color":{"field":"svType"},"filter":["jexl:feature.INFO.AF[0] > 0.05"]}' \
--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": "VariantTrack",
"trackId": "svs_by_type",
"name": "SVs by type",
"assemblyNames": ["volvox"],
"adapter": { "type": "VcfTabixAdapter", "uri": "volvox.dup.vcf.gz" },
"displayDefaults": {
"color": { "field": "svType" },
"filter": ["jexl:feature.INFO.AF[0] > 0.05"]
}
}volvox.dup.vcf.gz is relative to a config.json. Replace it with its URL or its path on this computer.
For a multi-sample VCF as a genotype grid, see variant tracks.
Synteny and dotplot tracks
Getting the two assemblies backwards is the most common mistake here. minimap2
takes its inputs target first (minimap2 grape.fa peach.fa makes grape the
target), so name them explicitly. The query draws on the dotplot's horizontal
axis and the top row in linear synteny; if the track loads blank, flip the two.
Goes in the tracks array of config.json. See Tracks.
{
"type": "SyntenyTrack",
"trackId": "grape_peach_synteny",
"name": "Grape vs Peach",
"assemblyNames": ["peach", "grape"],
"adapter": {
"type": "PAFAdapter",
"uri": "out.paf",
"queryAssembly": "peach",
"targetAssembly": "grape"
}
}jbrowse add-track-json '{
"type": "SyntenyTrack",
"trackId": "grape_peach_synteny",
"name": "Grape vs Peach",
"assemblyNames": ["peach", "grape"],
"adapter": {
"type": "PAFAdapter",
"uri": "out.paf",
"queryAssembly": "peach",
"targetAssembly": "grape"
}
}'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": "SyntenyTrack",
"trackId": "grape_peach_synteny",
"name": "Grape vs Peach",
"assemblyNames": ["peach", "grape"],
"adapter": {
"type": "PAFAdapter",
"uri": "out.paf",
"queryAssembly": "peach",
"targetAssembly": "grape"
}
}out.paf is relative to a config.json. Replace it with its URL or its path on this computer.
That shows it in the linear view. For the synteny view, open Add → Linear synteny view, pick the track under Quick start, and click Launch.
Large alignments
Every synteny adapter reads the whole file into memory, except the indexed (PIF)
ones. Index a big PAF once, then use the same track with
"type": "PairwiseIndexedPAFAdapter" and the .pif.gz as its uri:
jbrowse make-pif alignments.paf # -> alignments.pif.gz (+ .tbi)The synteny track guide has every adapter,
and all-vs-all synteny stacks more than two
genomes from one PAF. Three or more genomes as one lane apiece, rather than
every assembly anchored against one reference, is MultiWaySyntenyDisplay
(grouping and lane order
has a worked config).
Settings every track type shares
A handful of setting names recur across track types. field names a feature
field. Over a field's categories (a color per value, the sections of a facet,
the rows) domain lists the values that lead, in order, and the rest follow
after them; a color's range gives the listed values their colors, as ggplot2's
breaks with named values would. A threshold color reads domain as its cut
points, one fewer than the colors in range, and a gradient pins its ends with
domainMin and domainMax.
| Setting | What it does | Track types |
|---|---|---|
color | a CSS color, or { "field", "domain", "range" } painting by a field, with a key (Colors) | feature, variant, alignments, quantitative, synteny, mark display (encoding.color) |
facet | one labelled section per value of a field; domain stacks the listed values first | feature, variant, alignments, synteny, mark display |
rows | one row per source or sample; domain puts the listed rows first | quantitative, multi-row feature, multi-sample variant, MAF, mark display |
scales.y | the value axis: type, domainMin/domainMax, domainQuantile, autoscaleGroup, and the guides rules, grid, title, minimalTicks | quantitative, alignments coverage, synteny, mark display, GWAS |
The same scales.y object works on each of those track types. This one captions
an alignments track's coverage band, rules it at every tick and draws a labelled
line at 20x:
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "reads_depth_guides",
"name": "Reads, with depth guides",
"assemblyNames": ["volvox"],
"adapter": { "type": "BamAdapter", "uri": "volvox-sorted.bam" },
"displayDefaults": {
"scales": {
"y": {
"title": "depth",
"grid": true,
"rules": [{ "value": 20, "color": "#d62728", "label": "20x" }]
}
}
}
}jbrowse add-track volvox-sorted.bam \
--trackId reads_depth_guides \
--name "Reads, with depth guides" \
--assemblyNames volvox \
--displayDefaults '{"scales":{"y":{"title":"depth","grid":true,"rules":[{"value":20,"color":"#d62728","label":"20x"}]}}}' \
--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": "AlignmentsTrack",
"trackId": "reads_depth_guides",
"name": "Reads, with depth guides",
"assemblyNames": ["volvox"],
"adapter": { "type": "BamAdapter", "uri": "volvox-sorted.bam" },
"displayDefaults": {
"scales": {
"y": {
"title": "depth",
"grid": true,
"rules": [{ "value": 20, "color": "#d62728", "label": "20x" }]
}
}
}
}volvox-sorted.bam is relative to a config.json. Replace it with its URL or its path on this computer.
For a picture no built-in display draws, such as bars from a BED score, points
colored by a category or a histogram of feature lengths, the
mark display builds it from marks,
encoding and transform.
Its examples are copy-paste recipes
like the ones on this page.
Instance-wide settings
A nested category makes nested folders in the track selector, and metadata
shows in the track details:
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "brain_rnaseq",
"name": "Brain RNA-seq",
"assemblyNames": ["volvox"],
"adapter": { "type": "BamAdapter", "uri": "volvox-sorted.bam" },
"category": ["RNA-seq", "Brain"],
"metadata": {
"description": "150bp paired-end reads",
"source": "See <a href='https://example.com'>the paper</a>"
}
}jbrowse add-track-json '{
"type": "AlignmentsTrack",
"trackId": "brain_rnaseq",
"name": "Brain RNA-seq",
"assemblyNames": ["volvox"],
"adapter": { "type": "BamAdapter", "uri": "volvox-sorted.bam" },
"category": ["RNA-seq", "Brain"],
"metadata": {
"description": "150bp paired-end reads",
"source": "See <a href='\''https://example.com'\''>the paper</a>"
}
}'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": "brain_rnaseq",
"name": "Brain RNA-seq",
"assemblyNames": ["volvox"],
"adapter": { "type": "BamAdapter", "uri": "volvox-sorted.bam" },
"category": ["RNA-seq", "Brain"],
"metadata": {
"description": "150bp paired-end reads",
"source": "See <a href='https://example.com'>the paper</a>"
}
}volvox-sorted.bam is relative to a config.json. Replace it with its URL or its path on this computer.
refNameAliases lines up tracks that name the same chromosome differently (chr1
vs 1 vs NC_000001):
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "volvox",
"uri": "volvox.2bit",
"refNameAliases": { "uri": "volvox.chromAliases.txt" }
}jbrowse add-assembly volvox.2bit \
--name volvox \
--refNameAliases volvox.chromAliases.txt \
--load copyIn JBrowse Desktop, Open new genome on the start screen (or File → Open genome... in a session), then Open from a URL and paste:
volvox.2bitJBrowse reads the format off the file name. Then fill in:
- Genome name:
volvox - refName aliases (under More options):
volvox.chromAliases.txt
volvox.2bit, volvox.chromAliases.txt are relative to a config.json. Replace each with its URL or its path on this computer.
- Text searching:
jbrowse text-indexbuilds the index and writes it into your config (text searching) - Theme:
configuration.theme, as in the complete config above (theming) - Plugins:
"plugins": [{ "name": "MyPlugin", "esmLoc": { "uri": "myplugin.js" } }](plugins)
From config to a URL
https://host/jbrowse2/?config=config.json&assembly=volvox&loc=ctgA:1-50000&tracks=genes,coverageassembly is the name of an entry in assemblies, loc is a region or a
gene name once you have run jbrowse text-index, and tracks is a list of
trackIds. A link like this ignores any defaultSession; add
&extendSession=true to keep the session and change only the location. See
URL query parameter API for display settings in the link, multi-view layouts, and
share links.
Where to go next
- Grouping and lane order - the
domainslot that orders sections, lanes and rows, across every display type that has one - Mark display examples - one copyable config per plot shape, from bars and points to histograms and links
- Config guide - structure of
config.jsonand every per-track guide - Command line tools (JBrowse CLI) -
add-track --displayDefaults '<json>'applies any recipe above - Config reference - the auto-generated slot list for every track, display, and adapter