Gene track
2 videos in this tutorial
Gene and transcript features (GFF3, GTF, BED12, and similar) render as glyphs with their exons, UTRs, and CDS segments. Beyond that the track can translate the CDS in place (reading frame colors, amino-acid lettering, mature peptides), color each transcript from a value stored in the file, and reshape the view around a gene by collapsing its introns.
Choosing which transcripts to show
The Gene glyph option in the track menu controls how a gene's transcripts are drawn:
- Auto (default) - stacks every transcript zoomed in, collapses each gene to one transcript zoomed out, and keeps only as many isoforms per gene as the track's height has rows for
- All transcripts - every transcript in a separate row, whatever the zoom or track height. A stack taller than the track scrolls
- Representative transcript - one isoform per gene
The representative isoform is the one the annotation tags: RefSeq Select or
MANE Select (NCBI), MANE_Select or Ensembl_canonical (Ensembl, GENCODE).
It is also drawn first when a gene is stacked. Without a tag, it is the longest
by protein length, or by genomic span for a gene with no coding isoform. The
canonicalTranscriptField and canonicalTranscriptTags config slots name the
attribute and tags.
A gene drawn with fewer transcripts than it has shows +N more beside its name. Clicking it opens that one gene, and the badge then reads show fewer. The Gene glyph submenu grows a row to re-collapse every gene opened this way. The badge appears wherever the gene is wide enough on screen to hold it.
While the display leaves transcripts out, a chip in the track's bottom-right
corner names the rule: Isoforms trimmed where the track's height is the
constraint, otherwise the tag responsible for most genes on screen
(RefSeq Select, MANE Select, or Longest isoform). Its tooltip counts the
genes under each rule. Clicking it opens the same three modes.
Collapsing introns
Collapse introns, from a gene's right-click menu, replaces the view's displayed regions with that gene's exons side by side. A window-size setting keeps some flanking sequence around each splice boundary. Right-clicking a transcript offers that isoform as well as the whole gene (exons unioned), and the dialog's transcript dropdown reaches an isoform that isn't drawn.
With an RNA-seq track, the spliced reads' sashimi arcs then span directly between adjacent exons.
Display density and labels
Track-menu toggles:
- Display mode - Normal, Compact, or Super-compact feature heights
- Show subfeature labels - each transcript's name on its row
- Show... → Chevrons - strand chevrons along the intron lines (on by default)
- Filter by... → Genes - Only genes hides non-gene features, Hide genes the genes
- Group by... - Strand packs the forward-strand features into one labelled
section above the reverse-strand ones, unstranded features last, so convergent
and divergent neighbours read apart. Attribute... opens a dialog for a
feature attribute,
biotypeorsourcesay, and packs one section per value, with the features with none last
Grouping features into sections
Each section has a chip naming it, and the × on a chip hides that section. The Show N hidden chip at the top of the track, or Show... → Show N hidden groups, puts every hidden section back, and changing the grouping clears them. Drag a chip onto another section to move its section there; Show... → Reset section order returns them to the sorted order.
The facet setting pre-groups a track, so a shared link opens grouped. As a
string it names the field: a feature attribute, a dotted path into a structured
one such as INFO.SVTYPE, or strand. As an object it adds the section order,
{ "field": …, "sort": [...] }: the values listed stack first, in that order,
and the rest follow sorted. A chip drag writes the same setting, so what a
config author declares and what a reader arranges are one setting:
Goes in the tracks array of config.json. See Tracks.
{
"trackId": "ncbi_refseq_hg38",
"name": "NCBI RefSeq genes",
"uri": "https://example.com/GCF_000001405.40.gff.gz",
"assemblyNames": ["hg38"],
"displayDefaults": {
"facet": {
"field": "gene_biotype",
"sort": ["protein_coding", "lncRNA", "pseudogene"]
}
}
}jbrowse add-track https://example.com/GCF_000001405.40.gff.gz \
--trackId ncbi_refseq_hg38 \
--name "NCBI RefSeq genes" \
--assemblyNames hg38 \
--displayDefaults '{"facet":{"field":"gene_biotype","sort":["protein_coding","lncRNA","pseudogene"]}}'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:
{
"trackId": "ncbi_refseq_hg38",
"name": "NCBI RefSeq genes",
"uri": "https://example.com/GCF_000001405.40.gff.gz",
"assemblyNames": ["hg38"],
"displayDefaults": {
"facet": {
"field": "gene_biotype",
"sort": ["protein_coding", "lncRNA", "pseudogene"]
}
}
}Grouping also colors each section by its value, red and blue by strand or one color per attribute value, with a key naming them, unless the track already sets a color. The attribute dialog's Also color by this attribute box makes that choice by hand.
Writing the grouping as text
Advanced → Edit plot... in the track menu, also a button at the foot of the
Group by and Color by attribute dialogs, opens the track's grouping, color and
filter as text (Editing a track's plot as text). facet and encoding.color
are the display's settings of those names, in the shape a config file takes
them: facet stacks a section per value of a field, in the order its sort
lists; encoding.color is a field for one color per value, or { "value": … }
holding a CSS color or a jexl expression; filter is the list of tests Filter
by... edits: jexl: expressions that must hold, and geneLike for the
gene-like features. Applying a spec changes only the channels it names, an
object replaces the setting whole, and null clears one. Each of these pastes
as it is:
{ "facet": "strand" }one section per strand{ "facet": { "field": "gene_biotype", "sort": ["protein_coding", "lncRNA"] } }a section per biotype, these two first{ "encoding": { "color": "source" } }one color per source{ "encoding": { "color": "strand" } }forward strand red, reverse blue{ "encoding": { "color": { "field": "gene_biotype", "scale": { "domain": ["protein_coding", "lncRNA"], "range": ["#1f77b4", "#ff7f0e"] } } } }those two biotypes blue and orange, and every other value a distinct color{ "encoding": { "color": { "value": "#1f77b4" } } }one color for everything{ "filter": ["geneLike"] }genes only{ "filter": ["jexl:feature.score > 100"] }scores above 100{ "facet": null, "encoding": null }ungrouped, default color
The dialog lists the same examples. This one groups by biotype in a chosen order, gives each of the four biotypes a distinct color, and leaves the track's filter alone:
{
"facet": {
"field": "gene_biotype",
"sort": ["protein_coding", "snoRNA", "lncRNA", "pseudogene"]
},
"encoding": {
"color": {
"field": "gene_biotype",
"scale": {
"domain": ["protein_coding", "snoRNA", "lncRNA", "pseudogene"]
}
}
}
}A color by a field is the encoding.color setting's
{ "field", "scale": { "domain", "range" } } form, and the track draws a key
from the values it painted. A scale.domain spends the scale.range colors on
the values it lists, in order, and a value it leaves out never takes one of
their colors. Every other value takes a distinct color the first time the track
shows it, and keeps it while the track is open; a value that no other value
competes with gets a color derived from the value, the same on every reload. A
transcript and all its parts take the transcript's value, or its gene's where
the transcript has none. strand is a field too, painting forward tomato and
reverse cornflowerblue unless a domain or range says otherwise. Each channel is
the same setting its menu writes, so the Sections menu reorders a facet written
this way.
Color by CDS
Show... → CDS reading frame colors, in the linear genome view's hamburger menu, tints each CDS segment by the frame it is read in, so one color is one frame across the view. Frame is constant within a segment, so a color change across a junction is a frame shift. The setting applies to every gene track in the view, and JBrowse remembers it across sessions.
Color transcripts by a value in the file
The encoding.color object binds a field in the
GFF3 attribute column to a scale. Under ordinal each value takes a distinct
color; under threshold a number takes the color of the interval it falls in,
between the cut points scale.domain lists, with one scale.range color per
interval. A transcript's exons, CDS and UTRs take the transcript's value, and a
UTR follows encoding.color unless utrColor overrides it.
- JBrowse lowercases attribute names.
dIF=0.79reads under the keydif, so the field isdif - A transcript with no value paints grey, keyed as
(no value). The tutorial below writes its effect size only on the transcripts its test called, so the rest stay grey
The key lists every interval and draws over the track, and you can dismiss it.
For a rule no scale expresses, encoding.color also takes a jexl expression as
its value; see the jexl configuration guide.
The differential transcript usage tutorial has the track configuration behind that figure and the pipeline that writes the attributes.
Peptide lettering
The track draws the translated protein on coding features by default. Zooming in, the amino acids first appear as alternating per-codon shading, then at roughly base-pair resolution as single-letter code over each codon, in register with the reference sequence track. Turn off Amino acids when zoomed in, in the view menu's Show... submenu, to keep the view from fetching the reference.
The translation follows the transcript's strand and CDS phase, splitting codons
that straddle an exon boundary. A CDS with a transl_table attribute (NCBI
convention, e.g. transl_table=2 for vertebrate mitochondria) translates with
that code. The first codon shows as M when it is a valid start for that table
(including GTG or TTG); the track applies and highlights any transl_except
override (e.g. selenocysteine U).
Mature peptides (polyproteins)
Many viral genomes encode one polyprotein cleaved into mature peptides. When a
CDS has mature_protein_region (or mature_protein_region_of_CDS) subfeatures,
the track draws each cleavage product as a separate stacked row in a distinct
color, hoverable and clickable.
- The track names each row by its
productattribute, which NCBI writes in place of a Name, and falls back to the track'slabels.name. - Subfeature labels in the Show menu sets the placement
(
subfeatureLabels).Autonames cleavage products only;Off,BelowandOverlayapply to every part, transcripts included.
Reading a feature's protein sequence
Click the feature and use the Sequence section of the details panel for the protein, CDS, cDNA or genomic sequence. See Feature sequence panel.
Using gene tracks with the Protein3d plugin
The Protein3d plugin uses the same transcript-to-protein mapping. Right click a gene and launch the protein structure viewer for an interactive 3D structure (an AlphaFold model, a PDB entry, or a file of your own) linked to the genome view: hovering a position highlights the residue, and vice versa. See the proteins tutorial for launch routes and installation.
A whole chromosome of genes
Zoomed out far enough, a gene track stops fetching and shows a "region too large" message with a Force load button. A bigWig of feature counts per kilobase, built once from the file and added as a separate track, shows where the genes are at any width.
jbrowse make-density writes the bigWig beside the file:
jbrowse make-density genes.gff3.gz --chrom-sizes hg38.chrom.sizes
jbrowse add-track genes.gff3.density.bw --load copySee the gene density tutorial.
See also
- Tutorial: RNA-seq
- User guide: Sequence track
- User guide: Feature sequence panel
- Config guide: Grouping and lane order
- Config guide: Track configuration