Structural variants (1000 Genomes)
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.
A structural variant (SV) callset for a cohort gives every person a genotype at every call, and each genotype is based on that person's reads. We take one call from the 1000 Genomes ensemble SV callset, a deletion spanning the whole of RHD, the RhD blood group gene, whose loss is the usual cause of the RhD-negative blood type. The call is common enough to fill all three genotype classes, which read depth separates into two copies of the gene, one, or none. A complex call in sample HG02768 on the same chromosome follows. We:
- load the callset as a multi-sample variant track, with a sample's CRAM and a copy-number Zarr store
- sort the rows by genotype from the deletion's right-click menu
- open three samples' reads at RHD and share one coverage axis between them
- split HG02768's reads into SV channels at the complex call
Prerequisites
- a JBrowse instance to add tracks to (see the web quickstart or the desktop quickstart)
- a multi-sample SV VCF, bgzip-compressed and tabix-indexed, with a
.tbior.csibeside it - CRAMs aligned to the same assembly, each with its
.craibeside it
The data
The page reads the 1000 Genomes 2022 high-coverage ensemble SV callset (Byrska-Bishop et al., 2022) against CRAMs from three of the cohort's samples and QuicK-mer2 copy number for the whole cohort.
Nothing to download: the track configs below read these files by URL. Your own
VCF and CRAM swap in by uri, as Loading the callset, the reads and the
copy-number store shows.
Read by URL (no download needed)
| What it is | File |
|---|---|
| The ensemble SV callset, 3202 samples. EBI publishes it with no mirror, so the demo reads a byte-for-byte copy on jbrowse.org1 | 1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz |
| HG00113 (homozygous alt) high-coverage CRAM | HG00113.final.cram |
| HG00096 (heterozygous) high-coverage CRAM | HG00096.final.cram |
| HG00097 (homozygous reference) high-coverage CRAM | HG00097.final.cram |
| HG02768 high-coverage CRAM, for the complex call | HG02768.final.cram |
QuicK-mer2 copy number for the cohort, the store the copy-number tutorial also reads. A directory of chunks that 404s at its root, and the adapter takes it as its uri |
qm2_cn_1kb.zarr |
Loading the callset, the reads and the copy-number store
JBrowse decodes the CRAMs against the assembly's sequence, so it must be the GRCh38 sequence the reads were aligned to, with the chromosome names the VCF uses.
genomes.jbrowse.org hosts hg38, and this page's hg38 tracks attach to it by that name. The other tabs build the same assembly from its files.
- In JBrowse Desktop, click hg38 on the start screen, or launch
jbrowse-desktop --genome hg38. - On the web, open hg38 on genomes.jbrowse.org.
- In your own JBrowse Web,
jbrowse add-assembly --genome hg38adds it to theconfig.jsonin the current folder.
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "hg38",
"uri": "https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz",
"refNameAliases": {
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/hg38_aliases.txt"
},
"cytobands": "https://jbrowse.org/genomes/GRCh38/cytoBand.txt"
}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/GRCh38/fasta/hg38.prefix.fa.gz \
--name hg38 \
--refNameAliases https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/hg38_aliases.txt \
--config '{"cytobands":"https://jbrowse.org/genomes/GRCh38/cytoBand.txt"}'hg38 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/GRCh38/fasta/hg38.prefix.fa.gz
https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz.fai
https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz.gziJBrowse reads the format off the file name. Then fill in:
- Genome name:
hg38 - refName aliases (under More options):
https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/hg38_aliases.txt - cytobands (under More options):
https://jbrowse.org/genomes/GRCh38/cytoBand.txt
The figures also show NCBI's RefSeq genes as a track:
Goes in the tracks array of config.json. See Tracks.
{
"trackId": "ncbi_refseq_109_hg38",
"name": "NCBI RefSeq analysis set (GFF3Tabix)",
"uri": "https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/ncbi_refseq/GCA_000001405.15_GRCh38_full_analysis_set.refseq_annotation.sorted.gff.gz",
"assemblyNames": ["hg38"]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/ncbi_refseq/GCA_000001405.15_GRCh38_full_analysis_set.refseq_annotation.sorted.gff.gz \
--trackId ncbi_refseq_109_hg38 \
--name "NCBI RefSeq analysis set (GFF3Tabix)" \
--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://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/ncbi_refseq/GCA_000001405.15_GRCh38_full_analysis_set.refseq_annotation.sorted.gff.gz
JBrowse reads the adapter and track type off the file name. Then fill in:
- Track name:
NCBI RefSeq analysis set (GFF3Tabix) - Assembly:
hg38
Click Add.
We'll add the callset as a variant track. Swap uri for your own VCF, which
needs per-sample genotype columns and an index beside it:
Goes in the tracks array of config.json. See Tracks.
{
"type": "VariantTrack",
"trackId": "kgp_ensemble_sv",
"name": "1KGP ensemble SV calls, 3202 samples",
"assemblyNames": ["hg38"],
"uri": "https://jbrowse.org/demos/1000g/1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz"
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://jbrowse.org/demos/1000g/1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz \
--trackId kgp_ensemble_sv \
--name "1KGP ensemble SV calls, 3202 samples" \
--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://jbrowse.org/demos/1000g/1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz
JBrowse reads the adapter and track type off the file name. Then fill in:
- Track name:
1KGP ensemble SV calls, 3202 samples - Assembly:
hg38
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%2Fhg38%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22type%22%3A%22VariantTrack%22%2C%22trackId%22%3A%22kgp_ensemble_sv%22%2C%22name%22%3A%221KGP+ensemble+SV+calls%2C+3202+samples%22%2C%22assemblyNames%22%3A%5B%22hg38%22%5D%2C%22uri%22%3A%22https%3A%2F%2Fjbrowse.org%2Fdemos%2F1000g%2F1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz%22%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22hg38%22%2C%22loc%22%3A%22chr1%3A25%2C200%2C000-25%2C400%2C000%22%2C%22tracks%22%3A%5B%22kgp_ensemble_sv%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+1KGP+ensemble+SV+calls%2C+3202+samplesThis 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/hg38/config.json")
app = JBrowseApp(
assemblies=config["assemblies"],
tracks=config.get("tracks", []) + [
{
"type": "VariantTrack",
"trackId": "kgp_ensemble_sv",
"name": "1KGP ensemble SV calls, 3202 samples",
"assemblyNames": [
"hg38"
],
"uri": "https://jbrowse.org/demos/1000g/1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz"
}
],
views=[
{
"type": "LinearGenomeView",
"assembly": "hg38",
"loc": "chr1:25,200,000-25,400,000",
"tracks": [
"kgp_ensemble_sv"
]
}
],
)
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/hg38/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": "VariantTrack",
"trackId": "kgp_ensemble_sv",
"name": "1KGP ensemble SV calls, 3202 samples",
"assemblyNames": [
"hg38"
],
"uri": "https://jbrowse.org/demos/1000g/1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz"
}
]]}
aggregateTextSearchAdapters={config.aggregateTextSearchAdapters}
configuration={config.configuration}
views={[
{
"type": "LinearGenomeView",
"assembly": "hg38",
"loc": "chr1:25,200,000-25,400,000",
"tracks": [
"kgp_ensemble_sv"
]
}
]}
/>
)
}jbrowse-img draws this view as an SVG, no browser needed. Swap --config or a track for your own.
cat > tracks.json <<'JSON'
[
{
"type": "VariantTrack",
"trackId": "kgp_ensemble_sv",
"name": "1KGP ensemble SV calls, 3202 samples",
"assemblyNames": [
"hg38"
],
"uri": "https://jbrowse.org/demos/1000g/1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz"
}
]
JSON
npx @jbrowse/img --config https://jbrowse.org/ucsc/hg38/config.json \
--trackConfigs tracks.json \
--assembly hg38 --loc chr1:25,200,000-25,400,000 \
--track kgp_ensemble_sv \
--out figure.svgFor a PNG, --out figure.png (needs rsvg-convert: apt install librsvg2-bin, brew install librsvg).
One alignments track per sample comes next, here HG00113, the homozygous alt.
Swap uri for your own CRAM, with its .crai beside it. The other two samples
differ only in the file:
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "hg00113_cram",
"name": "HG00113 high coverage",
"assemblyNames": ["hg38"],
"uri": "https://1000genomes.s3.amazonaws.com/1000G_2504_high_coverage/data/ERR3240129/HG00113.final.cram"
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://1000genomes.s3.amazonaws.com/1000G_2504_high_coverage/data/ERR3240129/HG00113.final.cram \
--trackId hg00113_cram \
--name "HG00113 high coverage" \
--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://1000genomes.s3.amazonaws.com/1000G_2504_high_coverage/data/ERR3240129/HG00113.final.cram
JBrowse reads the adapter and track type off the file name. Then fill in:
- Track name:
HG00113 high coverage - Assembly:
hg38
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%2Fhg38%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22type%22%3A%22AlignmentsTrack%22%2C%22trackId%22%3A%22hg00113_cram%22%2C%22name%22%3A%22HG00113+high+coverage%22%2C%22assemblyNames%22%3A%5B%22hg38%22%5D%2C%22uri%22%3A%22https%3A%2F%2F1000genomes.s3.amazonaws.com%2F1000G_2504_high_coverage%2Fdata%2FERR3240129%2FHG00113.final.cram%22%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22hg38%22%2C%22loc%22%3A%22chr1%3A25%2C200%2C000-25%2C400%2C000%22%2C%22tracks%22%3A%5B%22hg00113_cram%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+HG00113+high+coverageThis 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/hg38/config.json")
app = JBrowseApp(
assemblies=config["assemblies"],
tracks=config.get("tracks", []) + [
{
"type": "AlignmentsTrack",
"trackId": "hg00113_cram",
"name": "HG00113 high coverage",
"assemblyNames": [
"hg38"
],
"uri": "https://1000genomes.s3.amazonaws.com/1000G_2504_high_coverage/data/ERR3240129/HG00113.final.cram"
}
],
views=[
{
"type": "LinearGenomeView",
"assembly": "hg38",
"loc": "chr1:25,200,000-25,400,000",
"tracks": [
"hg00113_cram"
]
}
],
)
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/hg38/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": "AlignmentsTrack",
"trackId": "hg00113_cram",
"name": "HG00113 high coverage",
"assemblyNames": [
"hg38"
],
"uri": "https://1000genomes.s3.amazonaws.com/1000G_2504_high_coverage/data/ERR3240129/HG00113.final.cram"
}
]]}
aggregateTextSearchAdapters={config.aggregateTextSearchAdapters}
configuration={config.configuration}
views={[
{
"type": "LinearGenomeView",
"assembly": "hg38",
"loc": "chr1:25,200,000-25,400,000",
"tracks": [
"hg00113_cram"
]
}
]}
/>
)
}jbrowse-img draws this view as an SVG, no browser needed. Swap --config or a track for your own.
cat > tracks.json <<'JSON'
[
{
"type": "AlignmentsTrack",
"trackId": "hg00113_cram",
"name": "HG00113 high coverage",
"assemblyNames": [
"hg38"
],
"uri": "https://1000genomes.s3.amazonaws.com/1000G_2504_high_coverage/data/ERR3240129/HG00113.final.cram"
}
]
JSON
npx @jbrowse/img --config https://jbrowse.org/ucsc/hg38/config.json \
--trackConfigs tracks.json \
--assembly hg38 --loc chr1:25,200,000-25,400,000 \
--track hg00113_cram \
--out figure.svgFor a PNG, --out figure.png (needs rsvg-convert: apt install librsvg2-bin, brew install librsvg).
The copy-number track reads the Zarr store through
jbrowse-plugin-zarr, which
the config names by its plugin store name:
{
"plugins": [{ "storePlugin": "Zarr" }]
}The track below reads the store, drawing one heatmap row per individual with white at two copies; the copy-number tutorial explains these settings and builds a store from your own BigWigs:
Goes in the tracks array of config.json. See Tracks.
{
"type": "MultiQuantitativeTrack",
"trackId": "cnv_1000g_zarr",
"name": "1000 Genomes copy number, 2504 individuals",
"assemblyNames": ["hg38"],
"adapter": {
"type": "MultiWiggleZarrAdapter",
"uri": "https://jbrowse.org/demos/1000g/qm2_cn_1kb.zarr"
},
"displayDefaults": {
"mark": "rect",
"origin": 2,
"encoding": {
"y": { "scale": { "domainMin": 0, "domainMax": 4 } },
"color": {
"scale": { "range": ["#2166ac", "#b2182b"] },
"legend": { "title": "Copy number" }
}
}
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "MultiQuantitativeTrack",
"trackId": "cnv_1000g_zarr",
"name": "1000 Genomes copy number, 2504 individuals",
"assemblyNames": ["hg38"],
"adapter": {
"type": "MultiWiggleZarrAdapter",
"uri": "https://jbrowse.org/demos/1000g/qm2_cn_1kb.zarr"
},
"displayDefaults": {
"mark": "rect",
"origin": 2,
"encoding": {
"y": { "scale": { "domainMin": 0, "domainMax": 4 } },
"color": {
"scale": { "range": ["#2166ac", "#b2182b"] },
"legend": { "title": "Copy number" }
}
}
}
}'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": "cnv_1000g_zarr",
"name": "1000 Genomes copy number, 2504 individuals",
"assemblyNames": ["hg38"],
"adapter": {
"type": "MultiWiggleZarrAdapter",
"uri": "https://jbrowse.org/demos/1000g/qm2_cn_1kb.zarr"
},
"displayDefaults": {
"mark": "rect",
"origin": 2,
"encoding": {
"y": { "scale": { "domainMin": 0, "domainMax": 4 } },
"color": {
"scale": { "range": ["#2166ac", "#b2182b"] },
"legend": { "title": "Copy number" }
}
}
}
}Sorting the cohort by genotype at the RHD deletion
Navigate to chr1:25,200,000-25,400,000. The callset track draws each sample as
a row at the variant's genomic span, so HGSV_1821, the RHD deletion, is a
wide block, and rows start in the callset's order:
- Click the deletion to open the feature details panel, whose SAMPLES section lists every sample's genotype, read depth and other fields.
- Right-click the deletion and pick Sort rows by genotype here to order rows by genotype at that call, then by how far each keeps matching its neighbours.
- Clustering → Cluster rows by genotype... in the track menu clusters rows by genotypes across the whole window instead, with a dendrogram.
In the genotype rows, dark blue is no copy of RHD, light blue one and grey
two. The olive stripe is HGSV_1823, a small copy-number record nested inside
the deletion. Most of the cohort has a no-call there in the callset (no genotype
reported), while QuicK-mer2 measures copy number per bin from the reads, so the
olive column is a red gain in the copy-number track.
A genotype cell marks some call at that position. The records band above the rows shows each call with its id, class and size, and Color by → SV type shows the class in the cells too, as the multi-variant track guide shows. The figure has two tracks over NCBI RefSeq genes:
- the callset, one row per sample sorted by genotype at the RHD deletion, under its records band with each call labelled by its id
- QuicK-mer2 copy number for every individual, one row each and clustered on this window, where blue is a copy lost against the diploid white and red is a copy gained
Checking the RHD genotypes against read coverage in three samples
Open three samples' alignments, one per genotype: HG00113 homozygous alt, HG00096 heterozygous, HG00097 homozygous reference. Two settings make them comparable:
- Turn the pileup off with Show → Show pileup in the track menu, since at this width the coverage curve shows the difference.
- Share one axis from Advanced → Coverage axis... → Share axis with, ticking the other two tracks, so the samples compare by height.
Coverage over the deleted span in the top row sits just above zero. The neighbouring gene RHCE, just right of RHD, is nearly identical, so some RHCE reads map to the empty RHD footprint.
Reading a complex call in HG02768 from read-pair orientation
A balanced rearrangement such as an inversion leaves coverage unchanged but changes read-pair orientation, meaning which strand each mate maps to. HG02768 has a complex call, an inversion with a duplicated copy, with coverage like the rest of its arm.
Put 1:39,658,200-39,661,800 in the location box and add HG02768's CRAM as a
track the same way as HG00113's.
Presets → SV channels in the track menu splits the reads into one band per kind of SV evidence, each with a separate coverage curve, its evidence reads and their arcs:
- The no-evidence band holds the flat coverage profile of the concordant pairs, with no reads drawn
- The inversion band draws two bundles of arcs, the same-strand pairs and split reads across each end of the inversion, green for one end and blue for the other
- No duplication-type band appears, since no pair here has mates facing away from each other as a tandem duplication would leave them
The call also lists a duplicated copy in INFO.CPX_INTERVALS. A copy inserted
beside its origin leaves pair orientation unchanged, so the bands do not show
it. That half of the call is based on coverage alone, and at this size the noise
in coverage makes bumps as wide as the duplication.
See also
- Tutorial: Low-mappability regions (SMN)
- Tutorial: Phased trio analysis (1000 Genomes)
- Tutorial: Structural variants (Dog10K)
- Tutorial: CNV across a population (1000 Genomes)
- Tutorial: Structural variants (Cancer GIAB) part 1: breakpoints
- User guide: SV inspector view
- User guide: SV visualization
- User guide: Variant sample rows
- User guide: Clustering rows
- Docs: jbrowse-anywidget
Notes
-
The file EBI publishes is at https://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data_collections/1000G_2504_high_coverage/working/20210124.SV_Illumina_Integration/1KGP_3202.Illumina_ensemble_callset.freeze_V1.vcf.gz and the jbrowse.org copy is byte-for-byte that. The CRAM urls above are the Registry of Open Data mirror of the same 1000 Genomes ftp tree, which answers a range request in a fraction of the time EBI takes. ↩
Feedback on this tutorial is welcome: contact us.