Rearrangements between genomes by type (SyRI)
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.
The Columbia and Landsberg accessions of Arabidopsis thaliana differ by an inversion of more than a megabase on the short arm of chromosome 4, first seen under the microscope and later confirmed by assembling Landsberg. We find it again with SyRI, which sorts an alignment into syntenic, inverted, translocated and duplicated regions. We:
- align six assembled accessions, run SyRI on each pair, and merge the comparisons into one PAF whose ribbons take the color of the type SyRI assigns
- stack linear synteny views the way plotsr draws them
- draw the same accessions as lanes of a multi-way display under Columbia coordinates
Prerequisites
minimap2andsamtools- SyRI (
syri), from bioconda, or Docker, which runs its biocontainers image - The NCBI
datasetsCLI, to fetch the assemblies python3,bgzipandtabix- A running JBrowse instance (the web quickstart or the desktop quickstart)
# Debian/Ubuntu
sudo apt install samtools tabix minimap2
# or conda, which has every tool above
conda install -c bioconda -c conda-forge samtools htslib minimap2 \
ncbi-datasets-cli syri
# or Linux x86_64 binaries for the tools apt lacks
wget -P ~/.local/bin \
https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/v2/linux-amd64/datasets \
https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/v2/linux-amd64/dataformat
chmod +x ~/.local/bin/datasets ~/.local/bin/dataformatThe data
TAIR10 for Columbia, and the chromosome-level assemblies of five more accessions from Jiao and Schneeberger 2020, the first three the ones a figure in the plotsr paper stacks.
The tracks below read local files that the build script writes from these, so run it first, or run Aligning a pair and running SyRI on chromosome-level assemblies of your own whose homologous chromosomes share a name. The script fetches everything itself.
| What it is | File |
|---|---|
| Col-0, GCF_000001735.4 | GCF_000001735.4_TAIR10.1/ |
| Ler, GCA_902460285.1 | GCA_902460285.1_Arabidopsis_thaliana_Ler/ |
| Cvi-0, GCA_902460275.1 | GCA_902460275.1_Arabidopsis_thaliana_Cvi-0/ |
| Eri-1, GCA_902460315.1 | GCA_902460315.1_Arabidopsis_thaliana_Eri-1/ |
| Kyo, GCA_902460305.1 | GCA_902460305.1_Arabidopsis_thaliana_Kyo/ |
| Sha, GCA_902460295.1 | GCA_902460295.1_Arabidopsis_thaliana_Sha/ |
Aligning a pair and running SyRI
SyRI reads a whole-genome alignment of two chromosome-level assemblies whose homologous chromosomes share a name, which the script arranges. For each pair, the commands are:
# asm5 is the preset for genomes of one species
# --eqx writes = and X in the CIGAR, which SyRI reads the mismatches from
minimap2 -cx asm5 --eqx Col-0.fa Ler.fa >Col-0_Ler.aln.paf
# -F P says the alignment is PAF
# --nc runs that many chromosomes at once
syri -c Col-0_Ler.aln.paf -r Col-0.fa -q Ler.fa -F P --prefix Col-0_Ler. --nc 5In Col-0_Ler.syri.out, the structural regions are the rows with no parent:
SYN, INV, TRANS, INVTR, DUP and INVDP.
SyRI regions as one PAF
A SyRI region is an interval on each of two genomes, the same shape as a PAF
alignment record.
syri_to_paf.py
writes each region as one:
- Sequence names are
<genome>#1#<chrom>, so records from many pairs can share a file. - Inverted types go on the minus strand.
- Two tags hold the type (
syri) and the color plotsr gives that type (color). - Sequence lengths come from a
.chrom.sizesfile besidesyri.out, the first two columns of the FASTA index.
Concatenate the records from every pair into one file, which every view below uses:
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/syri_to_paf.py
for name in Col-0 Ler; do
samtools faidx $name.fa
cut -f1,2 $name.fa.fai >$name.chrom.sizes
done
python3 syri_to_paf.py Col-0_Ler.syri.out --reference Col-0 --query Ler
cat Col-0_*.paf Ler_Cvi.paf Cvi_Eri.paf Eri_Kyo.paf Kyo_Sha.paf >syri_pangenome.pafThe ribbons need no sequence, so each accession gets an assembly with a
ChromSizesAdapter over its .chrom.sizes. Col-0 is one; Ler, Cvi, Eri, Kyo
and Sha repeat it with their names and files:
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "Col-0",
"uri": "Col-0.chrom.sizes"
}jbrowse add-assembly Col-0.chrom.sizes \
--name Col-0 \
--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:
Col-0.chrom.sizesJBrowse reads the format off the file name. Then fill in:
- Genome name:
Col-0
Col-0.chrom.sizes is relative to a config.json. Replace it with its URL or its path on this computer.
Two entries in the track config matter here:
attributeColumnslists the PAF tags the palette button offers:syribecomes a color-by mode, andcoloris the color the file puts beside each type- the
MultiWaySyntenyDisplayentry sets up the lanes view:rows.sortorders the lanes, andribbons.encoding.coloris a color scale on the bands, mapping thesyrifield through ascale.domainof the six types
Goes in the tracks array of config.json. See Tracks.
{
"type": "SyntenyTrack",
"trackId": "syri_pangenome",
"name": "SyRI regions",
"assemblyNames": ["Col-0", "Ler", "Cvi", "Eri", "Kyo", "Sha"],
"adapter": {
"type": "MultiGenomePAFAdapter",
"uri": "syri_pangenome.paf",
"attributeColumns": ["syri", "color"]
},
"displays": [
{
"type": "MultiWaySyntenyDisplay",
"rows": { "sort": ["Ler", "Cvi", "Eri", "Kyo", "Sha"] },
"ribbons": {
"encoding": {
"color": {
"field": "syri",
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
}
}
}
}
]
}jbrowse add-track-json '{
"type": "SyntenyTrack",
"trackId": "syri_pangenome",
"name": "SyRI regions",
"assemblyNames": ["Col-0", "Ler", "Cvi", "Eri", "Kyo", "Sha"],
"adapter": {
"type": "MultiGenomePAFAdapter",
"uri": "syri_pangenome.paf",
"attributeColumns": ["syri", "color"]
},
"displays": [
{
"type": "MultiWaySyntenyDisplay",
"rows": { "sort": ["Ler", "Cvi", "Eri", "Kyo", "Sha"] },
"ribbons": {
"encoding": {
"color": {
"field": "syri",
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
}
}
}
}
]
}'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": "syri_pangenome",
"name": "SyRI regions",
"assemblyNames": ["Col-0", "Ler", "Cvi", "Eri", "Kyo", "Sha"],
"adapter": {
"type": "MultiGenomePAFAdapter",
"uri": "syri_pangenome.paf",
"attributeColumns": ["syri", "color"]
},
"displays": [
{
"type": "MultiWaySyntenyDisplay",
"rows": { "sort": ["Ler", "Cvi", "Eri", "Kyo", "Sha"] },
"ribbons": {
"encoding": {
"color": {
"field": "syri",
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
}
}
}
}
]
}syri_pangenome.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.
Columbia against Landsberg on chromosome 4
Open the first 6 Mb of chromosome 4 in both accessions and pick syri under Color by value on the palette button in the view header:
Goes at the top level of config.json, replacing any defaultSession there. See Default session.
{
"defaultSession": {
"name": "Col-0 vs Ler, chromosome 4",
"views": [
{
"type": "LinearSyntenyView",
"views": [
{ "assembly": "Col-0", "loc": "Chr4:1-6,000,000" },
{ "assembly": "Ler", "loc": "Chr4:1-6,000,000" }
],
"tracks": [["syri_pangenome"]],
"encoding": {
"color": {
"field": "syri",
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
},
"opacity": 0.9
},
"mark": { "interpolate": "bump" },
"render": { "antialias": false },
"collapseEmptyRows": true,
"levelHeights": [260]
}
]
}
}jbrowse set-default-session --session - << 'EOF'
{
"name": "Col-0 vs Ler, chromosome 4",
"views": [
{
"type": "LinearSyntenyView",
"views": [
{ "assembly": "Col-0", "loc": "Chr4:1-6,000,000" },
{ "assembly": "Ler", "loc": "Chr4:1-6,000,000" }
],
"tracks": [["syri_pangenome"]],
"encoding": {
"color": {
"field": "syri",
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
},
"opacity": 0.9
},
"mark": { "interpolate": "bump" },
"render": { "antialias": false },
"collapseEmptyRows": true,
"levelHeights": [260]
}
]
}
EOFThe thin ribbons leaving the frame are duplications and translocations whose
other end sits on another chromosome, which the label at the edge of the frame
names. The key has one row per color, so INVTR shares a row with TRANS and
INVDP with DUP.
Stacking the accessions, one SyRI run per band
The syri_pangenome track stacks all of them, each band drawing the SyRI run
between the two genomes it joins:
Goes at the top level of config.json, replacing any defaultSession there. See Default session.
{
"defaultSession": {
"name": "Six Arabidopsis accessions, SyRI regions",
"views": [
{
"type": "LinearSyntenyView",
"views": [
{ "assembly": "Col-0" },
{ "assembly": "Ler" },
{ "assembly": "Cvi" },
{ "assembly": "Eri" },
{ "assembly": "Kyo" },
{ "assembly": "Sha" }
],
"tracks": ["syri_pangenome"],
"encoding": {
"color": {
"field": "syri",
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
},
"opacity": 0.9
},
"mark": { "interpolate": "bump" },
"render": { "antialias": false },
"collapseEmptyRows": true,
"levelHeights": [150, 150, 150, 150, 150]
}
]
}
}jbrowse set-default-session --session - << 'EOF'
{
"name": "Six Arabidopsis accessions, SyRI regions",
"views": [
{
"type": "LinearSyntenyView",
"views": [
{ "assembly": "Col-0" },
{ "assembly": "Ler" },
{ "assembly": "Cvi" },
{ "assembly": "Eri" },
{ "assembly": "Kyo" },
{ "assembly": "Sha" }
],
"tracks": ["syri_pangenome"],
"encoding": {
"color": {
"field": "syri",
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
},
"opacity": 0.9
},
"mark": { "interpolate": "bump" },
"render": { "antialias": false },
"collapseEmptyRows": true,
"levelHeights": [150, 150, 150, 150, 150]
}
]
}
EOFEvery accession in Columbia coordinates
To compare every accession with Col-0 in Col-0 coordinates, syri_to_paf.py
also writes each pair's regions in reference coordinates, one BED row per
region. Each row's name is its type, its color comes from itemRgb, and a
query column holds the accession name. The rows against Col-0 concatenate into
one track:
{
head -n1 Col-0_Ler.regions.bed
for name in Ler Cvi Eri Kyo Sha; do
tail -n +2 Col-0_$name.regions.bed
done | sort -k1,1 -k2,2n
} | bgzip >syri_regions.bed.gz
tabix -p bed syri_regions.bed.gzIn grammar-of-graphics terms, rows assigns
one row per value of a field, here query, the accession, and rows.sort
orders them:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "syri_regions_on_Col-0",
"name": "SyRI regions on Col-0, by accession",
"assemblyNames": ["Col-0"],
"adapter": {
"type": "BedTabixAdapter",
"uri": "syri_regions.bed.gz",
"disableGeneHeuristic": true
},
"displays": [
{
"type": "LinearMultiRowFeatureDisplay",
"rows": {
"field": "query",
"sort": ["Ler", "Cvi", "Eri", "Kyo", "Sha"]
},
"encoding": {
"color": {
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
}
}
}
]
}jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "syri_regions_on_Col-0",
"name": "SyRI regions on Col-0, by accession",
"assemblyNames": ["Col-0"],
"adapter": {
"type": "BedTabixAdapter",
"uri": "syri_regions.bed.gz",
"disableGeneHeuristic": true
},
"displays": [
{
"type": "LinearMultiRowFeatureDisplay",
"rows": {
"field": "query",
"sort": ["Ler", "Cvi", "Eri", "Kyo", "Sha"]
},
"encoding": {
"color": {
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
}
}
}
]
}'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": "syri_regions_on_Col-0",
"name": "SyRI regions on Col-0, by accession",
"assemblyNames": ["Col-0"],
"adapter": {
"type": "BedTabixAdapter",
"uri": "syri_regions.bed.gz",
"disableGeneHeuristic": true
},
"displays": [
{
"type": "LinearMultiRowFeatureDisplay",
"rows": {
"field": "query",
"sort": ["Ler", "Cvi", "Eri", "Kyo", "Sha"]
},
"encoding": {
"color": {
"scale": {
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
}
}
}
}
]
}syri_regions.bed.gz is relative to a config.json. Replace it with its URL or its path on this computer.
We'll open a linear genome view on Col-0 at Chr4:1-6,000,000. Then:
- Turn on SyRI regions on Col-0, by accession and SyRI regions.
- Switch SyRI regions to Display types → Multi-way synteny display,
which takes its lanes and colors from the track's
MultiWaySyntenyDisplayentry.
Each accession is a lane, drawn in its assembly's coordinates and placed by the SyRI run against Col-0. The band between two lanes comes from the run between those two accessions, so it has the type SyRI gave that pair.
Goes at the top level of config.json, replacing any defaultSession there. See Default session.
{
"defaultSession": {
"name": "Six accessions in Col-0's coordinates",
"views": [
{
"type": "LinearGenomeView",
"assembly": "Col-0",
"loc": "Chr4:1-6,000,000",
"tracks": [
{
"trackId": "syri_regions_on_Col-0",
"type": "LinearMultiRowFeatureDisplay",
"height": 110
},
{
"trackId": "syri_pangenome",
"type": "MultiWaySyntenyDisplay",
"height": 640
}
]
}
]
}
}jbrowse set-default-session --session - << 'EOF'
{
"name": "Six accessions in Col-0's coordinates",
"views": [
{
"type": "LinearGenomeView",
"assembly": "Col-0",
"loc": "Chr4:1-6,000,000",
"tracks": [
{
"trackId": "syri_regions_on_Col-0",
"type": "LinearMultiRowFeatureDisplay",
"height": 110
},
{
"trackId": "syri_pangenome",
"type": "MultiWaySyntenyDisplay",
"height": 640
}
]
}
]
}
EOFStructural forms on the Arabidopsis pangenome page
The
Arabidopsis pangenome page
has SyRI regions for the 1001 Genomes Plus accessions on TAIR10. Type a gene or
region there, and the page draws a map of that window with one row per
structural form, a group of accessions with the same alleles at every
structural-variant site in the window, beside its share of the accessions. The
forms come from calling each accession against the pangenome graph with
minigraph --call.
Two links on the page open the SyRI rows in JBrowse:
- Open in JBrowse, under the map, opens the window as the graph with a row of SyRI regions per accession beneath it, the display that Every accession in Columbia coordinates sets up
- Every accession as SyRI lanes, under the page title, opens the same rows over the chromosome 4 inversion
Reproduce it end to end
The script needs the tools under Prerequisites and works in four steps:
- Fetch the assemblies and keep the nuclear chromosomes, named
Chr1toChr5, since SyRI pairs chromosomes by name. - Align each accession to Col-0 and to the accession above it, and run SyRI on each alignment.
- Convert each SyRI table to PAF records and reference-coordinate BED rows.
- Write the config with the assemblies, the stacked track and the Col-0 regions track.
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/build_syri_synteny.sh
bash build_syri_synteny.shFor genomes of your own, pass a rows file after the output directory:
- one
<name> [accession]line per genome, in stack order, the reference first - the script uses a chromosome-level
<name>.fain the output directory as it is, so a row that has one needs no accession - homologous chromosomes must be spelled alike in every FASTA, since SyRI pairs them by name
bash build_syri_synteny.sh my_syri rows.txtSee also
- Tutorial: Synteny visualization (pairwise minimap2)
- Tutorial: Synteny visualization (all-vs-all minimap2)
- Tutorial: Synteny from an ortholog table (grape, peach, cacao)
- Tutorial: Synteny by ancestral linkage group (sponge, comb jelly, jellyfish)
- Tutorial: Comparing one genome's two haplotypes (T2T-HG002)
- Tutorial: A grammar of graphics over a BED (RepeatMasker Alu age)
Citations
- Goel et al. (2019). SyRI: finding genomic rearrangements and local sequence differences from whole-genome assemblies
- Goel and Schneeberger (2022). plotsr: visualizing structural similarities and rearrangements between multiple genomes
- Jiao and Schneeberger (2020). Chromosome-level assemblies of multiple Arabidopsis genomes reveal hotspots of rearrangements with altered evolutionary dynamics
- Zapata et al. (2016). Chromosome-level assembly of Arabidopsis thaliana Ler reveals the extent of translocation and inversion polymorphisms
- Fransz et al. (2000). Integrated cytogenetic map of chromosome arm 4S of A. thaliana: structural organization of heterochromatic knob and centromere region
Feedback on this tutorial is welcome: contact us.