Synteny visualization (OrthoFinder orthogroups)
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.
Genomes too far apart to align base by base still keep their genes in order along the chromosomes. OrthoFinder infers orthogroups, sets of genes descended from one ancestral gene, from protein similarity alone. An orthogroup contains every copy of a gene, so where a genome doubled or tripled, one region of a relative without that duplication pairs with two or three regions of it. The examples are bread wheat's three subgenomes, maize, zebrafish and tomato, with the fruit flies as a lineage with one copy. We:
- run OrthoFinder and convert the orthogroups to a
.blockstable that JBrowse reads - load the
wheatorthogroups as a synteny track, stack tauschii over bread wheat, and color each link by its tauschii chromosome - open four more sets the same way (grasses, vertebrates, nightshades and drosophila) at one locus each, three of them also as multi-way lanes under one genome, and chain the drosophila orthogroups into MCScanX blocks loaded as a PAF track
- open a gene's orthogroup as a protein alignment under its gene tree, beside the genome, with the MSA view plugin
- run the same build on a FASTA and GFF3 per genome of your own
Prerequisites
- OrthoFinder with
DIAMOND on
PATHasorthofinder - MCScanX (
MCScanX_h), for the collinear blocks - orthologs2jbrowse, htslib
(
bgzip,tabix) node, for the JBrowse CLI- NCBI datasets CLI
(
datasets,dataformat) - gffread, for your own genomes only
- A running JBrowse instance (web or desktop)
# Debian/Ubuntu
sudo apt install tabix diamond-aligner gffread nodejs
# or conda, which has every tool above
conda install -c bioconda -c conda-forge htslib diamond gffread nodejs \
ncbi-datasets-cli mcscanx orthofinder
# 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/dataformat
# any platform
pip install git+https://github.com/cmdcolin/orthologs2jbrowse
npm install -g @jbrowse/cli@nextThe data
Each genome is an NCBI assembly, and the script fetches its protein FASTA, GFF3
and sequence report, which names the chromosomes, together with
datasets download genome accession.
You don't need these files to follow the sessions, which read hosted copies. Run the build script first for the local files the track configs name, or follow the same commands on your own genomes.
| What it is | File |
|---|---|
vertebrates: human, chicken, frog, gar, zebrafish |
GCF_000001405.40, GCF_016699485.2, GCF_000004195.4, GCF_000242695.1, GCF_000002035.6 |
grasses: rice, sorghum, maize, brachypodium, setaria |
GCF_001433935.1, GCF_000003195.3, GCF_902167145.1, GCF_000005505.3, GCF_000263155.2 |
wheat: tauschii, wheat, urartu, durum, emmer |
GCF_002575655.3, GCF_018294505.1, GCF_003073215.2, GCA_900231445.1, GCF_002162155.2 |
drosophila: melanogaster, simulans, yakuba, pseudoobscura, virilis |
GCF_000001215.4, GCF_016746395.2, GCF_016746365.2, GCF_009870125.1, GCF_030788295.1 |
solanaceae: tomato, potato, pepper, tobacco, coffee |
GCF_036512215.1, GCA_020169535.1, GCF_002878395.1, GCF_001879085.1, GCA_900059795.1 |
Run OrthoFinder and build the blocks table
We'll run OrthoFinder on the wheat set, the genomes of wheat's polyploid
history:
- Aegilops tauschii, diploid D donor
- bread wheat, hexaploid, A+B+D
- Triticum urartu, diploid A donor
- durum, domesticated tetraploid, A+B
- wild emmer, durum's wild tetraploid ancestor
The other four sets run the same commands on their own proteomes:
# -og stops after the orthogroups, skipping the gene trees and the species
# tree, which this table does not use and which are most of the runtime.
# -S diamond picks the aligner; -t is threads.
orthofinder -f proteomes -og -S diamond -t "$(getconf _NPROCESSORS_ONLN)"The run writes
proteomes/OrthoFinder/Results_<date>/Orthogroups/Orthogroups.tsv, which the
next command reduces to one gene id per cell:
orthologs2jbrowse orthofinder Orthogroups.tsv -o tauschii.blocks \
--bed tauschii=tauschii.bed --bed wheat=wheat.bed --bed durum=durum.bed \
--bed emmer=emmer.bed --bed urartu=urartu.bed \
--max-copies 4blockAssemblies must match the column order the script prints.
--assembly COLUMN=NAME renames a column:
orthologs2jbrowse orthofinder Orthogroups.tsv -o tauschii.blocks \
--bed tauschii=tauschii.bed --bed wheat=wheat.bed \
--assembly wheat=bread_wheatChoose how a duplicated gene is drawn
In Orthogroups.tsv each cell lists one genome's genes in an orthogroup, so two
genes in one cell have no single ribbon. --pick chooses among three
treatments:
--pick |
A rice gene with two maize orthologs | Use when |
|---|---|---|
first |
one ribbon, to whichever maize gene OrthoFinder listed first | you want maximum coverage and accept the arbitrary choice |
expand (default) |
two ribbons, one per maize copy | the duplication is part of what you are looking at |
single |
no ribbon | you want a strictly one-to-one table |
Where both genomes of a band hold copies, expand pairs them in the order
OrthoFinder listed them, so the build script's wheat stack keeps a diploid
between bread wheat and the tetraploids. A cell over --max-copies counts as a
family and contributes no row (0 keeps every cell):
orthologs2jbrowse orthofinder Orthogroups.tsv -o tauschii.blocks \
--bed tauschii=tauschii.bed --bed wheat=wheat.bed \
--pick single --max-copies 2Match gene ids between the table and the BEDs
Column 4 of each BED must match the ids in the table exactly. The build script
keeps each gene's longest protein and names it by the gene id, so OrthoFinder
sees one protein per gene under the id the BED has. --bed name=file reports
the share of ids placed, and the conversion stops if it places none.
Load the wheat orthogroups as a synteny track
One track backs each pair of adjacent rows in the stack:
Goes in the tracks array of config.json. See Tracks.
{
"type": "SyntenyTrack",
"trackId": "wheat_orthogroups",
"name": "Wheat orthogroups (OrthoFinder)",
"assemblyNames": ["tauschii", "wheat", "urartu", "durum", "emmer"],
"adapter": {
"type": "MCScanBlocksAdapter",
"uri": "tauschii.blocks.gz",
"blockAssemblies": ["durum", "emmer", "tauschii", "urartu", "wheat"],
"bedLocations": [
"durum.bed.gz",
"emmer.bed.gz",
"tauschii.bed.gz",
"urartu.bed.gz",
"wheat.bed.gz"
]
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "SyntenyTrack",
"trackId": "wheat_orthogroups",
"name": "Wheat orthogroups (OrthoFinder)",
"assemblyNames": ["tauschii", "wheat", "urartu", "durum", "emmer"],
"adapter": {
"type": "MCScanBlocksAdapter",
"uri": "tauschii.blocks.gz",
"blockAssemblies": ["durum", "emmer", "tauschii", "urartu", "wheat"],
"bedLocations": [
"durum.bed.gz",
"emmer.bed.gz",
"tauschii.bed.gz",
"urartu.bed.gz",
"wheat.bed.gz"
]
}
}'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": "wheat_orthogroups",
"name": "Wheat orthogroups (OrthoFinder)",
"assemblyNames": ["tauschii", "wheat", "urartu", "durum", "emmer"],
"adapter": {
"type": "MCScanBlocksAdapter",
"uri": "tauschii.blocks.gz",
"blockAssemblies": ["durum", "emmer", "tauschii", "urartu", "wheat"],
"bedLocations": [
"durum.bed.gz",
"emmer.bed.gz",
"tauschii.bed.gz",
"urartu.bed.gz",
"wheat.bed.gz"
]
}
}tauschii.blocks.gz, durum.bed.gz, emmer.bed.gz, tauschii.bed.gz, urartu.bed.gz, wheat.bed.gz are relative to a config.json. Replace each 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.
A mismatch between blockAssemblies and the column order the conversion printed
raises a track error naming both lists.
Load each assembly from a chrom.sizes
A gene-level synteny view needs only sequence names and lengths, so each
assembly is a ChromSizesAdapter over a
.chrom.sizes file (a name and a length per line) built from its NCBI sequence
report. We'll load wheat; the other genomes repeat the block under each genome's
name:
Goes in the assemblies array of config.json. See Assemblies.
{ "name": "wheat", "uri": "wheat.chrom.sizes" }Edits config.json in the current folder, creating it if there is none. See JBrowse CLI with Desktop.
jbrowse add-assembly wheat.chrom.sizes \
--name wheat \
--load copyIn JBrowse Desktop, Open your own genome on the start screen (or File → Open genome... in a session), then Open from a URL and paste:
wheat.chrom.sizesJBrowse reads the format off the file name. Then fill in:
- Genome name:
wheat
wheat.chrom.sizes is relative to a config.json. Replace it with its URL or its path on this computer.
Add a gene track per genome
The multi-way display draws a lane per genome, with gene models from a gene
track on that genome's assembly in the config, open or not
(laneGeneTracks
picks one when a genome has several). For your own annotation, add one per
genome from a bgzipped, sorted GFF3 (prep) that uses the
assembly's refNames, indexed with tabix -C:
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "wheat_genes",
"name": "wheat genes",
"assemblyNames": ["wheat"],
"adapter": {
"type": "Gff3TabixAdapter",
"uri": "wheat.sorted.gff3.gz",
"csi": true
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "wheat_genes",
"name": "wheat genes",
"assemblyNames": ["wheat"],
"adapter": {
"type": "Gff3TabixAdapter",
"uri": "wheat.sorted.gff3.gz",
"csi": true
}
}'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": "wheat_genes",
"name": "wheat genes",
"assemblyNames": ["wheat"],
"adapter": {
"type": "Gff3TabixAdapter",
"uri": "wheat.sorted.gff3.gz",
"csi": true
}
}wheat.sorted.gff3.gz is relative to a config.json. Replace it with its URL or its path on this computer.
Stack tauschii over wheat
We'll stack the D-genome donor over bread wheat: Add → Linear synteny view,
pick wheat_orthogroups and add tauschii above wheat; the
all-vs-all tutorial walks the
dialog. Then:
- Navigate the wheat row to
1A 1B 1D 2A 2B 2D 3A 3B 3D 4A 4B 4D 5A 5B 5D 6A 6B 6D 7A 7B 7D, the seven homoeologous groups side by side, with the unplacedUnleft out. - Pick Query sequence in the palette button menu. The palette sets the
view's
encoding.color, a color scale from a field to colors, and Query sequence colors each link by its tauschii chromosome.
A session over the hosted wheat config opens the same view:
Goes at the top level of config.json, replacing any defaultSession there. See Default session.
{
"defaultSession": {
"name": "Tauschii over wheat",
"views": [
{
"type": "LinearSyntenyView",
"views": [
{ "assembly": "tauschii" },
{
"assembly": "wheat",
"loc": "1A 1B 1D 2A 2B 2D 3A 3B 3D 4A 4B 4D 5A 5B 5D 6A 6B 6D 7A 7B 7D"
}
],
"tracks": ["wheat_orthogroups"],
"encoding": { "color": "query", "opacity": 0.15 },
"mark": { "interpolate": "linear" },
"levelHeights": [430],
"collapseEmptyRows": true
}
]
}
}Replaces any defaultSession in config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse set-default-session --session - << 'EOF'
{
"name": "Tauschii over wheat",
"views": [
{
"type": "LinearSyntenyView",
"views": [
{ "assembly": "tauschii" },
{
"assembly": "wheat",
"loc": "1A 1B 1D 2A 2B 2D 3A 3B 3D 4A 4B 4D 5A 5B 5D 6A 6B 6D 7A 7B 7D"
}
],
"tracks": ["wheat_orthogroups"],
"encoding": { "color": "query", "opacity": 0.15 },
"mark": { "interpolate": "linear" },
"levelHeights": [430],
"collapseEmptyRows": true
}
]
}
EOFOpen this session 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%2Fdemos%2Forthofinder_wheat%2Fconfig.json&session=json-%7B%22session%22%3A%7B%22name%22%3A%22Tauschii+over+wheat%22%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearSyntenyView%22%2C%22views%22%3A%5B%7B%22assembly%22%3A%22tauschii%22%7D%2C%7B%22assembly%22%3A%22wheat%22%2C%22loc%22%3A%221A+1B+1D+2A+2B+2D+3A+3B+3D+4A+4B+4D+5A+5B+5D+6A+6B+6D+7A+7B+7D%22%7D%5D%2C%22tracks%22%3A%5B%22wheat_orthogroups%22%5D%2C%22encoding%22%3A%7B%22color%22%3A%22query%22%2C%22opacity%22%3A0.15%7D%2C%22mark%22%3A%7B%22interpolate%22%3A%22linear%22%7D%2C%22levelHeights%22%3A%5B430%5D%2C%22collapseEmptyRows%22%3Atrue%7D%5D%7D%7D&sessionName=JBrowse+docs+exampleAn orthogroup holds a gene's A, B and D copies (homoeologs) together, and
--pick expand draws a link to each, so every tauschii chromosome fans out to
the three wheat chromosomes of its group.
Narrow wheat to 4A against the D genome
Navigate the wheat row to 4A alone, keeping Query sequence:
Other chromosomes appear on 4A only as single genes. The runs from tauschii 5 and 7 are the 4AL/5AL and 4AL/7BS translocations (Devos et al. 1995; Dvorak et al. 2018).
Open rice against two maize copies
The other four sets build with bash build_orthofinder_synteny.sh <set>
(Reproduce it end to end), and each has a hosted
config at https://jbrowse.org/demos/orthofinder_<set>/config.json.
Maize went through a whole-genome duplication after it split from sorghum (Schnable et al. 2009), so one rice region pairs with one sorghum region and two maize regions.
Stack one rice locus between sorghum and maize
Open the grasses config and stack sorghum over rice over maize, with
grasses_orthogroups in each band. Then:
- Turn on sorghum genes, rice genes and maize genes.
- Navigate the rows to
1:5,934,000-6,126,000[rev],3:31,590,000-31,775,000and1:286,676,000-287,665,000 5:6,261,000-6,790,000[rev]. - Pick Target sequence in the palette button menu to color each link by the chromosome of its target gene.
Sorghum shares the ancestry and lacks the duplication, so it is the control.
Open a rice window against four grasses
Open the same five grasses as a multi-way synteny track on rice. The display draws the rice genes in its top lane, so a separate gene track is unnecessary:
Goes at the top level of config.json, replacing any defaultSession there. See Default session.
{
"defaultSession": {
"name": "Grasses multi-way synteny track",
"views": [
{
"type": "LinearGenomeView",
"assembly": "rice",
"loc": "3:31,590,000-31,775,000",
"tracks": [
{
"trackId": "grasses_orthogroups",
"type": "MultiWaySyntenyDisplay",
"rows": {
"sort": ["sorghum", "brachypodium", "setaria", "maize"]
},
"height": 480
}
]
}
]
}
}Replaces any defaultSession in config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse set-default-session --session - << 'EOF'
{
"name": "Grasses multi-way synteny track",
"views": [
{
"type": "LinearGenomeView",
"assembly": "rice",
"loc": "3:31,590,000-31,775,000",
"tracks": [
{
"trackId": "grasses_orthogroups",
"type": "MultiWaySyntenyDisplay",
"rows": {
"sort": ["sorghum", "brachypodium", "setaria", "maize"]
},
"height": 480
}
]
}
]
}
EOFOpen this session 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%2Fdemos%2Forthofinder_grasses%2Fconfig.json&session=json-%7B%22session%22%3A%7B%22name%22%3A%22Grasses+multi-way+synteny+track%22%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22rice%22%2C%22loc%22%3A%223%3A31%2C590%2C000-31%2C775%2C000%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22grasses_orthogroups%22%2C%22type%22%3A%22MultiWaySyntenyDisplay%22%2C%22rows%22%3A%7B%22sort%22%3A%5B%22sorghum%22%2C%22brachypodium%22%2C%22setaria%22%2C%22maize%22%5D%7D%2C%22height%22%3A480%7D%5D%7D%5D%7D%7D&sessionName=JBrowse+docs+exampleA stacked view shows both maize copies at once. Advanced → Launch → Linear synteny view (visible region) in the lane track menu offers a full row per grass.
Open gar against two zebrafish copies
The teleost fishes, zebrafish among them, descend from a genome duplication that
spotted gar branched off before (Braasch et al. 2016). Open the vertebrates
config and stack gar over zebrafish, with vertebrates_orthogroups in the band.
Then:
- Navigate the gar row to
LG11and leave zebrafish whole. - Pick Target sequence in the palette button menu to color each link by its zebrafish chromosome.
- Uncheck Off-screen mates in the settings menu, which otherwise labels the zebrafish genes whose gar partners sit on other gar chromosomes.
Open human HOXD against four vertebrates
Open human at 2:176,090,000-176,290,000, the HOXD cluster of body-axis
patterning genes, with the orthogroups track on the
multi-way synteny display. The
display draws a lane (one horizontal strip per genome) for each of chicken,
frog, gar and zebrafish under the human genes.
Open coffee against three tomato copies
Tomato, potato and pepper share a whole-genome triplication that coffee lacks
(Tomato Genome Consortium 2012; Denoeud et al. 2014). Open the solanaceae
config and stack tomato over coffee over tomato, with solanaceae_orthogroups
in both bands. Then:
- Navigate the rows to
7:66,700,000-70,550,000,VII:24,200,000-28,800,000and10:850,000-2,400,000[rev] 12:4,600,000-6,900,000: one tomato copy above coffee and the other two below. - Pick Reference in the palette button menu to color each link by its tomato chromosome.
- Uncheck Off-screen mates in the settings menu, which otherwise marks the coffee genes whose other partners fall outside the windows.
Each copy has lost genes since the triplication, so most coffee genes link to one of the three.
Stack the flies around melanogaster
The drosophila set stacks D. melanogaster with close relatives D. simulans
and D. yakuba and the distant D. pseudoobscura and D. virilis, which share
no genome duplication since they split. The chromosome arms (Muller elements)
keep their gene content, while inversions reorder the genes inside each arm. In
D. pseudoobscura melanogaster's 3L arm (Muller D) is the right arm of the X
(Richards et al. 2005).
Open the drosophila config and stack the flies as simulans, melanogaster,
yakuba, melanogaster, pseudoobscura, melanogaster, virilis, so every band sets
one fly against melanogaster, with drosophila_orthogroups in each band. Then:
- Pick Show whole genome, then Square view - same bp per pixel, in the
header's ⋮ menu (
coord: { ratio: 1 }in a session spec), which puts the rows on one bp/px, so row length on screen matches genome size. - Pick Re-order chromosomes in the same menu (
autoDiagonalizein a session spec), which sorts each row's chromosomes against its neighbour so the links run along a diagonal. - Pick Reference in the palette button menu to color each ribbon by its melanogaster arm.
Compare gene order in one 3L window
Open melanogaster at 3L:5,789,000-5,931,000 with the
multi-way synteny display, which
draws a lane per fly; each fly has an ortholog of every melanogaster gene in
this window.
Chain the orthogroups into collinear blocks
An orthogroup is an unordered list of related genes.
MCScanX's MCScanX_h chains ortholog
pairs that keep their order into collinear blocks. Start by writing every gene
pair an orthogroup holds between two flies:
# every melanogaster-simulans pair in an orthogroup, each copy of a duplicated
# gene included, so MCScanX_h chains whichever copies keep their order
orthologs2jbrowse orthofinder Orthogroups.tsv -o melanogaster.blocks \
--homology melanogaster:simulans=x.homologyMCScanX_h also reads x.gff, four columns per gene (chromosome, gene id,
start, end) with each chromosome name prefixed by a two-letter code for its
genome, written from the two BEDs:
awk -v OFS='\t' '{ print "aa" $1, $4, $2 + 1, $3 }' melanogaster.bed > x.gff
awk -v OFS='\t' '{ print "bb" $1, $4, $2 + 1, $3 }' simulans.bed >> x.gff# -s 10: a block holds at least 10 gene pairs
# -m 24: at most 24 genes skipped between two pairs of a block
# -g 0: a skipped gene costs nothing, so -s alone sets the size cutoff
# -b 2: blocks between the two genomes only, none within one
# -a: write the .collinearity file and skip the HTML
MCScanX_h x -a -b 2 -s 10 -m 24 -g 0Convert the blocks to PAF, one line per block, with each sequence named for its
assembly (melanogaster#1#2L):
orthologs2jbrowse mcscanx --gff x.gff --collinearity x.collinearity \
--species aa=melanogaster --species bb=simulans \
--paf melanogaster.simulans.paf \
--chrom-sizes melanogaster=melanogaster.chrom.sizes \
--chrom-sizes simulans=simulans.chrom.sizesOne track over the concatenated PAF files of every pair supplies the links for every band of a stack:
Goes in the tracks array of config.json. See Tracks.
{
"type": "SyntenyTrack",
"trackId": "drosophila_blocks",
"name": "Drosophila collinear blocks (MCScanX)",
"assemblyNames": [
"melanogaster",
"simulans",
"yakuba",
"pseudoobscura",
"virilis"
],
"adapter": {
"type": "MultiGenomePAFAdapter",
"uri": "https://jbrowse.org/demos/orthofinder_drosophila/drosophila.blocks.paf.gz",
"assemblyNames": [
"melanogaster",
"simulans",
"yakuba",
"pseudoobscura",
"virilis"
]
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://jbrowse.org/demos/orthofinder_drosophila/drosophila.blocks.paf.gz \
--trackId drosophila_blocks \
--name "Drosophila collinear blocks (MCScanX)" \
--assemblyNames melanogaster,simulans,yakuba,pseudoobscura,virilis \
--adapterType MultiGenomePAFAdapterIn 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": "drosophila_blocks",
"name": "Drosophila collinear blocks (MCScanX)",
"assemblyNames": [
"melanogaster",
"simulans",
"yakuba",
"pseudoobscura",
"virilis"
],
"adapter": {
"type": "MultiGenomePAFAdapter",
"uri": "https://jbrowse.org/demos/orthofinder_drosophila/drosophila.blocks.paf.gz",
"assemblyNames": [
"melanogaster",
"simulans",
"yakuba",
"pseudoobscura",
"virilis"
]
}
}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.
Stack the flies in the same order as above and pick drosophila_blocks for
every band:
Open an orthogroup's alignment and gene tree
Run past the orthogroup step, OrthoFinder also aligns each orthogroup and infers a gene tree for every one of four or more genes, and the MSA view plugin opens them from a gene on the genome. Every set's config includes them, and the MSA view opens from the top genome of each stack: melanogaster, rice, human, tomato or tauschii.
Open melanogaster at the l(2)gl gene:
Goes at the top level of config.json, replacing any defaultSession there. See Default session.
{
"defaultSession": {
"name": "melanogaster l(2)gl",
"views": [
{
"type": "LinearGenomeView",
"assembly": "melanogaster",
"loc": "2L:9,000-22,000",
"tracks": ["melanogaster_genes"]
}
]
}
}Replaces any defaultSession in config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse set-default-session --session - << 'EOF'
{
"name": "melanogaster l(2)gl",
"views": [
{
"type": "LinearGenomeView",
"assembly": "melanogaster",
"loc": "2L:9,000-22,000",
"tracks": ["melanogaster_genes"]
}
]
}
EOFOpen this session 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%2Fdemos%2Forthofinder_drosophila%2Fconfig.json&session=json-%7B%22session%22%3A%7B%22name%22%3A%22melanogaster+l%282%29gl%22%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22melanogaster%22%2C%22loc%22%3A%222L%3A9%2C000-22%2C000%22%2C%22tracks%22%3A%5B%22melanogaster_genes%22%5D%7D%5D%7D%7D&sessionName=JBrowse+docs+exampleRight-click l(2)gl, pick Launch MSA view, and submit the Pre-loaded MSA
datasets tab. The view opens beside the genome with a row per fly under
OrthoFinder's tree for the orthogroup, and a click in the alignment moves the
genome view to that codon.
MSA=1 builds this with the rest of a set, from the same OrthoFinder run as its
synteny tracks:
MSA=1 bash build_orthofinder_synteny.sh drosophilaMSA=1 changes three OrthoFinder options: it runs without -og, with -M msa,
which OrthoFinder 2.5 (the davidemms/orthofinder container) needs before it
aligns anything, and with -z, which stops it trimming columns, and so
residues, out of a long alignment:
orthofinder -f proteomes -M msa -z -S diamond -t "$(getconf _NPROCESSORS_ONLN)"For the five flies the run took 15 minutes on 24 threads, on OrthoFinder 3.2, the version every set's demo was built with.
The plugin finds the clicked gene's row in the alignment by translating its
transcript, so the top genome (MSA_GENOMES names others) is downloaded and cut
to the sequences in its chrom.sizes, and becomes the assembly in their place:
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "melanogaster",
"sequence": {
"type": "ReferenceSequenceTrack",
"trackId": "melanogaster-ReferenceSequenceTrack",
"adapter": {
"type": "BgzipFastaAdapter",
"uri": "melanogaster.fa.gz"
}
}
}Edits config.json in the current folder, creating it if there is none. See JBrowse CLI with Desktop.
jbrowse add-assembly melanogaster.fa.gz \
--name melanogaster \
--load copyLast, the run's Orthogroups/, MultipleSequenceAlignments/ and
Resolved_Gene_Trees/ are copied into an orthofinder/ folder beside
config.json (77 MB for the flies), and the config lists the plugin and that
folder:
{
"plugins": [
{
"name": "MsaView",
"storePlugin": "MsaView",
"esmUrl": "https://jbrowse.org/plugins/jbrowse-plugin-msaview/latest/dist/jbrowse-plugin-msaview.esm.js"
}
],
"msa": {
"datasets": [
{
"datasetId": "drosophila_orthofinder",
"name": "Drosophila orthogroups (OrthoFinder)",
"adapter": {
"type": "OrthoFinderMsaAdapter",
"resultsLocation": { "uri": "orthofinder/" }
}
}
]
}
}How the plugin matches a gene to its protein, including the ids OrthoFinder rewrites, is in its OrthoFinder docs.
Run it on your own genomes
The build script maps a set name to the NCBI assemblies it downloads. Your own genomes need a FASTA and a GFF3 per genome. gffread translates each CDS into the proteome and prints the transcript-to-gene map and FASTA index alongside.
Name the files in a manifest, one line per genome:
cat > my_genomes.tsv <<'EOF'
# name genome annotation aliases
speciesA data/speciesA.fa.gz data/speciesA.gff3.gz
speciesB https://host/B.fa.gz https://host/B.gff3.gz GCF_000001405.40
EOF
bash build_orthofinder_synteny.sh my_genomes.tsv
npx --yes serve orthofinder_my_genomes_build/jbrowse2 # then open the printed URL- Column 1 names the assembly, and columns 2 and 3 take a local path or URL.
- Column 4 is optional. An INSDC accession fetches NCBI's sequence report for chromosome names, and a file name supplies a two-column alias table.
- Column 2 also takes a proteome directly, which skips translation; its headers
then need a
gene:<id>tag matchingID=gene:<id>in the GFF3. - A manifest needs at least two genomes.
Reproduce it end to end
build_orthofinder_synteny.sh
runs everything above and writes a config.json with the assemblies, gene
tracks, the synteny track and a stacked default session:
- Download each genome's proteins, GFF3 and sequence report from NCBI, keeping each gene's longest protein under its gene id so the table and the BEDs agree, and write a gene BED and chrom.sizes per genome.
- Run OrthoFinder to the orthogroups only, or with
MSA=1on to an alignment and gene tree per orthogroup. - Convert the orthogroups to a
.blockstable, dropping cells overMAXCOPIESas gene families. - Chain every pair of genomes into collinear blocks with
MCScanX_h, and collect the blocks into one PAF. - Write the assemblies, gene tracks, the orthogroups and blocks tracks and a
stacked session, and with
MSA=1the MSA view dataset.
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/build_orthofinder_synteny.sh
bash build_orthofinder_synteny.sh wheat # or: vertebrates, grasses, drosophila, solanaceae
npx --yes serve orthofinder_wheat_build/jbrowse2 # then open the printed URLThe script accepts these sets, each with the number of DIAMOND runs it takes to build:
| Set | Genomes | DIAMOND runs | NCBI annotation |
|---|---|---|---|
vertebrates |
human, chicken, frog, gar, zebrafish | 25 | RefSeq |
grasses |
rice, sorghum, maize, brachypodium, setaria | 25 | RefSeq |
wheat |
tauschii, wheat, urartu, durum, emmer | 25 | RefSeq and GenBank |
drosophila |
melanogaster, simulans, yakuba, pseudoobscura, virilis | 25 | RefSeq |
solanaceae |
tomato, potato, pepper, tobacco, coffee | 25 | RefSeq and GenBank |
Two environment variables set the cuts:
| Variable | Default | What it cuts |
|---|---|---|
MAXSEQ |
30 | sequence regions kept per genome, the ones with the most genes |
MAXCOPIES |
4 | genes in one orthogroup cell past which it is a gene family rather than a set of copies |
MAXSEQ=60 MAXCOPIES=6 bash build_orthofinder_synteny.sh wheatSee also
- Tutorial: Synteny from an ortholog table (grape, peach, cacao)
- Tutorial: Synteny from MCScan anchors (grape, peach)
- Tutorial: Synteny visualization (pairwise minimap2)
- User guide: Linear synteny view
- Config guide: Synteny track
- Reference: MCScanBlocksAdapter
Citations
- Emms and Kelly (2019). OrthoFinder: phylogenetic orthology inference for comparative genomics
- Emms, Liu, Belcher, Holmes and Kelly (2026). OrthoFinder 3, Nature Methods 23:1327–1333
- Wang et al. (2012). MCScanX: a toolkit for detection and evolutionary analysis of gene synteny and collinearity
- Schnable et al. (2009). The B73 maize genome: complexity, diversity, and dynamics
- Braasch et al. (2016). The spotted gar genome illuminates vertebrate evolution and facilitates human-teleost comparisons
- Tomato Genome Consortium (2012). The tomato genome sequence provides insights into fleshy fruit evolution
- Denoeud et al. (2014). The coffee genome provides insight into the convergent evolution of caffeine biosynthesis
- Richards et al. (2005). Comparative genome sequencing of Drosophila pseudoobscura: chromosomal, gene, and cis-element evolution
- Devos et al. (1995). Structural evolution of wheat chromosomes 4A, 5A, and 7B and its impact on recombination
- Dvorak et al. (2018). Reassessment of the evolution of wheat chromosomes 4A, 5A, and 7B
Feedback on this tutorial is welcome: contact us.