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.17. Desktop beta builds are coming soon.
Take the deletion of RHD, the RhD blood group gene, out of the 1000 Genomes ensemble SV callset. We:
- load the callset as a multi-sample variant track, with the reads and the copy-number store
- cluster the rows by genotype to sort the cohort at the deletion
- open three samples' reads on a shared coverage axis and compare their depth
- read a complex call from the same cohort by its read-pair orientation
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.
The files
| 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 |
The RHD deletion in the 1000 Genomes SV callset
HGSV_1821 is a deletion on chr1 spanning the whole of RHD, so samples called
homozygous have no copy of that gene. Deleting RHD is the most common cause of
the RhD-negative blood type. The call is PASS and common enough to fill all
three genotype classes, which read depth separates into two copies of the gene,
one, or none.
Loading the callset, the reads and the copy-number store
The CRAMs decode against the assembly's sequence, so it must be the GRCh38 sequence the reads were aligned to, with the chromosome names the VCF uses.
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"
}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 Show all available genomes and pick it. To load the files of this config instead:
In JBrowse Desktop, Open new 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
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"
}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
Click Next. 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+samplesOne 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"
}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
Click Next. 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+coverageThe copy-number track reads the Zarr store through jbrowse-plugin-zarr, which
is not yet in the plugin store. Add its hosted bundle to the config's plugins:
{
"plugins": [
{
"name": "Zarr",
"url": "https://jbrowse.org/demos/zarr/jbrowse-plugin-zarr.umd.production.min.js"
}
]
}The track below reads the store; the copy-number tutorial builds one 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": "span",
"origin": 2,
"encoding": {
"y": { "scale": { "domainMin": 0, "domainMax": 4 } },
"color": {
"scale": { "range": ["#2166ac", "#b2182b"] },
"legend": { "title": "Copy number" }
}
}
}
}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": "span",
"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": "span",
"origin": 2,
"encoding": {
"y": { "scale": { "domainMin": 0, "domainMax": 4 } },
"color": {
"scale": { "range": ["#2166ac", "#b2182b"] },
"legend": { "title": "Copy number" }
}
}
}
}Navigate to chr1:25,200,000-25,400,000, the genotype figure's window. In
grammar-of-graphics terms, the copy-number
track's mark is the shape drawn, encoding.y its y scale and encoding.color
a color scale on the score.
Sorting the cohort by genotype at the RHD deletion
Switch the callset track to Display types → Multi-sample variant display from the track menu. Each sample becomes a row drawn at the variant's genomic span, so the deletion is a wide block. Clicking it opens the feature details panel, whose SAMPLES section lists every sample's genotype, read depth and other fields.
Rows start in the callset's order. Right-click the deletion and pick Sort by genotype 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 instead clusters rows by genotypes across the whole window, with a dendrogram.
In the matrix, 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. The callset gives most of the cohort a no-call there (no genotype
reported), but QuicK-mer2 measures copy number per bin from the reads, so the
olive no-call column is a red gain in the copy-number track.
A matrix cell marks some call at that column. To see which call, load the same VCF again in the ordinary variant display, which draws each record on a separate row with its id, class and size, or color cells by SV type, as the multi-variant track guide shows.
The figure below has three tracks over NCBI RefSeq genes:
- the callset as a genotype matrix, one row per sample, sorted by genotype at the RHD deletion
- 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 a copy gained
- the same records in the ordinary variant display, each labelled with its id
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... → Pileup in the track menu, since at this width the coverage curve shows the difference.
- Share one axis from 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.
Read connections → SV channels (pairs by orientation) in the track menu splits the reads into one band per orientation class, each with a separate coverage curve and arcs:
- The normal-orientation band holds the flat coverage profile
- The two same-strand bands (both mates on one strand) each draw a bundle of arcs on one pair of breakpoints, the inversion signature
- The outward-pointing band (mates facing away from each other), where a tandem duplication would go, stays near empty
The call also lists a duplicated copy in INFO.CPX_INTERVALS, which no band
shows. A copy inserted beside its origin leaves pair orientation unchanged, so
that half of the call rests on coverage, where noise at this size 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: Multi-sample variant display
- 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.