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.11. 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 what an alignment contains 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 their color from the type SyRI assigns: the stack plotsr draws, and 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.
- 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. The script
keeps the five nuclear chromosomes of each assembly and names them Chr1 to
Chr5. It aligns each accession to Col-0, and to the accession above it in the
stack:
# 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 5Col-0_Ler.syri.out holds one row per annotation. The structural regions are
the rows with no parent: SYN, INV, TRANS, INVTR, DUP and INVDP, each
with its interval on both genomes.
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, naming sequences <genome>#1#<chrom> so records from
many pairs can share a file, with the inverted types on the minus strand and two
tags: syri, the type, and color, the color plotsr gives that type. It reads
sequence lengths from a .chrom.sizes file beside syri.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 own name and file:
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:
attributeColumnsnames 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:domainnames the lanes andribbonColorcolors the bands bysyri
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",
"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",
"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",
"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 syntenic regions run straight down in grey, and one inverted region crosses
over between them. The 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, since plotsr paints
an inverted translocation as a translocation and an inverted duplication as a
duplication: 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
Each band in the stack compares an accession with its neighbour. 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, named by
its type, colored by itemRgb and holding 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.gzrows.field gives the track one row per accession:
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.
Open a linear genome view on Col-0 at Chr4:1-6,000,000 and 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 MultiWaySyntenyDisplay entry:
- each accession is a lane, drawn in the coordinates of its assembly 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
- Synteny visualization (pairwise minimap2)
- Synteny visualization (all-vs-all minimap2)
- Synteny from an ortholog table (grape, peach, cacao)
- Synteny by ancestral linkage group (sponge, comb jelly, jellyfish)
- Comparing one genome's two haplotypes (T2T-HG002)
- 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.