RNA-seq visualization
The tutorials target the JBrowse v5 beta, and the v4.3.0 release
on the download page lacks some of what they show. To install the
beta of JBrowse Web, run npm install -g @jbrowse/cli@next, then
jbrowse create jbrowse2 --branch v5.0.0-beta.22. Desktop beta builds for Linux and
macOS are on the releases page;
the Windows build waits on code signing.
An RNA-seq read mapped back to the genome jumps the introns spliced out of the transcript, and the aligner records each jump in the read's CIGAR string. In a stranded library the pair flags also mark which strand the transcript came from. JBrowse draws splice arcs and strand coloring from those two BAM fields, with no extra files or configuration. We:
- load the stranded reads and RefSeq genes on hg19, and read coverage and splice arcs over ACTB
- sort and filter to the spliced reads, then load IsoSeq long reads over the same gene
- color and group the reads by first-of-pair strand where genes on opposite strands sit close together
- draw a circular RNA's back-splice from split reads, set RNase R-treated reads beside untreated ones, and follow nanopore reads around a circle
- load STAR, regtools and portcullis junction tables as arc tracks
Prerequisites
- a JBrowse instance: the web quickstart or the desktop quickstart
- for your own reads, a spliced aligner such as STAR, and samtools to index its output
# Debian/Ubuntu
sudo apt install samtools
# or conda, which has every tool above
conda install -c bioconda -c conda-forge samtoolsThe data
The hg19 alignments, gene models and junction table behind the figures, hosted on jbrowse.org's demo bucket.
Nothing to download: the track configs below read these files by URL. Loading your own RNA-seq data covers reads of your own.
The files
| What it is | File |
|---|---|
| The paired-end stranded RNA-seq alignments behind every short-read figure on this page, from the sample files listed at RSeQC | Pairend_StrandSpecific_51mer_Human_hg19.bam |
Loading hg19, the stranded reads and RefSeq genes
The alignments are against hg19, so we load that assembly with an alias file that maps the chromosome names in the BAM and the gene models to the assembly's. Then we add the stranded paired-end reads and the RefSeq gene models, each with its index beside it:
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "hg19",
"uri": "https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz",
"refNameAliases": {
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/hg19_aliases.txt"
},
"cytobands": "https://jbrowse.org/ucsc/hg19/cytoBandIdeo.bed.gz"
}Edits config.json in the current folder, creating it if there is none. See JBrowse CLI with Desktop.
jbrowse add-assembly https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz \
--name hg19 \
--refNameAliases https://s3.amazonaws.com/jbrowse.org/genomes/hg19/hg19_aliases.txt \
--config '{"cytobands":"https://jbrowse.org/ucsc/hg19/cytoBandIdeo.bed.gz"}'hg19 is one of the genomes JBrowse Desktop hosts, with gene tracks already set up: on the start screen click Browse hosted genomes and pick it. To load the files of this config instead:
In JBrowse Desktop, Open your own genome on the start screen (or File → Open genome... in a session), then Open from a URL and paste, one per line:
https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz
https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz.fai
https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz.gziJBrowse reads the format off the file name. Then fill in:
- Genome name:
hg19 - refName aliases (under More options):
https://s3.amazonaws.com/jbrowse.org/genomes/hg19/hg19_aliases.txt - cytobands (under More options):
https://jbrowse.org/ucsc/hg19/cytoBandIdeo.bed.gz
Goes in the tracks array of config.json. See Tracks.
{
"trackId": "rnaseq_paired_stranded",
"name": "Paired-end stranded RNA-seq (RSeQC sample)",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/paired_end_rnaseq/Pairend_StrandSpecific_51mer_Human_hg19.bam",
"assemblyNames": ["hg19"]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://s3.amazonaws.com/jbrowse.org/genomes/hg19/paired_end_rnaseq/Pairend_StrandSpecific_51mer_Human_hg19.bam \
--trackId rnaseq_paired_stranded \
--name "Paired-end stranded RNA-seq (RSeQC sample)" \
--assemblyNames hg19In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track... and, in Add a track from file or URL, enter:
- Main file:
https://s3.amazonaws.com/jbrowse.org/genomes/hg19/paired_end_rnaseq/Pairend_StrandSpecific_51mer_Human_hg19.bam
JBrowse reads the adapter and track type off the file name. Then fill in:
- Track name:
Paired-end stranded RNA-seq (RSeQC sample) - Assembly:
hg19
Click Add.
Open this track in JBrowse Web ↗
Needs JBrowse Desktop 5.0 or newer. If nothing opens, copy the link and paste it into Desktop's Open JBrowse Web link..., on the start screen or under File → Session.
https://jbrowse.org/code/jb2/main/?config=https%3A%2F%2Fjbrowse.org%2Fucsc%2Fhg19%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22trackId%22%3A%22rnaseq_paired_stranded%22%2C%22name%22%3A%22Paired-end+stranded+RNA-seq+%28RSeQC+sample%29%22%2C%22uri%22%3A%22https%3A%2F%2Fs3.amazonaws.com%2Fjbrowse.org%2Fgenomes%2Fhg19%2Fpaired_end_rnaseq%2FPairend_StrandSpecific_51mer_Human_hg19.bam%22%2C%22assemblyNames%22%3A%5B%22hg19%22%5D%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chr7%3A5%2C567%2C000-5%2C570%2C000%22%2C%22tracks%22%3A%5B%22rnaseq_paired_stranded%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+Paired-end+stranded+RNA-seq+%28RSeQC+sample%29This view in a notebook, with jbrowse-anywidget. Swap a track's uri for your file.
from jbrowse_anywidget import JBrowseApp, fetch_hub
config = fetch_hub("https://jbrowse.org/ucsc/hg19/config.json")
app = JBrowseApp(
assemblies=config["assemblies"],
tracks=config.get("tracks", []) + [
{
"trackId": "rnaseq_paired_stranded",
"name": "Paired-end stranded RNA-seq (RSeQC sample)",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/paired_end_rnaseq/Pairend_StrandSpecific_51mer_Human_hg19.bam",
"assemblyNames": [
"hg19"
]
}
],
views=[
{
"type": "LinearGenomeView",
"assembly": "hg19",
"loc": "chr7:5,567,000-5,570,000",
"tracks": [
"rnaseq_paired_stranded"
]
}
],
)
app # display the widgetThis view in your React 19 app, with @jbrowse/react-app2 and @jbrowse/core. Add your own files to tracks.
import { use } from 'react'
import { JBrowse } from '@jbrowse/react-app2'
import '@jbrowse/react-app2/styles.css'
import { addRelativeUris } from '@jbrowse/core/util/addRelativeUris'
const configUrl = "https://jbrowse.org/ucsc/hg19/config.json"
const configPromise = fetch(configUrl)
.then(res => res.json())
.then(config => {
addRelativeUris(config, new URL(configUrl))
return config
})
export default function Figure() {
const config = use(configPromise)
return (
<JBrowse
assemblies={config.assemblies}
tracks={[...(config.tracks ?? []), ...[
{
"trackId": "rnaseq_paired_stranded",
"name": "Paired-end stranded RNA-seq (RSeQC sample)",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/paired_end_rnaseq/Pairend_StrandSpecific_51mer_Human_hg19.bam",
"assemblyNames": [
"hg19"
]
}
]]}
aggregateTextSearchAdapters={config.aggregateTextSearchAdapters}
configuration={config.configuration}
views={[
{
"type": "LinearGenomeView",
"assembly": "hg19",
"loc": "chr7:5,567,000-5,570,000",
"tracks": [
"rnaseq_paired_stranded"
]
}
]}
/>
)
}jbrowse-img draws this view as an SVG, no browser needed. Swap --config or a track for your own.
cat > tracks.json <<'JSON'
[
{
"trackId": "rnaseq_paired_stranded",
"name": "Paired-end stranded RNA-seq (RSeQC sample)",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/paired_end_rnaseq/Pairend_StrandSpecific_51mer_Human_hg19.bam",
"assemblyNames": [
"hg19"
]
}
]
JSON
npx @jbrowse/img --config https://jbrowse.org/ucsc/hg19/config.json \
--trackConfigs tracks.json \
--assembly hg19 --loc chr7:5,567,000-5,570,000 \
--track rnaseq_paired_stranded \
--out figure.svgFor a PNG, --out figure.png (needs rsvg-convert: apt install librsvg2-bin, brew install librsvg).
Goes in the tracks array of config.json. See Tracks.
{
"trackId": "ncbi_refseq_hg19",
"name": "NCBI RefSeq genes (hg19)",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/ncbi_refseq/GRCh37_latest_genomic.sort.gff.gz",
"assemblyNames": ["hg19"]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://s3.amazonaws.com/jbrowse.org/genomes/hg19/ncbi_refseq/GRCh37_latest_genomic.sort.gff.gz \
--trackId ncbi_refseq_hg19 \
--name "NCBI RefSeq genes (hg19)" \
--assemblyNames hg19In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track... and, in Add a track from file or URL, enter:
- Main file:
https://s3.amazonaws.com/jbrowse.org/genomes/hg19/ncbi_refseq/GRCh37_latest_genomic.sort.gff.gz
JBrowse reads the adapter and track type off the file name. Then fill in:
- Track name:
NCBI RefSeq genes (hg19) - Assembly:
hg19
Click Add.
Loading your own RNA-seq data
STAR aligns reads of your own into a sorted BAM.
--outSAMstrandField intronMotif writes the XS strand tag that colors the
splice arcs further down:
STAR --genomeDir star_index --readFilesIn R1.fq.gz R2.fq.gz \
--readFilesCommand gzip -dc --outSAMtype BAM SortedByCoordinate \
--outSAMstrandField intronMotif
samtools index Aligned.sortedByCoord.out.bamThe sorted, indexed BAM or CRAM loads as an AlignmentsTrack from one uri,
and JBrowse finds the .bai or .crai beside the file:
Goes in the tracks array of config.json. See Tracks.
{
"trackId": "my_rnaseq",
"name": "My RNA-seq",
"uri": "https://yourhost/rnaseq.bam",
"assemblyNames": ["hg38"]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://yourhost/rnaseq.bam \
--trackId my_rnaseq \
--name "My RNA-seq" \
--assemblyNames hg38In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track... and, in Add a track from file or URL, enter:
- Main file:
https://yourhost/rnaseq.bam
JBrowse reads the adapter and track type off the file name. Then fill in:
- Track name:
My RNA-seq - Assembly:
hg38
Click Add.
Two more things apply to your own reads:
- Assembly.
assemblyNamesmust name an assembly already configured in JBrowse, the one the reads were aligned to; see the assemblies configuration guide. - Coverage signal. A precomputed signal, such as a strand-specific BigWig from the aligner, loads separately as a quantitative track.
What RNA-seq looks like in the genome browser
Type chr7:5,567,000-5,570,000 into the location box. The gene there is ACTB,
a compact gene with deep read coverage.
The thin teal lines jumping across a gap are spliced alignments, where a read maps partly to one exon and partly to the next, skipping the intron between them.
Read coverage and read height
A deeply covered gene has more reads than the track shows at once. The histogram above the pileup counts the reads at each position, and Read height → Compact in the track menu packs the full stack into view:
Spliced reads, CIGAR strings, and splice arcs
A spliced aligner like STAR split-maps a read that crosses an intron and encodes the skip in its CIGAR string, the SAM/BAM field describing how a read aligns to the reference.
A spliced read in the ACTB pileup (reads here are 51 bp) has a CIGAR like this, spaced out for readability:
18M 95N 33MThe CIGAR reads as 18 bp (M, match) aligned to one exon, a 95 bp skip (N)
across the intron, and 33 bp (M) aligned to the next.
JBrowse computes the arcs on the fly from the skips in the reads in view, and colors each arc by transcript strand, salmon for forward and purple for reverse. It finds the strand two ways:
- Tags.
XSandTSrecord the strand directly. minimap2'stsis relative to the read, so JBrowse combines it with the strand the read aligned to. - Splice motif. A BAM from STAR without
--outSAMstrandField intronMotifhas no tags, so JBrowse reads the first and last two bases of the intron off the reference: GT-AG on the forward strand reads as CT-AC on the reverse. A junction whose reads disagree, or whose motif is none of GT-AG, GC-AG and AT-AC, draws in the neutral color. Hovering an arc shows the motif beside the read count.
Picking out spliced reads in a deep pileup
In the compact ACTB stack, reads with a skip sit among many more that have none. Three track-menu settings separate the splicing evidence from the rest.
Sort by → Spliced reads first gives every read whose CIGAR has a skip the lowest rows, so the junction-spanning reads sit together at the top of the pileup.
Filter by → Spliced reads → Only spliced reads sets a filter that drops
every read without a skip from the pileup, leaving the junction-spanning
evidence alone. The coverage histogram still counts every read. Hide spliced
reads in the same submenu is the complement.
Filter by → Non-canonical junctions → Hide non-canonical junctions drops every arc whose intron does not begin and end with GT-AG, GC-AG or AT-AC on either strand. Raising Min reads at a junction in Filter by → More filters... also drops thin arcs, along with any real junction few reads support.
Long-read splicing: IsoSeq over ACTB
A short read crosses at most one or two junctions, so the arcs alone do not show
which exons sit together in one transcript. A long read (PacBio IsoSeq,
Nanopore) often spans a whole transcript, aligning across every exon with one
N skip per intron, and JBrowse draws the same arcs and connectors from those
skips. The IsoSeq alignments are a second BAM on the same assembly:
Goes in the tracks array of config.json. See Tracks.
{
"trackId": "alzheimers_isoseq",
"name": "IsoSeq high-quality isoforms",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/alzheimers_isoseq/hq_isoforms.fasta.bam",
"assemblyNames": ["hg19"]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://s3.amazonaws.com/jbrowse.org/genomes/hg19/alzheimers_isoseq/hq_isoforms.fasta.bam \
--trackId alzheimers_isoseq \
--name "IsoSeq high-quality isoforms" \
--assemblyNames hg19In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track... and, in Add a track from file or URL, enter:
- Main file:
https://s3.amazonaws.com/jbrowse.org/genomes/hg19/alzheimers_isoseq/hq_isoforms.fasta.bam
JBrowse reads the adapter and track type off the file name. Then fill in:
- Track name:
IsoSeq high-quality isoforms - Assembly:
hg19
Click Add.
Open this track in JBrowse Web ↗
Needs JBrowse Desktop 5.0 or newer. If nothing opens, copy the link and paste it into Desktop's Open JBrowse Web link..., on the start screen or under File → Session.
https://jbrowse.org/code/jb2/main/?config=https%3A%2F%2Fjbrowse.org%2Fucsc%2Fhg19%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22trackId%22%3A%22alzheimers_isoseq%22%2C%22name%22%3A%22IsoSeq+high-quality+isoforms%22%2C%22uri%22%3A%22https%3A%2F%2Fs3.amazonaws.com%2Fjbrowse.org%2Fgenomes%2Fhg19%2Falzheimers_isoseq%2Fhq_isoforms.fasta.bam%22%2C%22assemblyNames%22%3A%5B%22hg19%22%5D%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chr7%3A5%2C567%2C000-5%2C570%2C000%22%2C%22tracks%22%3A%5B%22alzheimers_isoseq%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+IsoSeq+high-quality+isoformsThis view in a notebook, with jbrowse-anywidget. Swap a track's uri for your file.
from jbrowse_anywidget import JBrowseApp, fetch_hub
config = fetch_hub("https://jbrowse.org/ucsc/hg19/config.json")
app = JBrowseApp(
assemblies=config["assemblies"],
tracks=config.get("tracks", []) + [
{
"trackId": "alzheimers_isoseq",
"name": "IsoSeq high-quality isoforms",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/alzheimers_isoseq/hq_isoforms.fasta.bam",
"assemblyNames": [
"hg19"
]
}
],
views=[
{
"type": "LinearGenomeView",
"assembly": "hg19",
"loc": "chr7:5,567,000-5,570,000",
"tracks": [
"alzheimers_isoseq"
]
}
],
)
app # display the widgetThis view in your React 19 app, with @jbrowse/react-app2 and @jbrowse/core. Add your own files to tracks.
import { use } from 'react'
import { JBrowse } from '@jbrowse/react-app2'
import '@jbrowse/react-app2/styles.css'
import { addRelativeUris } from '@jbrowse/core/util/addRelativeUris'
const configUrl = "https://jbrowse.org/ucsc/hg19/config.json"
const configPromise = fetch(configUrl)
.then(res => res.json())
.then(config => {
addRelativeUris(config, new URL(configUrl))
return config
})
export default function Figure() {
const config = use(configPromise)
return (
<JBrowse
assemblies={config.assemblies}
tracks={[...(config.tracks ?? []), ...[
{
"trackId": "alzheimers_isoseq",
"name": "IsoSeq high-quality isoforms",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/alzheimers_isoseq/hq_isoforms.fasta.bam",
"assemblyNames": [
"hg19"
]
}
]]}
aggregateTextSearchAdapters={config.aggregateTextSearchAdapters}
configuration={config.configuration}
views={[
{
"type": "LinearGenomeView",
"assembly": "hg19",
"loc": "chr7:5,567,000-5,570,000",
"tracks": [
"alzheimers_isoseq"
]
}
]}
/>
)
}jbrowse-img draws this view as an SVG, no browser needed. Swap --config or a track for your own.
cat > tracks.json <<'JSON'
[
{
"trackId": "alzheimers_isoseq",
"name": "IsoSeq high-quality isoforms",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/hg19/alzheimers_isoseq/hq_isoforms.fasta.bam",
"assemblyNames": [
"hg19"
]
}
]
JSON
npx @jbrowse/img --config https://jbrowse.org/ucsc/hg19/config.json \
--trackConfigs tracks.json \
--assembly hg19 --loc chr7:5,567,000-5,570,000 \
--track alzheimers_isoseq \
--out figure.svgFor a PNG, --out figure.png (needs rsvg-convert: apt install librsvg2-bin, brew install librsvg).
Strand-specific RNA-seq
The arc colors give the transcript strand of the spliced reads, and an unspliced read has none. A strand-specific library records the transcript strand in which mate of the pair a read is, so every read has a strand, which separates genes close together or overlapping on opposite strands.
The surfeit locus is a tight cluster of genes on alternating strands (RPL7A,
SURF1, SURF2, SURF4). Type chr9:136,214,000-136,229,000 into the
location box, then pick this path from the track menu:
Color by → First-of-pair strand
The color marks each read's strand. To compare the strands over a whole gene,
Group by → First-of-pair strand applies a facet, one section per strand,
each with a coverage histogram drawn from that section's reads, forward and
reverse on one autoscaled axis. Show → Show pileup, unticked, hides the
reads and leaves the two histograms.
On chr6, NELFE and SKIV2L sit back to back on opposite strands. Type
chr6:31,920,500-31,933,000 into the location box:
Circular RNA: back-splice junctions
Every junction so far joins an exon to a downstream one. A circular RNA joins
the end of an exon back to the start of an upstream one. A short read across
that joint aligns in two pieces, and the aligner writes the second piece into
the read's SA tag. The junctions band counts split-read junctions beside the
N-gap splices, one arc per junction, and colors each by its class. A back-splice
is a duplication-type split, drawn in the teal JBrowse uses for an RL pair
(mates pointing away from each other). Split-read junctions → Hide split-read
junctions in Filter by → More filters... turns them off.
STAR writes those SA tags only in chimeric mode. With its defaults it
soft-clips the joint, and no back-splice arc appears:
# WithinBAM writes each chimeric piece as a supplementary record with an SA tag;
# Junctions also writes Chimeric.out.junction, STAR's own back-splice table
# chimSegmentMin: the shortest piece of a read that counts as its own segment
STAR --genomeDir star_index --readFilesIn r1.fq.gz r2.fq.gz \
--readFilesCommand gzip -dc --outSAMtype BAM SortedByCoordinate \
--chimOutType WithinBAM SoftClip Junctions \
--chimSegmentMin 15 --chimJunctionOverhangMin 15STAR's Chimeric.out.junction lists every chimeric read. A back-splice is a row
on one chromosome and strand whose acceptor lies upstream of its donor. Columns
2 and 5 give the intron base beside the junction on the donor and acceptor
sides, so on the plus strand the circle runs from one base after column 5 to one
base before column 2, and the minus strand mirrors that. This counts distinct
reads per back-splice and keeps those with at least two:
awk -F'\t' -v OFS='\t' '$1 !~ /^#/ && $1 == $4 && $3 == $6 && $7 >= 0 &&
(($3 == "+" && $5 < $2) || ($3 == "-" && $5 > $2)) {
# 1-based intron bases to the circle as a 0-based half-open BED interval
s = $3 == "+" ? $5 : $2
e = $3 == "+" ? $2 - 1 : $5 - 1
k = $1 OFS s OFS e
# column 10 is the read name: a read counts once however many rows it has
if (!((k, $10) in seen)) { seen[k, $10] = 1; n[k]++ }
}
END { for (k in n) if (n[k] >= 2) print k, n[k] " reads", n[k], "." }' \
Chimeric.out.junction | sort -k1,1 -k2,2n | bgzip > backsplice.bed.gz
tabix -p bed backsplice.bed.gzThe circRNA demo holds HeLa RNA-seq treated with RNase R, which digests linear RNA and leaves the circles, aligned that way on hg38, and STAR's own back-splice table beside it. The reads load as an alignments track with junction read counts shown:
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "hela_rnaser_reads",
"name": "HeLa RNase R+ RNA-seq (SRR1636985)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR1636985.slice.bam",
"displayDefaults": {
"height": 300,
"junctions": { "labels": { "show": true } },
"filter": [{ "field": "mapq", "gte": 1 }]
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://jbrowse.org/demos/circrna/SRR1636985.slice.bam \
--trackId hela_rnaser_reads \
--name "HeLa RNase R+ RNA-seq (SRR1636985)" \
--assemblyNames hg38 \
--displayDefaults '{"height":300,"junctions":{"labels":{"show":true}},"filter":[{"field":"mapq","gte":1}]}'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": "hela_rnaser_reads",
"name": "HeLa RNase R+ RNA-seq (SRR1636985)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR1636985.slice.bam",
"displayDefaults": {
"height": 300,
"junctions": { "labels": { "show": true } },
"filter": [{ "field": "mapq", "gte": 1 }]
}
}The back-splice table is a BED of junctions, drawn as arcs whose width scales with the read count:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "hela_rnaser_backsplice",
"name": "HeLa RNase R+ back-splice junctions (STAR chimeric)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR1636985.backsplice.bed.gz",
"displays": [
{
"type": "LinearMarkDisplay",
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": { "type": "log", "range": [1, 8] }
}
}
},
{ "mark": "text", "encoding": { "text": "score" }, "maxBpPerPx": 50 }
]
}
]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "hela_rnaser_backsplice",
"name": "HeLa RNase R+ back-splice junctions (STAR chimeric)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR1636985.backsplice.bed.gz",
"displays": [
{
"type": "LinearMarkDisplay",
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": { "type": "log", "range": [1, 8] }
}
}
},
{ "mark": "text", "encoding": { "text": "score" }, "maxBpPerPx": 50 }
]
}
]
}'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": "hela_rnaser_backsplice",
"name": "HeLa RNase R+ back-splice junctions (STAR chimeric)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR1636985.backsplice.bed.gz",
"displays": [
{
"type": "LinearMarkDisplay",
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": { "type": "log", "range": [1, 8] }
}
}
},
{ "mark": "text", "encoding": { "text": "score" }, "maxBpPerPx": 50 }
]
}
]
}At ZKSCAN1 the circle spans two exons:
RNase R digests linear RNA and leaves the circles, so a circle's back-splice should hold up against the linear splices into and out of its exons. The same HeLa RNA left untreated is the control:
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "hela_control_reads",
"name": "HeLa ribominus RNA-seq, no RNase R (SRR1637089)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR1637089.slice.bam",
"displayDefaults": {
"height": 300,
"junctions": { "labels": { "show": true } },
"filter": [{ "field": "mapq", "gte": 1 }]
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://jbrowse.org/demos/circrna/SRR1637089.slice.bam \
--trackId hela_control_reads \
--name "HeLa ribominus RNA-seq, no RNase R (SRR1637089)" \
--assemblyNames hg38 \
--displayDefaults '{"height":300,"junctions":{"labels":{"show":true}},"filter":[{"field":"mapq","gte":1}]}'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": "hela_control_reads",
"name": "HeLa ribominus RNA-seq, no RNase R (SRR1637089)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR1637089.slice.bam",
"displayDefaults": {
"height": 300,
"junctions": { "labels": { "show": true } },
"filter": [{ "field": "mapq", "gte": 1 }]
}
}In the control the long red arcs joining ZKSCAN1's circle exons to the rest of the gene carry more reads than the teal back-splice. In the treated reads they all but vanish, while the back-splice and the splice between the circle's two exons stay:
A nanopore read of a circle can run around it several times, and the aligner
writes each lap as its own piece. isoCirc enriches circles and copies each one
round and round by rolling-circle amplification, so its reads are long runs of
laps. The demo holds HEK293 isoCirc reads aligned with minimap2 -ax splice:
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "hek293_isocirc_reads",
"name": "HEK293 isoCirc nanopore reads (SRR10612055)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR10612055.slice.bam",
"displayDefaults": {
"height": 300,
"junctions": { "labels": { "show": true } }
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://jbrowse.org/demos/circrna/SRR10612055.slice.bam \
--trackId hek293_isocirc_reads \
--name "HEK293 isoCirc nanopore reads (SRR10612055)" \
--assemblyNames hg38 \
--displayDefaults '{"height":300,"junctions":{"labels":{"show":true}}}'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": "hek293_isocirc_reads",
"name": "HEK293 isoCirc nanopore reads (SRR10612055)",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/circrna/SRR10612055.slice.bam",
"displayDefaults": {
"height": 300,
"junctions": { "labels": { "show": true } }
}
}CDR1as is a single-exon circle antisense to CDR1. The junctions band counts every lap of every read as a crossing of the back-splice, and the pileup shows the pieces of each read stacked over the one exon:
Loading STAR, regtools and portcullis junction tables
The junction arcs on a reads track count the reads in view. A junction table
from an RNA-seq pipeline adds whole-library read counts, an annotated-or-novel
flag and portcullis's filtering verdict. One awk line converts each table to
BED, with the intron as the interval, the read count as the score, then the
strand and the tool's own columns, and the BED draws as arcs on a feature track.
Sort and index all three the same way:
sort -k1,1 -k2,2n junctions.bed | bgzip > junctions.bed.gz
tabix -C -p bed junctions.bed.gzSTAR writes SJ.out.tab with the intron as 1-based inclusive coordinates,
then the strand, the motif as a STAR code (0 is non-canonical), the annotated
flag and the unique and multi-mapping read counts:
awk -v OFS='\t' '{
# column 4: 1 = +, 2 = -, 0 = undetermined
s = $4 == 1 ? "+" : $4 == 2 ? "-" : "."
# BED is 0-based half-open, so the start moves back one
print $1, $2 - 1, $3, "junc" NR, $7, s, $5, $6
}' SJ.out.tab > junctions.bedregtools reads the junctions straight out of the BAM, then annotates each
against a GTF with its splice-site motif and whether an annotated transcript
joins that donor to that acceptor. The annotated table has a header row and
gives the last base of one exon and the first base of the next, so the intron
ends one base before end:
# -s FR: a stranded library whose first read runs along the transcript;
# RF for a dUTP library
regtools junctions extract -s FR rnaseq.bam -o regtools.bed
# annotate reads a plain GTF, not a gzipped one
regtools junctions annotate regtools.bed genome.fa genes.gtf -o annotated.tsv
# column 7 is the motif, column 14 the known-junction flag
awk -F'\t' -v OFS='\t' 'NR > 1 { print $1, $2, $3 - 1, $4, $5, $6, $7, $14 }' \
annotated.tsv > junctions.bedportcullis writes a header row naming its columns, so the recipe reads them
by name. nb_raw_aln is the raw supporting-read count, canonical_ss is C,
S or N for canonical, semi-canonical and non-canonical:
awk -F'\t' -v OFS='\t' '
NR == 1 { for (i = 1; i <= NF; i++) c[$i] = i; next }
{
# start is 0-based and end is inclusive, so end moves forward one
print $c["refname"], $c["start"], $c["end"] + 1, "junc_" $c["index"],
$c["nb_raw_aln"], $c["consensus-strand"], $c["canonical_ss"]
}
' 3-filt/portcullis_filtered.pass.junctions.tab > junctions.bedThe config below loads the regtools file built from this page's BAM as a feature
track. In grammar-of-graphics terms, the
link mark is the shape drawn for each junction, strokeWidth scales with read
count, color is a color scale on the known-junction flag against RefSeq, and
filter drops records. columnNames names the extra columns so the color scale
can read them:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "rnaseq_junctions_hg19",
"name": "Splice junctions (regtools)",
"category": ["RNA-seq"],
"assemblyNames": ["hg19"],
"adapter": {
"type": "BedTabixAdapter",
"uri": "https://jbrowse.org/demos/rnaseq/rnaseq_junctions.bed.gz",
"csi": true,
"columnNames": [
"chrom",
"chromStart",
"chromEnd",
"name",
"score",
"strand",
"splice_site",
"known_junction"
]
},
"displays": [
{
"type": "LinearMarkDisplay",
"displayId": "rnaseq_junctions_hg19-LinearMarkDisplay",
"transform": [
{
"type": "filter",
"expr": "jexl:feature.score >= 3 && feature.splice_site in ['GT-AG', 'GC-AG', 'AT-AC']"
}
],
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": { "type": "log", "range": [1, 8] }
},
"color": {
"field": "known_junction",
"scale": {
"type": "ordinal",
"domain": ["1", "0"],
"range": ["#377eb8", "#e41a1c"],
"names": ["annotated", "novel"]
},
"legend": { "title": "RefSeq" }
}
}
},
{ "mark": "text", "encoding": { "text": "score" }, "maxBpPerPx": 50 }
]
}
]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "rnaseq_junctions_hg19",
"name": "Splice junctions (regtools)",
"category": ["RNA-seq"],
"assemblyNames": ["hg19"],
"adapter": {
"type": "BedTabixAdapter",
"uri": "https://jbrowse.org/demos/rnaseq/rnaseq_junctions.bed.gz",
"csi": true,
"columnNames": [
"chrom",
"chromStart",
"chromEnd",
"name",
"score",
"strand",
"splice_site",
"known_junction"
]
},
"displays": [
{
"type": "LinearMarkDisplay",
"displayId": "rnaseq_junctions_hg19-LinearMarkDisplay",
"transform": [
{
"type": "filter",
"expr": "jexl:feature.score >= 3 && feature.splice_site in ['\''GT-AG'\'', '\''GC-AG'\'', '\''AT-AC'\'']"
}
],
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": { "type": "log", "range": [1, 8] }
},
"color": {
"field": "known_junction",
"scale": {
"type": "ordinal",
"domain": ["1", "0"],
"range": ["#377eb8", "#e41a1c"],
"names": ["annotated", "novel"]
},
"legend": { "title": "RefSeq" }
}
}
},
{ "mark": "text", "encoding": { "text": "score" }, "maxBpPerPx": 50 }
]
}
]
}'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": "rnaseq_junctions_hg19",
"name": "Splice junctions (regtools)",
"category": ["RNA-seq"],
"assemblyNames": ["hg19"],
"adapter": {
"type": "BedTabixAdapter",
"uri": "https://jbrowse.org/demos/rnaseq/rnaseq_junctions.bed.gz",
"csi": true,
"columnNames": [
"chrom",
"chromStart",
"chromEnd",
"name",
"score",
"strand",
"splice_site",
"known_junction"
]
},
"displays": [
{
"type": "LinearMarkDisplay",
"displayId": "rnaseq_junctions_hg19-LinearMarkDisplay",
"transform": [
{
"type": "filter",
"expr": "jexl:feature.score >= 3 && feature.splice_site in ['GT-AG', 'GC-AG', 'AT-AC']"
}
],
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": { "type": "log", "range": [1, 8] }
},
"color": {
"field": "known_junction",
"scale": {
"type": "ordinal",
"domain": ["1", "0"],
"range": ["#377eb8", "#e41a1c"],
"names": ["annotated", "novel"]
},
"legend": { "title": "RefSeq" }
}
}
},
{ "mark": "text", "encoding": { "text": "score" }, "maxBpPerPx": 50 }
]
}
]
}Open this track in JBrowse Web ↗
Needs JBrowse Desktop 5.0 or newer. If nothing opens, copy the link and paste it into Desktop's Open JBrowse Web link..., on the start screen or under File → Session.
https://jbrowse.org/code/jb2/main/?config=https%3A%2F%2Fjbrowse.org%2Fucsc%2Fhg19%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22type%22%3A%22FeatureTrack%22%2C%22trackId%22%3A%22rnaseq_junctions_hg19%22%2C%22name%22%3A%22Splice+junctions+%28regtools%29%22%2C%22category%22%3A%5B%22RNA-seq%22%5D%2C%22assemblyNames%22%3A%5B%22hg19%22%5D%2C%22adapter%22%3A%7B%22type%22%3A%22BedTabixAdapter%22%2C%22uri%22%3A%22https%3A%2F%2Fjbrowse.org%2Fdemos%2Frnaseq%2Frnaseq_junctions.bed.gz%22%2C%22csi%22%3Atrue%2C%22columnNames%22%3A%5B%22chrom%22%2C%22chromStart%22%2C%22chromEnd%22%2C%22name%22%2C%22score%22%2C%22strand%22%2C%22splice_site%22%2C%22known_junction%22%5D%7D%2C%22displays%22%3A%5B%7B%22type%22%3A%22LinearMarkDisplay%22%2C%22displayId%22%3A%22rnaseq_junctions_hg19-LinearMarkDisplay%22%2C%22transform%22%3A%5B%7B%22type%22%3A%22filter%22%2C%22expr%22%3A%22jexl%3Afeature.score+%3E%3D+3+%26%26+feature.splice_site+in+%5B%27GT-AG%27%2C+%27GC-AG%27%2C+%27AT-AC%27%5D%22%7D%5D%2C%22marks%22%3A%5B%7B%22mark%22%3A%22link%22%2C%22encoding%22%3A%7B%22strokeWidth%22%3A%7B%22field%22%3A%22score%22%2C%22scale%22%3A%7B%22type%22%3A%22log%22%2C%22range%22%3A%5B1%2C8%5D%7D%7D%2C%22color%22%3A%7B%22field%22%3A%22known_junction%22%2C%22scale%22%3A%7B%22type%22%3A%22ordinal%22%2C%22domain%22%3A%5B%221%22%2C%220%22%5D%2C%22range%22%3A%5B%22%23377eb8%22%2C%22%23e41a1c%22%5D%2C%22names%22%3A%5B%22annotated%22%2C%22novel%22%5D%7D%2C%22legend%22%3A%7B%22title%22%3A%22RefSeq%22%7D%7D%7D%7D%2C%7B%22mark%22%3A%22text%22%2C%22encoding%22%3A%7B%22text%22%3A%22score%22%7D%2C%22maxBpPerPx%22%3A50%7D%5D%7D%5D%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chr11%3A49%2C220%2C500-49%2C231%2C500%22%2C%22tracks%22%3A%5B%22rnaseq_junctions_hg19%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+Splice+junctions+%28regtools%29This view in a notebook, with jbrowse-anywidget. Swap a track's uri for your file.
from jbrowse_anywidget import JBrowseApp, fetch_hub
config = fetch_hub("https://jbrowse.org/ucsc/hg19/config.json")
app = JBrowseApp(
assemblies=config["assemblies"],
tracks=config.get("tracks", []) + [
{
"type": "FeatureTrack",
"trackId": "rnaseq_junctions_hg19",
"name": "Splice junctions (regtools)",
"category": [
"RNA-seq"
],
"assemblyNames": [
"hg19"
],
"adapter": {
"type": "BedTabixAdapter",
"uri": "https://jbrowse.org/demos/rnaseq/rnaseq_junctions.bed.gz",
"csi": True,
"columnNames": [
"chrom",
"chromStart",
"chromEnd",
"name",
"score",
"strand",
"splice_site",
"known_junction"
]
},
"displays": [
{
"type": "LinearMarkDisplay",
"displayId": "rnaseq_junctions_hg19-LinearMarkDisplay",
"transform": [
{
"type": "filter",
"expr": "jexl:feature.score >= 3 && feature.splice_site in ['GT-AG', 'GC-AG', 'AT-AC']"
}
],
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": {
"type": "log",
"range": [
1,
8
]
}
},
"color": {
"field": "known_junction",
"scale": {
"type": "ordinal",
"domain": [
"1",
"0"
],
"range": [
"#377eb8",
"#e41a1c"
],
"names": [
"annotated",
"novel"
]
},
"legend": {
"title": "RefSeq"
}
}
}
},
{
"mark": "text",
"encoding": {
"text": "score"
},
"maxBpPerPx": 50
}
]
}
]
}
],
views=[
{
"type": "LinearGenomeView",
"assembly": "hg19",
"loc": "chr11:49,220,500-49,231,500",
"tracks": [
"rnaseq_junctions_hg19"
]
}
],
)
app # display the widgetThis view in your React 19 app, with @jbrowse/react-app2 and @jbrowse/core. Add your own files to tracks.
import { use } from 'react'
import { JBrowse } from '@jbrowse/react-app2'
import '@jbrowse/react-app2/styles.css'
import { addRelativeUris } from '@jbrowse/core/util/addRelativeUris'
const configUrl = "https://jbrowse.org/ucsc/hg19/config.json"
const configPromise = fetch(configUrl)
.then(res => res.json())
.then(config => {
addRelativeUris(config, new URL(configUrl))
return config
})
export default function Figure() {
const config = use(configPromise)
return (
<JBrowse
assemblies={config.assemblies}
tracks={[...(config.tracks ?? []), ...[
{
"type": "FeatureTrack",
"trackId": "rnaseq_junctions_hg19",
"name": "Splice junctions (regtools)",
"category": [
"RNA-seq"
],
"assemblyNames": [
"hg19"
],
"adapter": {
"type": "BedTabixAdapter",
"uri": "https://jbrowse.org/demos/rnaseq/rnaseq_junctions.bed.gz",
"csi": true,
"columnNames": [
"chrom",
"chromStart",
"chromEnd",
"name",
"score",
"strand",
"splice_site",
"known_junction"
]
},
"displays": [
{
"type": "LinearMarkDisplay",
"displayId": "rnaseq_junctions_hg19-LinearMarkDisplay",
"transform": [
{
"type": "filter",
"expr": "jexl:feature.score >= 3 && feature.splice_site in ['GT-AG', 'GC-AG', 'AT-AC']"
}
],
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": {
"type": "log",
"range": [
1,
8
]
}
},
"color": {
"field": "known_junction",
"scale": {
"type": "ordinal",
"domain": [
"1",
"0"
],
"range": [
"#377eb8",
"#e41a1c"
],
"names": [
"annotated",
"novel"
]
},
"legend": {
"title": "RefSeq"
}
}
}
},
{
"mark": "text",
"encoding": {
"text": "score"
},
"maxBpPerPx": 50
}
]
}
]
}
]]}
aggregateTextSearchAdapters={config.aggregateTextSearchAdapters}
configuration={config.configuration}
views={[
{
"type": "LinearGenomeView",
"assembly": "hg19",
"loc": "chr11:49,220,500-49,231,500",
"tracks": [
"rnaseq_junctions_hg19"
]
}
]}
/>
)
}jbrowse-img draws this view as an SVG, no browser needed. Swap --config or a track for your own.
cat > tracks.json <<'JSON'
[
{
"type": "FeatureTrack",
"trackId": "rnaseq_junctions_hg19",
"name": "Splice junctions (regtools)",
"category": [
"RNA-seq"
],
"assemblyNames": [
"hg19"
],
"adapter": {
"type": "BedTabixAdapter",
"uri": "https://jbrowse.org/demos/rnaseq/rnaseq_junctions.bed.gz",
"csi": true,
"columnNames": [
"chrom",
"chromStart",
"chromEnd",
"name",
"score",
"strand",
"splice_site",
"known_junction"
]
},
"displays": [
{
"type": "LinearMarkDisplay",
"displayId": "rnaseq_junctions_hg19-LinearMarkDisplay",
"transform": [
{
"type": "filter",
"expr": "jexl:feature.score >= 3 && feature.splice_site in ['GT-AG', 'GC-AG', 'AT-AC']"
}
],
"marks": [
{
"mark": "link",
"encoding": {
"strokeWidth": {
"field": "score",
"scale": {
"type": "log",
"range": [
1,
8
]
}
},
"color": {
"field": "known_junction",
"scale": {
"type": "ordinal",
"domain": [
"1",
"0"
],
"range": [
"#377eb8",
"#e41a1c"
],
"names": [
"annotated",
"novel"
]
},
"legend": {
"title": "RefSeq"
}
}
}
},
{
"mark": "text",
"encoding": {
"text": "score"
},
"maxBpPerPx": 50
}
]
}
]
}
]
JSON
npx @jbrowse/img --config https://jbrowse.org/ucsc/hg19/config.json \
--trackConfigs tracks.json \
--assembly hg19 --loc chr11:49,220,500-49,231,500 \
--track rnaseq_junctions_hg19 \
--out figure.svgFor a PNG, --out figure.png (needs rsvg-convert: apt install librsvg2-bin, brew install librsvg).
The filter applies the junctions menu's read-support floor to the
whole-library counts in the file and keeps the canonical motifs, which drops the
duplicate that wrong-strand reads give a junction on the opposite strand. The
color's scale.domain lists the known_junction values as strings because the
adapter reads extra columns as text.
Advanced → Edit plot... in the track menu edits the same marks, colors and filter on an open track.
Type chr11:49,220,500-49,231,500 into the location box, the 5' end of FOLH1,
where the track colors the junctions RefSeq annotates apart from the ones only
this library has:
To load the other tables:
- For the STAR file, the
columnNamesend inmotifandannotated, the color'sfieldisannotated, and thefilter'sexprisjexl:feature.score >= 3 && feature.motif != '0'. - For the portcullis file, the
columnNamesend instrandandcanonical_ss, the color'sfieldiscanonical_ss, itsscale.domain["C", "S", "N"], and itsscale.namescanonical, semi-canonical and non-canonical, with a third color inscale.range. Thefilter'sexprisjexl:feature.score >= 3 && feature.canonical_ss != 'N'.
The filter reads column names, and a name the file lacks reads as nothing, so
the config's splice_site test would hide every junction in either file.
See also
- Tutorial: Differential transcript usage
- Tutorial: Single-cell RNA and ATAC pseudobulk
- Tutorial: Methylation (long-read)
- Tutorial: Reviewing a gene prediction (Tiberius)
- Tutorial: AlphaGenome predictions
- User guide: Alignments track
- User guide: Quantitative track
- User guide: Gene track
- Docs: jbrowse-anywidget
Feedback on this tutorial is welcome: contact us.