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.13. 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 by aligning six assembled accessions and running SyRI, which sorts an alignment into syntenic, inverted, translocated and duplicated regions. We compare each accession with Columbia and with the accession above it, and every comparison goes into one file whose ribbons take the color of the type SyRI assigns. We draw that file two ways:
- the stack plotsr draws
- the same accessions as lanes 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)
Where the data comes from
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 build script takes these files from their URLs, so there is nothing to download by hand.
- Col-0, GCF_000001735.4: ftp.ncbi.nlm.nih.gov/…/GCF_000001735.4_TAIR10.1https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/001/735/GCF_000001735.4_TAIR10.1/
- Ler, GCA_902460285.1: ftp.ncbi.nlm.nih.gov/…/GCA_902460285.1_Arabidopsis_thaliana_Lerhttps://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/902/460/285/GCA_902460285.1_Arabidopsis_thaliana_Ler/
- Cvi-0, GCA_902460275.1: ftp.ncbi.nlm.nih.gov/…/GCA_902460275.1_Arabidopsis_thaliana_Cvi-0https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/902/460/275/GCA_902460275.1_Arabidopsis_thaliana_Cvi-0/
- Eri-1, GCA_902460315.1: ftp.ncbi.nlm.nih.gov/…/GCA_902460315.1_Arabidopsis_thaliana_Eri-1https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/902/460/315/GCA_902460315.1_Arabidopsis_thaliana_Eri-1/
- Kyo, GCA_902460305.1: ftp.ncbi.nlm.nih.gov/…/GCA_902460305.1_Arabidopsis_thaliana_Kyohttps://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/902/460/305/GCA_902460305.1_Arabidopsis_thaliana_Kyo/
- Sha, GCA_902460295.1: ftp.ncbi.nlm.nih.gov/…/GCA_902460295.1_Arabidopsis_thaliana_Shahttps://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/902/460/295/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.
Concatenating the records from every pair gives one file for every view below:
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.domainorders the lanes, andribbonColoris a color scale on the bands, mapping thesyrifield through adomainof 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": { "domain": ["Ler", "Cvi", "Eri", "Kyo", "Sha"] },
"ribbonColor": {
"field": "syri",
"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": { "domain": ["Ler", "Cvi", "Eri", "Kyo", "Sha"] },
"ribbonColor": {
"field": "syri",
"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": { "domain": ["Ler", "Cvi", "Eri", "Kyo", "Sha"] },
"ribbonColor": {
"field": "syri",
"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"]],
"color": {
"field": "syri",
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
},
"drawCurves": true,
"opacity": 0.9,
"fadeThinAlignmentsMode": "off",
"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"]],
"color": {
"field": "syri",
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
},
"drawCurves": true,
"opacity": 0.9,
"fadeThinAlignmentsMode": "off",
"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 six accessions, one SyRI run per band
The syri_pangenome track stacks all six, 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"],
["syri_pangenome"],
["syri_pangenome"],
["syri_pangenome"],
["syri_pangenome"]
],
"color": {
"field": "syri",
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
},
"drawCurves": true,
"opacity": 0.9,
"fadeThinAlignmentsMode": "off",
"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"],
["syri_pangenome"],
["syri_pangenome"],
["syri_pangenome"],
["syri_pangenome"]
],
"color": {
"field": "syri",
"domain": ["SYN", "INV", "TRANS", "INVTR", "DUP", "INVDP"]
},
"drawCurves": true,
"opacity": 0.9,
"fadeThinAlignmentsMode": "off",
"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. A row is named by its type, colored by itemRgb, and has the accession
name in a query column. 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.domain 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",
"domain": ["Ler", "Cvi", "Eri", "Kyo", "Sha"]
},
"color": { "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",
"domain": ["Ler", "Cvi", "Eri", "Kyo", "Sha"]
},
"color": { "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",
"domain": ["Ler", "Cvi", "Eri", "Kyo", "Sha"]
},
"color": { "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
}
]
}
]
}
EOFChecking the chromosome 4 inversion against syri.out
The largest inverted region of the Col-0 and Ler run, straight from the SyRI table:
awk -F'\t' '$11=="INV" {print $3-$2+1, $1, $2, $3}' Col-0_Ler.syri.out | sort -nr | head -1The largest inversion is on Chr4, from 1,612,606 to 2,782,621, the interval
the crossed ribbon spans and the orange block on the Ler row.
Reproduce it end to end
The script needs the tools under Prerequisites and works in four steps:
- Fetch the six assemblies and keep the five 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 six 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 M, Sun H, Jiao WB, Schneeberger K. SyRI: finding genomic rearrangements and local sequence differences from whole-genome assemblies. Genome Biol (2019). https://doi.org/10.1186/s13059-019-1911-0
- Goel M, Schneeberger K. plotsr: visualizing structural similarities and rearrangements between multiple genomes. Bioinformatics (2022). https://doi.org/10.1093/bioinformatics/btac196
- Jiao WB, Schneeberger K. Chromosome-level assemblies of multiple Arabidopsis genomes reveal hotspots of rearrangements with altered evolutionary dynamics. Nat Commun (2020). https://doi.org/10.1038/s41467-020-14779-y
- Zapata L, et al. Chromosome-level assembly of Arabidopsis thaliana Ler reveals the extent of translocation and inversion polymorphisms. PNAS (2016). https://doi.org/10.1073/pnas.1607532113
- Fransz PF, et al. Integrated cytogenetic map of chromosome arm 4S of A. thaliana: structural organization of heterochromatic knob and centromere region. Cell (2000). https://doi.org/10.1016/S0092-8674(00)80670-5
Feedback on this tutorial is welcome: contact us.