π§ Synteny Fundamentals
π― What is Synteny?
Synteny (from Greek syn = same, taenia = band) refers to the conservation of gene order along chromosomes between different species or within a genome. When genes are found in the same order on chromosomes of two species, they are syntenic. It is a powerful signal of shared ancestry and functional constraint. Comparative genomics uses synteny to understand genome evolution, identify orthologs, and transfer functional knowledge across species.
Why Synteny Matters
Ancestry: Shared gene order reveals evolutionary history. Orthology: Identify true orthologs. Function: Transfer annotation. Rearrangements: Detect inversions, translocations. Crop breeding: Link traits across species. Genome assembly: Scaffold genomes.
# Synteny & Comparative Genomics β the big picture
# Conservation of gene order across genomes.
print("""
=== Synteny & Comparative Genomics ===
What it is:
- Conservation of gene order
- Between species or within genome
- Reveals evolutionary history
- Guides functional annotation
Why it matters:
- Orthology assignment
- Genome evolution
- Crop improvement
- Ancestral reconstruction
- Genome assembly
Key concepts:
- Synteny block
- Collinearity
- Conserved synteny
- Rearrangements
- Ancestral genome
Applications:
- Phylogenetics
- Gene family evolution
- Crop breeding
- Genome scaffolding
- Functional genomics
""")
print("=== Historical Context ===")
print("""
1980s: First synteny comparisons (mouse vs human)
1990s: Comparative mapping in plants
2000s: Whole-genome synteny (rice, Arabidopsis)
2010s: Large-scale comparative genomics
2020s: Pangenomes, graph genomes, ultra-large alignments
""")
print("=== Why It's Hard ===")
print("""
1. REARRANGEMENTS
- Inversions, translocations
- Duplications, deletions
2. GENOME SIZE
- Large genomes (wheat: 17 Gb)
- Many chromosomes
3. DIVERGENCE
- Distant species
- Little synteny left
4. POLYPLOIDY
- Whole-genome duplication
- Multiple syntenic copies
5. ASSEMBLY QUALITY
- Fragmented assemblies
- Misassemblies
""")π― Why Synteny Matters
π― The Value of Synteny
Synteny is not just about gene order β it's about transferring knowledge across species. Conserved gene order implies shared ancestry and often shared function.
Biological Insights
Orthology: True orthologs. Annotation: Transfer function. Evolution: Rearrangements. Crop: Breed improvement. Assembly: Scaffold. Ancestral: Reconstruct.
# Why Synteny Matters
print("=== 1. Orthology Assignment ===")
print("""
Orthologs: genes in different species
- Descended from same ancestral gene
- Often same function
Synteny helps:
- Distinguish orthologs from paralogs
- Identify true orthologs
- Build orthology maps
Example:
Human chr1 β Mouse chr1
Many genes in same order
β Orthologs
""")
print("\n=== 2. Functional Annotation ===")
print("""
Transfer annotation:
- Gene unknown in species A
- Syntenic to known gene in species B
- Function inferred
Example:
Rice gene = unknown
Syntenic to Arabidopsis gene = flowering
β Rice gene likely flowering
""")
print("\n=== 3. Genome Evolution ===")
print("""
Rearrangements:
- Inversions
- Translocations
- Duplications
- Deletions
Synteny reveals:
- Breakpoints
- Evolutionary events
- Phylogenetic relationships
""")
print("\n=== 4. Crop Improvement ===")
print("""
Crop synteny:
- Rice, maize, wheat, barley
- Model β crop
- Gene discovery
Example:
Rice drought gene
β Synteny in wheat
β Marker-assisted breeding
""")
print("\n=== 5. Genome Assembly ===")
print("""
Scaffolding:
- Contigs β scaffolds
- Synteny to reference
- Order and orient
Example:
Draft genome
β Synteny to reference
β Ordered scaffolds
""")
print("\n=== 6. Ancestral Reconstruction ===")
print("""
Ancestral genome:
- Compare many species
- Infer ancestral gene order
- Reconstruct evolution
Example:
Ancestral flowering plant
β 7 chromosomes
β Modern plants (rice 12, grape 19)
""")
print("\n=== 7. Gene Family Evolution ===")
print("""
Gene families:
- Duplications
- Losses
- Synteny context
Example:
MADS-box genes
- Synteny blocks
- Duplication history
- Functional divergence
""")
print("\n=== 8. Phylogenetics ===")
print("""
Phylogenetic signal:
- Synteny blocks
- Rare genomic changes
- Rearrangements
Example:
Inversions
- Phylogenetic markers
- Resolve relationships
""")
print("\n=== 9. Pangenomics ===")
print("""
Pangenome:
- Core genes
- Dispensable genes
- Synteny across accessions
Example:
Maize pangenome
- Core synteny
- Variable regions
""")
print("\n=== 10. Medical Genomics ===")
print("""
Medical:
- Human vs mouse
- Disease models
- Conserved regions
Example:
Human disease gene
β Mouse ortholog
β Model organism
""")π Key Concepts
π― Synteny Vocabulary
Understanding synteny requires precise terminology: synteny, collinearity, orthology, paralogy, and more.
Core Concepts
Synteny: Same chromosome. Collinearity: Same order. Ortholog: Same gene, different species. Paralog: Duplication. Block: Conserved region. Rearrangement: Inversion/translocation.
# Key Concepts
print("=== Synteny vs Collinearity ===")
print("""
Synteny:
- Genes on same chromosome
- Conserved order (broadly)
Collinearity:
- Genes in same order
- No rearrangements
- Stricter
Example:
Species A: [A B C D E]
Species B: [A B C D E] β Collinear
Species C: [A C B D E] β Syntenic but not collinear
""")
print("\n=== Orthologs vs Paralogs ===")
print("""
Orthologs:
- Same gene
- Different species
- Speciation event
Paralogs:
- Duplication
- Same species
- Duplication event
Example:
Human Ξ±-globin β Mouse Ξ±-globin (ortholog)
Human Ξ±-globin β Human Ξ²-globin (paralog)
""")
print("\n=== Synteny Block ===")
print("""
Synteny block:
- Conserved gene order
- Region of synteny
- Basic unit
Example:
Species A: [A B C D E F G H]
Species B: [A B C D E F G H]
β One synteny block
Species C: [A B C X Y D E F G H]
β Two synteny blocks (X Y insertion)
""")
print("\n=== Conserved Synteny ===")
print("""
Conserved synteny:
- Synteny across species
- Evolutionary conservation
- Functional constraint
Types:
- Strict (collinear)
- Relaxed (rearranged)
Example:
Human chr1 β Mouse chr1
Conserved synteny
""")
print("\n=== Rearrangements ===")
print("""
Types:
1. Inversion
- Segment reversed
- [A B C D E] β [A D C B E]
2. Translocation
- Segment moved
- [A B C] + [D E F] β [A B F] + [D E C]
3. Duplication
- Segment duplicated
- [A B C] β [A B C A B C]
4. Deletion
- Segment lost
- [A B C D E] β [A B D E]
5. Insertion
- Segment added
- [A B C] β [A B X Y C]
""")
print("\n=== Ancestral Genome ===")
print("""
Ancestral genome:
- Reconstructed genome
- Common ancestor
- Gene order
Methods:
- Compare many species
- Synteny blocks
- Rearrangement history
Example:
Ancestral flowering plant
- 7 chromosomes
- Modern plants derived
""")
print("\n=== Polyploidy ===")
print("""
Polyploidy:
- Whole-genome duplication
- Multiple syntenic copies
- Common in plants
Types:
- Autopolyploidy
- Allopolyploidy
Example:
Wheat (hexaploid)
- Three subgenomes
- Synteny between them
""")
print("\n=== Pangenome ===")
print("""
Pangenome:
- All genes in species
- Core + dispensable
- Synteny across accessions
Example:
Maize pangenome
- Core synteny
- Variable regions
""")βοΈ Genome Alignment
π― Aligning Genomes
Whole-genome alignment is the foundation of synteny analysis. It identifies homologous regions between genomes, including rearrangements.
Genome Alignment
Pairwise: Two genomes. Multiple: Many genomes. Anchors: Seeds. Synteny: Blocks. Rearrangements: Detect. Visualization: Dot plots.
# Genome Alignment
print("=== Pairwise Genome Alignment ===")
print("""
Goal: Align two genomes
Steps:
1. Identify anchors (seed matches)
2. Chain anchors into blocks
3. Align blocks
4. Detect rearrangements
Anchors:
- Unique matches
- k-mer matches
- Gene matches
Example:
Genome A: ACGTACGT...
Genome B: ACGTTCGT...
Anchor: ACGT
""")
print("\n=== Multiple Genome Alignment ===")
print("""
Goal: Align multiple genomes
Tools:
- Cactus (HAL format)
- ProgressiveCactus
- Mugsy
- MAUVE
Output:
- Multiple alignment
- Synteny blocks
- Ancestral reconstruction
""")
print("\n=== Anchors ===")
print("""
Anchors:
- Seed matches
- Unique k-mers
- Gene matches
- Proteins
Types:
- Exact matches
- Approximate matches
- Protein anchors
Tools:
- minimap2
- MUMmer
- BLAST
- Diamond
""")
print("\n=== Chaining ===")
print("""
Chaining:
- Anchors β blocks
- Dynamic programming
- Maximize score
Goal:
- Find collinear blocks
- Consistent order
- No overlaps
Example:
Anchors:
A1βB1
A2βB2
A3βB3
β Chain: [A1 A2 A3] β [B1 B2 B3]
""")
print("\n=== Synteny Blocks ===")
print("""
Synteny block:
- Conserved gene order
- Anchors chained
- Rearrangements break
Example:
Genome A: [A B C D E F G H]
Genome B: [A B C D E F G H]
β One block
Genome C: [A B C X Y D E F G H]
β Two blocks (X Y insertion)
""")
print("\n=== Rearrangement Detection ===")
print("""
Rearrangements:
- Inversions
- Translocations
- Duplications
- Deletions
- Insertions
Detection:
- Breakpoints
- Block boundaries
- Orientation changes
Tools:
- SyRI
- MUMmer
- minimap2
- Assemblytics
""")
print("\n=== Whole Genome Alignment Tools ===")
print("""
1. CACTUS
- Multiple genome alignment
- HAL format
- Scalable
2. MUGSY
- Multiple alignment
- Fast
- Simple
3. MAUVE
- Multiple alignment
- Rearrangements
- Visualization
4. MUMmer
- Pairwise
- Fast
- NUCmer
5. minimap2
- Pairwise
- Fast
- Long reads
6. SyRI
- Pairwise
- Rearrangements
- Structural variants
""")
print("\n=== Alignment Statistics ===")
print("""
Metrics:
- Coverage
- Identity
- Number of blocks
- Block size
- Rearrangement count
Example:
Coverage: 95%
Identity: 98%
Blocks: 120
Rearrangements: 15
""")
print("\n=== Visualization ===")
print("""
Dot plot:
- Genome A vs B
- Diagonal = synteny
- Off-diagonal = rearrangement
Circos:
- Circular
- Multi-genome
- Synteny links
Other:
- JCVI
- SynVisio
- Linear synteny
""")π Synteny Detection
π― Finding Synteny Blocks
Synteny detection uses gene or sequence anchors to identify conserved blocks of gene order between genomes.
Detection Methods
Gene-based: Orthologs. Sequence-based: Anchors. Chaining: Blocks. Scoring: Block quality. MCScanX: Gene-level. SyRI: Whole-genome.
# Synteny Detection
print("=== Gene-Based Detection ===")
print("""
Method:
1. Find orthologs (BLAST, OrthoFinder)
2. Map genes to chromosomes
3. Identify syntenic blocks
4. Score blocks
Tools:
- MCScanX
- SynOrths
- i-ADHoRe
- Cyntenator
Input:
- GFF files
- Protein sequences
Output:
- Synteny blocks
- Collinear genes
""")
print("\n=== MCScanX ===")
print("""
MCScanX:
- Popular tool
- Gene-level synteny
- Fast
- Visualization
Steps:
1. BLAST all vs all
2. Parse BLAST
3. MCScanX
4. Visualize
Command:
MCScanX species.gff
# Output: species.collinearity
""")
print("\n=== Sequence-Based Detection ===")
print("""
Method:
1. Anchor matches (MUMmer, minimap2)
2. Chain anchors
3. Identify blocks
4. Score
Tools:
- MUMmer
- minimap2
- SyRI
- Cactus
Output:
- Synteny blocks
- Rearrangements
""")
print("\n=== SyRI ===")
print("""
SyRI:
- Structural rearrangement identifier
- Whole-genome alignment
- Detects:
- Syntenic regions
- Inversions
- Translocations
- Duplications
- Inverted duplications
Input:
- Two genomes (FASTA)
- Alignment (minimap2)
Steps:
1. Align genomes (minimap2)
2. SyRI
3. Visualize (plotsr)
""")
print("\n=== Chaining Algorithms ===")
print("""
Chaining:
- Anchors β blocks
- Dynamic programming
- Maximize score
Scoring:
- Match: +1
- Gap: -1
- Block score
Example:
Anchors:
A1βB1 (score 1)
A2βB2 (score 1)
A3βB3 (score 1)
β Block score: 3
""")
print("\n=== Block Scoring ===")
print("""
Score components:
- Number of genes
- Gene identity
- Gap penalty
- Block length
Quality:
- High score = good block
- Low score = weak
Threshold:
- Min genes (5-10)
- Min score
""")
print("\n=== Comparative Genomics Pipeline ===")
print("""
1. Genome assembly
2. Gene annotation
3. Orthology assignment
4. Synteny detection
5. Block analysis
6. Visualization
7. Evolutionary analysis
""")
print("\n=== Example Code ===")
print("""
# Run MCScanX
# 1. BLAST all vs all
makeblastdb -in proteins.fa -dbtype prot
blastp -query proteins.fa -db proteins.fa -outfmt 6 -out blast.txt
# 2. Run MCScanX
MCScanX species
# 3. Visualize
java -jar MCScanX/ downstream_tools/ circle_plotter/ circle_plotter.jar species.collinearity
""")𧬠Conserved Synteny
π― Conservation Across Species
Conserved synteny describes syntenic blocks that are maintained across species. It's a powerful signal of shared ancestry and functional constraint.
Conserved Synteny
Species: Across genomes. Blocks: Conserved. Constraint: Functional. Ancestry: Shared. Annotation: Transfer. Evolution: Rearrangements.
# Conserved Synteny
print("=== Conserved Synteny ===")
print("""
Definition:
- Synteny across species
- Evolutionary conservation
- Functional constraint
Types:
- Strict (collinear)
- Relaxed (rearranged)
- Ancient (deep)
Example:
Human chr1 β Mouse chr1
Many genes in same order
β Conserved synteny
""")
print("\n=== Examples ===")
print("""
1. Human vs Mouse:
- 90% synteny
- Large blocks
- ~80 rearrangements
2. Rice vs Maize:
- Ancient duplication
- Rearranged
- 10-20 blocks
3. Arabidopsis vs Grape:
- 3 ancestral genomes
- Conserved blocks
4. Wheat subgenomes:
- Three subgenomes
- Highly syntenic
""")
print("\n=== Functional Constraint ===")
print("""
Why conserved?
- Functional constraint
- Regulatory elements
- Chromatin structure
- Gene dosage
Example:
Hox clusters
- Conserved order
- Functional constraint
- Across animals
""")
print("\n=== Annotation Transfer ===")
print("""
Transfer:
- Known gene in species A
- Syntenic in species B
- Function inferred
Example:
Arabidopsis gene = flowering
β Syntenic in rice
β Rice gene likely flowering
""")
print("\n=== Ancestral Reconstruction ===")
print("""
Ancestral genome:
- Compare many species
- Infer ancestral order
- Reconstruct evolution
Example:
Ancestral flowering plant
β 7 chromosomes
β Modern plants (rice 12, grape 19, poplar 19)
""")
print("\n=== Deep Conservation ===")
print("""
Deep synteny:
- Across distant species
- Ancient blocks
- Rare
Example:
Human vs Zebrafish
- Some synteny
- Deep conservation
""")
print("\n=== Conserved Noncoding Elements ===")
print("""
CNEs:
- Conserved noncoding
- Regulatory
- Synteny context
Example:
Human vs Mouse
- CNEs
- Enhancers
- Regulatory function
""")
print("\n=== Database ===")
print("""
1. Ensembl Compara
- Multi-species
- Synteny
- Orthology
2. UCSC Genome Browser
- Synteny tracks
- Multi-species
3. PLAZA
- Plant comparative genomics
- Synteny
- Orthology
4. Gramene
- Grass comparative genomics
- Synteny
- QTL
5. Phytozome
- Plant genomes
- Synteny
- Tools
""")π Rearrangements
π― Genome Rearrangements
Genome rearrangements are structural changes: inversions, translocations, duplications, deletions. Synteny analysis reveals these evolutionary events.
Rearrangements
Inversion: Reversed. Translocation: Moved. Duplication: Copied. Deletion: Lost. Insertion: Added. Fusion: Joined.
# Rearrangements
print("=== Types of Rearrangements ===")
print("""
1. INVERSION
- Segment reversed
- [A B C D E] β [A D C B E]
- Breakpoints
- Common in evolution
2. TRANSLOCATION
- Segment moved
- [A B C] + [D E F] β [A B F] + [D E C]
- Intrachromosomal
- Interchromosomal
3. DUPLICATION
- Segment copied
- [A B C] β [A B C A B C]
- Tandem
- Dispersed
4. DELETION
- Segment lost
- [A B C D E] β [A B D E]
- Common
5. INSERTION
- Segment added
- [A B C] β [A B X Y C]
- Transposons
6. FUSION
- Chromosomes joined
- [A B] + [C D] β [A B C D]
7. FISSION
- Chromosome split
- [A B C D] β [A B] + [C D]
""")
print("\n=== Detection ===")
print("""
Detection:
- Synteny blocks
- Orientation changes
- Block order
Tools:
- SyRI
- MUMmer
- minimap2
- Assemblytics
- DELLY
""")
print("\n=== Breakpoints ===")
print("""
Breakpoints:
- Boundaries of rearrangements
- Synteny block ends
- Evolutionary events
Example:
Genome A: [A B C D E F G H]
Genome B: [A B C D E F G H]
β No breakpoints
Genome C: [A B C X Y D E F G H]
β Breakpoints at X, Y
""")
print("\n=== Inversions ===")
print("""
Inversion:
- Segment reversed
- [A B C D E] β [A D C B E]
- Breakpoints
- Common
Example:
Human chr1 vs Mouse chr1
- Many inversions
- Evolutionary events
Detection:
- Orientation change
- Dot plot
""")
print("\n=== Translocations ===")
print("""
Translocation:
- Segment moved
- [A B C] + [D E F] β [A B F] + [D E C]
- Breakpoints
- Interchromosomal
Example:
Human chr2 vs Chimpanzee chr2
- Fusion of two ancestral chromosomes
- Translocations
""")
print("\n=== Duplications ===")
print("""
Duplication:
- Segment copied
- [A B C] β [A B C A B C]
- Tandem
- Dispersed
Types:
- Tandem
- Segmental
- Whole-genome
Example:
Wheat
- Whole-genome duplication
- Multiple syntenic copies
""")
print("\n=== Deletions ===")
print("""
Deletion:
- Segment lost
- [A B C D E] β [A B D E]
- Common
- Gene loss
Example:
Human vs Chimp
- Deletions
- Gene loss
""")
print("\n=== Evolutionary Analysis ===")
print("""
Rearrangements:
- Phylogenetic markers
- Evolutionary rate
- Species relationships
Example:
Inversions
- Resolve phylogeny
- Rare genomic changes
""")π οΈ Tools (MCScanX, SyRI, Cactus)
π― Synteny & Comparative Genomics Tools
Many tools exist for synteny detection, genome alignment, and comparative genomics. Each has strengths.
Tools
MCScanX: Gene synteny. SyRI: Rearrangements. Cactus: Multiple alignment. MUMmer: Pairwise. OrthoFinder: Orthology. Ensembl: Database.
# Tools
print("=== MCScanX ===")
print("""
MCScanX:
- Gene-level synteny
- Fast
- Popular in plants
- Visualization
Input:
- GFF file
- BLAST file
Steps:
1. BLAST all vs all
2. MCScanX
3. Visualize
Command:
MCScanX species.gff
Output:
species.collinearity
Visualization:
circle_plotter
dot_plotter
java -jar circle_plotter.jar species.collinearity
""")
print("\n=== SyRI ===")
print("""
SyRI (Synteny and Rearrangement Identifier):
- Whole-genome alignment
- Detects:
- Syntenic regions
- Inversions
- Translocations
- Duplications
- Inverted duplications
- Visualization (plotsr)
Input:
- Two genomes (FASTA)
- Alignment (minimap2)
Command:
minimap2 -ax asm5 ref.fa query.fa > aln.sam
syri -c aln.sam -r ref.fa -q query.fa -F S
Output:
syri.out
syri.pdf
""")
print("\n=== Cactus ===")
print("""
Cactus:
- Multiple genome alignment
- HAL format
- Scalable
- Used by Ensembl
Input:
- Multiple genomes (FASTA)
- Tree (Newick)
Command:
cactus jobStore seqFile.txt output.hal
Output:
HAL alignment
Visualization:
halValidate
halStats
""")
print("\n=== MUMmer ===")
print("""
MUMmer:
- Pairwise alignment
- Fast
- NUCmer
- Visualization
Steps:
1. nucmer
2. delta-filter
3. show-coords
4. mummerplot
Command:
nucmer ref.fa query.fa
delta-filter -1 out.delta > out.filtered.delta
show-coords -rcl out.filtered.delta > out.coords
mummerplot --png out.filtered.delta
""")
print("\n=== OrthoFinder ===")
print("""
OrthoFinder:
- Orthology assignment
- Gene families
- Phylogenetics
Steps:
1. Input proteomes
2. BLAST
3. OrthoFinder
4. Orthologs
Command:
orthofinder -f proteomes/
Output:
Orthogroups.tsv
Orthogroups_UnassignedGenes.tsv
""")
print("\n=== Other Tools ===")
print("""
1. GENOMICUS
- Multiple alignment
- Scalable
2. MUGSY
- Multiple alignment
- Fast
3. MAUVE
- Multiple alignment
- Rearrangements
4. PROGRESSIVEMAUVE
- Multiple alignment
- Scalable
5. i-ADHoRe
- Gene synteny
- Plant genomes
6. SynOrths
- Synteny
- Orthology
7. Cyntenator
- Synteny
- Gene order
""")
print("\n=== Visualization Tools ===")
print("""
1. CIRCOS
- Circular
- Multi-genome
2. JCVI
- Linear
- Synteny
3. SYNVISIO
- Interactive
- Web-based
4. GENOME DIAGRAM
- Python
- Synteny
5. R packages
- syntenyPlotteR
- GENESPACE
""")
print("\n=== Web Servers ===")
print("""
1. Ensembl Compara
- Multi-species
- Synteny
2. PLAZA
- Plant comparative
- Synteny
3. Gramene
- Grass comparative
- Synteny
4. Phytozome
- Plant genomes
- Synteny
5. CoGe
- Comparative genomics
- Synteny
""")
print("\n=== Installation ===")
print("""
# Conda
conda install -c bioconda mcscanx syri cactus orthofinder mummer
# From source
git clone https://github.com/tanghaibao/jcvi
git clone https://github.com/schneebergerlab/syri
""")π¨ Visualization
π― Seeing Synteny
Visualization is crucial for understanding synteny. Tools like Circos, JCVI, and SynVisio provide rich visualizations.
Visualization
Circos: Circular. JCVI: Linear. SynVisio: Interactive. Dot plot: Pairwise. Python: Matplotlib. R: syntenyPlotteR.
# Visualization
print("=== Circos ===")
print("""
Circos:
- Circular visualization
- Multi-genome
- Synteny links
- Publication quality
Input:
- Karyotype
- Synteny links
- Configuration
Example:
chr - hs1 1 0 249250621
chr - mm1 1 0 195471971
hs1 mm1 100 200
""")
print("\n=== JCVI ===")
print("""
JCVI:
- Python library
- Linear synteny
- Dot plots
- Circular plots
Functions:
- synteny
- dotplot
- karyotype
- heatmap
Example:
from jcvi.graphics.karyotype import Karyotype
from jcvi.graphics.dotplot import Dotplot
""")
print("\n=== SynVisio ===")
print("""
SynVisio:
- Interactive
- Web-based
- Synteny
- Orthology
Features:
- Zoom
- Pan
- Filter
- Export
Web: synvisio.github.io
""")
print("\n=== Dot Plot ===")
print("""
Dot plot:
- Genome A vs B
- Diagonal = synteny
- Off-diagonal = rearrangement
Tools:
- MUMmer (mummerplot)
- Gepard
- D-GENIES
- Python (matplotlib)
Example:
Genome A: [A B C D E F G H]
Genome B: [A B C D E F G H]
β Diagonal line
Genome C: [A D C B E F G H]
β Inversion
""")
print("\n=== Linear Synteny ===")
print("""
Linear:
- Chromosomes as lines
- Synteny blocks as links
- Easy to read
Tools:
- JCVI
- MCScanX
- R (syntenyPlotteR)
- Python (genome_diagram)
Example:
Human chr1 ==================
Mouse chr1 ==================
| | | | | |
Synteny links
""")
print("\n=== Circular Synteny ===")
print("""
Circular:
- Genomes as circles
- Synteny as ribbons
- Multi-genome
Tools:
- Circos
- MCScanX (circle_plotter)
- JCVI
Example:
Multiple genomes
β Circular layout
β Synteny ribbons
""")
print("\n=== Python Visualization ===")
print("""
# Dot plot with matplotlib
import matplotlib.pyplot as plt
import numpy as np
def dot_plot(genome_a, genome_b):
# Simulated data
x = np.arange(len(genome_a))
y = np.arange(len(genome_b))
X, Y = np.meshgrid(x, y)
Z = (X == Y).astype(int)
plt.figure(figsize=(8, 8))
plt.scatter(X, Y, c=Z, cmap='viridis', s=1)
plt.xlabel('Genome A')
plt.ylabel('Genome B')
plt.title('Synteny Dot Plot')
plt.savefig('dotplot.png')
plt.show()
# Use
# dot_plot(genome_a, genome_b)
""")
print("\n=== R Visualization ===")
print("""
# syntenyPlotteR
library(syntenyPlotteR)
# Read data
data <- read.table("synteny.txt", header=TRUE)
# Plot
synteny_plot(data,
species = c("Human", "Mouse"),
colors = c("blue", "red")
)
# GGPlot2
library(ggplot2)
ggplot(data, aes(x=start, y=end, color=species)) +
geom_segment(aes(xend=end, yend=start)) +
theme_minimal()
""")
print("\n=== Best Practices ===")
print("""
1. Color by species
2. Show chromosome labels
3. Scale properly
4. Highlight rearrangements
5. Export high-quality
6. Use consistent colors
7. Include legend
8. Add scale bar
""")π Python Integration
π― Synteny from Python
You can run synteny tools from Python and parse outputs. Here's how.
Python
subprocess: Run CLI. Parse: Read output. Analyze: Blocks. Visualize: Plot. Automate: Pipeline. JCVI: Library.
# Python Integration
print("=== Run MCScanX ===")
print("""
import subprocess
import os
# Run MCScanX
def run_mcscanx(gff_file, blast_file):
# MCScanX requires GFF and BLAST
result = subprocess.run(
['MCScanX', gff_file],
capture_output=True,
text=True
)
return result.stdout
# Parse output
def parse_collinearity(filepath):
blocks = []
with open(filepath) as f:
for line in f:
if line.startswith('##'):
continue
parts = line.strip().split()
if len(parts) >= 3:
blocks.append(parts)
return blocks
# Use
# blocks = parse_collinearity("species.collinearity")
""")
print("\n=== Run SyRI ===")
print("""
import subprocess
def run_syri(ref, query, alignment):
# Run SyRI
cmd = ['syri', '-c', alignment, '-r', ref, '-q', query, '-F', 'S']
result = subprocess.run(cmd, capture_output=True, text=True)
return result.stdout
# Parse SyRI output
def parse_syri(filepath):
with open(filepath) as f:
for line in f:
if line.startswith('#'):
continue
parts = line.strip().split('\t')
if len(parts) >= 10:
print(parts[:5])
""")
print("\n=== Parse Synteny Blocks ===")
print("""
def parse_synteny_blocks(filepath):
\"\"\"Parse MCScanX collinearity output.\"\"\"
blocks = []
current_block = []
with open(filepath) as f:
for line in f:
if line.startswith('##'):
if current_block:
blocks.append(current_block)
current_block = []
continue
if line.startswith('#'):
continue
parts = line.strip().split()
if len(parts) >= 3:
current_block.append(parts)
if current_block:
blocks.append(current_block)
return blocks
# Analyze
def analyze_blocks(blocks):
print(f"Number of blocks: {len(blocks)}")
for i, block in enumerate(blocks):
print(f"Block {i}: {len(block)} genes")
for gene in block[:3]:
print(f" {gene}")
# Use
# blocks = parse_synteny_blocks("species.collinearity")
# analyze_blocks(blocks)
""")
print("\n=== Visualize with Python ===")
print("""
import matplotlib.pyplot as plt
import numpy as np
def plot_synteny(blocks, output="synteny.png"):
\"\"\"Plot synteny blocks.\"\"\"
fig, ax = plt.subplots(figsize=(12, 6))
y_offset = 0
for i, block in enumerate(blocks):
for j, gene in enumerate(block):
x = j * 10
ax.plot([x, x+8], [y_offset, y_offset],
color='purple', linewidth=2)
y_offset += 10
ax.set_xlabel("Position")
ax.set_ylabel("Block")
ax.set_title("Synteny Blocks")
plt.tight_layout()
plt.savefig(output)
plt.show()
# Use
# plot_synteny(blocks)
""")
print("\n=== JCVI Library ===")
print("""
# JCVI is a Python library for comparative genomics
from jcvi.graphics.karyotype import Karyotype
from jcvi.graphics.dotplot import Dotplot
from jcvi.apps.base import OptionParser
# Create karyotype plot
def plot_karyotype(data_file, output="karyotype.pdf"):
k = Karyotype(data_file)
k.draw(output)
# Use
# plot_karyotype("karyotype.txt")
""")
print("\n=== Complete Pipeline ===")
print("""
def synteny_pipeline(ref_gff, query_gff, ref_fa, query_fa):
\"\"\"Complete synteny pipeline.\"\"\"
# 1. BLAST
subprocess.run([
'makeblastdb', '-in', ref_fa, '-dbtype', 'prot'
])
subprocess.run([
'blastp', '-query', query_fa, '-db', ref_fa,
'-outfmt', '6', '-out', 'blast.txt'
])
# 2. MCScanX
subprocess.run(['MCScanX', ref_gff])
# 3. Parse
blocks = parse_synteny_blocks('species.collinearity')
# 4. Analyze
analyze_blocks(blocks)
return blocks
# Use
# blocks = synteny_pipeline("ref.gff", "query.gff", "ref.fa", "query.fa")
""")
print("\n=== Statistics ===")
print("""
def synteny_stats(blocks):
\"\"\"Compute synteny statistics.\"\"\"
total_genes = sum(len(b) for b in blocks)
avg_genes = total_genes / len(blocks) if blocks else 0
print(f"Total blocks: {len(blocks)}")
print(f"Total genes: {total_genes}")
print(f"Average genes per block: {avg_genes:.2f}")
# Largest block
largest = max(blocks, key=len)
print(f"Largest block: {len(largest)} genes")
# Use
# synteny_stats(blocks)
""")πΌ Use Cases
π― Where Synteny Is Used
Synteny and comparative genomics are used across biology: phylogenetics, crop improvement, genome assembly, and more.
Use Cases
Phylogenetics: Trees. Crop: Breeding. Assembly: Scaffold. Annotation: Transfer. Evolution: Rearrangements. Pangenome: Core.
# Use Cases
print("=== 1. Phylogenetics ===")
print("""
Use case:
- Evolutionary relationships
- Rearrangements as markers
- Species tree
Workflow:
1. Synteny analysis
2. Rearrangement detection
3. Phylogenetic tree
4. Analysis
Example:
Inversions
- Phylogenetic markers
- Resolve relationships
""")
print("\n=== 2. Crop Improvement ===")
print("""
Use case:
- Model to crop
- Gene discovery
- Marker-assisted breeding
Workflow:
1. Synteny with model
2. Identify orthologs
3. Transfer function
4. Breed
Example:
Rice drought gene
β Synteny in wheat
β Marker-assisted breeding
""")
print("\n=== 3. Genome Assembly ===")
print("""
Use case:
- Scaffold contigs
- Order and orient
- Improve assembly
Workflow:
1. Draft genome
2. Synteny to reference
3. Order scaffolds
4. Validate
Example:
Draft wheat
β Synteny to rice
β Ordered scaffolds
""")
print("\n=== 4. Functional Annotation ===")
print("""
Use case:
- Transfer annotation
- Orthologs
- Gene function
Workflow:
1. Synteny
2. Orthologs
3. Transfer function
4. Validate
Example:
Arabidopsis gene
β Syntenic in rice
β Rice function inferred
""")
print("\n=== 5. Gene Family Evolution ===")
print("""
Use case:
- Duplications
- Losses
- Synteny context
Workflow:
1. Synteny blocks
2. Gene family
3. Duplication history
4. Analysis
Example:
MADS-box genes
- Synteny blocks
- Duplication history
- Functional divergence
""")
print("\n=== 6. Pangenomics ===")
print("""
Use case:
- Core + dispensable
- Synteny across accessions
- Crop diversity
Workflow:
1. Multiple genomes
2. Synteny
3. Core/dispensable
4. Analysis
Example:
Maize pangenome
- Core synteny
- Variable regions
""")
print("\n=== 7. Medical Genomics ===")
print("""
Use case:
- Human vs mouse
- Disease models
- Conserved regions
Workflow:
1. Synteny
2. Orthologs
3. Disease models
4. Analysis
Example:
Human disease gene
β Mouse ortholog
β Model organism
""")
print("\n=== 8. Ancestral Reconstruction ===")
print("""
Use case:
- Infer ancestral genome
- Reconstruct evolution
- Understand genome architecture
Workflow:
1. Many species
2. Synteny blocks
3. Ancestral reconstruction
4. Analysis
Example:
Ancestral flowering plant
β 7 chromosomes
β Modern plants
""")
print("\n=== 9. Genome Evolution ===")
print("""
Use case:
- Rearrangement history
- Evolutionary rates
- Genome dynamics
Workflow:
1. Synteny
2. Rearrangements
3. Evolutionary analysis
4. Interpretation
Example:
Human vs Mouse
- 90% synteny
- 80 rearrangements
- Evolutionary rate
""")
print("\n=== 10. Breeding ===")
print("""
Use case:
- Marker-assisted selection
- Trait transfer
- Genomic selection
Workflow:
1. Synteny
2. QTL transfer
3. Marker design
4. Breeding
Example:
Wheat
- Synteny with rice
- QTL transfer
- Marker-assisted selection
""")βοΈ Tool Comparison
π― Which Tool?
Choosing the right synteny tool depends on data type, scale, and analysis goals.
Comparison
MCScanX: Gene synteny. SyRI: Rearrangements. Cactus: Multiple. MUMmer: Pairwise. OrthoFinder: Orthology. Ensembl: Database.
| Tool | Type | Speed | Best For | Output |
|---|---|---|---|---|
| MCScanX | Gene synteny | Fast | Plant genomes | Collinearity file |
| SyRI | Rearrangements | Medium | Structural variants | Rearrangement table |
| Cactus | Multiple alignment | Slow | Multi-genome | HAL alignment |
| MUMmer | Pairwise | Fast | Dot plots | Delta file |
| OrthoFinder | Orthology | Medium | Gene families | Orthogroups |
| GENOMICUS | Multiple | Slow | Scalable | Alignment |
| MAUVE | Multiple | Medium | Rearrangements | Alignment |
| i-ADHoRe | Gene synteny | Medium | Plant genomes | Blocks |
# Decision Guide
print("=== Choose Tool by Task ===")
print("""
Gene-level synteny:
β MCScanX (fast)
β i-ADHoRe (plants)
β SynOrths
Whole-genome alignment:
β Cactus (multiple)
β MUMmer (pairwise)
β minimap2 (fast)
Rearrangements:
β SyRI
β MUMmer
β Assemblytics
Orthology:
β OrthoFinder
β Ensembl Compara
Visualization:
β Circos (circular)
β JCVI (linear)
β SynVisio (interactive)
β Dot plot
""")
print("\n=== Speed Comparison ===")
print(f"{'Tool':<20} {'2 genomes':<15} {'10 genomes':<15} {'100 genomes':<15}")
print("-" * 65)
print(f"{'MUMmer':<20} {'< 1 min':<15} {'10 min':<15} {'Too slow':<15}")
print(f"{'minimap2':<20} {'< 1 min':<15} {'5 min':<15} {'1 hour':<15}")
print(f"{'MCScanX':<20} {'5 min':<15} {'30 min':<15} {'10 hours':<15}")
print(f"{'SyRI':<20} {'10 min':<15} {'2 hours':<15} {'Too slow':<15}")
print(f"{'Cactus':<20} {'1 hour':<15} {'10 hours':<15} {'Days':<15}")
print("\n=== When to Use Which ===")
print("""
USE MCScanX:
β Gene-level synteny
β Plant genomes
β Fast
β Visualization
USE SyRI:
β Rearrangements
β Structural variants
β Whole-genome
β Publication
USE Cactus:
β Multiple genomes
β Large scale
β Ensembl
β HAL format
USE MUMmer:
β Pairwise
β Dot plots
β Fast
β Simple
USE OrthoFinder:
β Orthology
β Gene families
β Phylogenetics
β Standard
""")β FAQ
π― Frequently Asked Questions
Answers to common questions about synteny and comparative genomics.
What is synteny?
Synteny refers to the conservation of gene order along chromosomes between different species or within a genome. When genes are found in the same order on chromosomes of two species, they are said to be syntenic. It is a powerful signal of shared ancestry and functional constraint.
What is the difference between synteny and collinearity?
Synteny means genes are on the same chromosome (or conserved order), while collinearity strictly means genes are in the same order without rearrangement. Collinearity is a stricter form of synteny where gene order is perfectly conserved. In practice, the terms are often used interchangeably.
Which tool is best for synteny analysis?
Use MCScanX for gene-level synteny and collinearity (fast, popular). Use SyRI for whole-genome alignment and structural rearrangement detection (excellent for plant genomes). Use Cactus for multiple genome alignment. For visualization: Circos, JCVI, and SynVisio.
What is a synteny block?
A synteny block (or conserved synteny block) is a genomic region where a set of genes appears in the same order across two or more genomes. These blocks are identified by comparing gene orders and are the basic unit of synteny analysis.
How is comparative genomics used in crop improvement?
Comparative genomics and synteny help transfer knowledge from model species (e.g., Arabidopsis, rice) to crops. If a gene for drought tolerance is known in rice, synteny can identify the orthologous gene in wheat or maize. This accelerates breeding and gene discovery.
What are the main types of genome rearrangements?
The main types are: inversions (segment reversed), translocations (segment moved), duplications (segment copied), deletions (segment lost), and insertions (segment added). Synteny analysis reveals these evolutionary events.
How do I visualize synteny?
Use Circos for circular multi-genome plots, JCVI for linear plots and dot plots, SynVisio for interactive web-based visualization, or MCScanX visualization tools. Python and R also have libraries for custom plots.
What is ancestral genome reconstruction?
Ancestral genome reconstruction infers the gene order of an ancestral species by comparing synteny blocks across multiple modern species. It helps understand genome evolution and is used to study polyploidy and chromosomal evolution.
Can synteny be used for genome assembly?
Yes. Synteny to a closely related reference genome is commonly used to scaffold draft assemblies β ordering and orienting contigs or scaffolds. Tools like SyRI, MUMmer, and MCScanX can help.
What is the difference between synteny and orthology?
Synteny is about gene order along chromosomes. Orthology is about gene ancestry β orthologs are genes in different species that descended from a common ancestor. Synteny often helps identify true orthologs by providing genomic context.
# Quick Reference
print("=== Quick Answers ===")
print("""
Q: What is synteny?
A: Conservation of gene order.
Q: Synteny vs collinearity?
A: Synteny = same chromosome; collinearity = same order.
Q: Best tool?
A: MCScanX (gene), SyRI (rearrangements), Cactus (multiple).
Q: How to visualize?
A: Circos, JCVI, SynVisio, dot plots.
Q: Orthologs?
A: Same gene, different species.
Q: Paralogs?
A: Duplication, same species.
Q: Rearrangements?
A: Inversions, translocations, duplications.
Q: Crop improvement?
A: Transfer knowledge from model to crop.
Q: Genome assembly?
A: Scaffold using synteny to reference.
Q: Ancestral genome?
A: Reconstruct ancestral gene order.
Q: Free tools?
A: Yes β all major tools are free.
""")π Future
π― Where Synteny Is Going
The future is pangenomics, graph genomes, AI-augmented, and ultra-large-scale comparative genomics.
Future Directions
Pangenome: Graph. AI: Learned. Scale: Thousands. Integration: Multi-omics. Cloud: Serverless. Single-cell: Spatial.
# Future of Synteny
print("=== 1. Pangenomics ===")
print("""
Trend: Pangenome graphs
Traditional:
- Linear reference
- Pairwise synteny
Pangenome:
- Graph reference
- All accessions
- Core + dispensable
Tools:
- vg toolkit
- Minigraph
- Panacus
- ODGI
Future:
- Graph synteny
- Population scale
- Better variation
""")
print("\n=== 2. AI-Augmented ===")
print("""
Trend: Deep learning
Ideas:
- Learned synteny
- Neural alignment
- Transformer models
- Protein language models
Examples:
- AlphaFold
- ESM
- Nucleotide Transformer
Future:
- Learned synteny
- Better sensitivity
- Faster
""")
print("\n=== 3. Ultra-Large Scale ===")
print("""
Trend: Thousands of genomes
Current:
- Tens of genomes
- Hundreds max
Future:
- Thousands of genomes
- Pangenomes
- Cloud computing
Tools:
- ProgressiveCactus
- Cactus
- PanGenome
Future:
- Scalable algorithms
- Divide-and-conquer
- Approximation
""")
print("\n=== 4. Integration ===")
print("""
Trend: Multi-omics
Current:
- Genomics only
Future:
- Genomics + transcriptomics
- Genomics + proteomics
- Genomics + metabolomics
Examples:
- Single-cell
- Spatial
- Multi-omics
Future:
- Integrated analysis
- Systems biology
- Better interpretation
""")
print("\n=== 5. Cloud-Native ===")
print("""
Trend: Cloud synteny
Current:
- Self-managed
- Manual scaling
Future:
- Serverless
- Auto-scaling
- Pay per use
- Global
Examples:
- AWS HealthOmics
- Google Cloud
- Azure Genomics
- Terra
""")
print("\n=== 6. Single-Cell ===")
print("""
Trend: Single-cell synteny
Current:
- Bulk genomes
Future:
- Single-cell
- Spatial
- Cell-type specific
Examples:
- Single-cell DNA
- Spatial genomics
- Cell atlas
Future:
- Single-cell synteny
- Cell-type resolution
- Developmental
""")
# TIMELINE
print("\n=== Timeline ===")
print("""
Past:
1980s: First synteny
1990s: Comparative mapping
2000s: Whole-genome synteny
2010s: Large-scale
2020s: Pangenomes
Present:
2025: Graph genomes
2026: AI-augmented
Future:
2030: Population-scale
2035: Single-cell
2040: Quantum?
""")
print("\n=== Final Thoughts ===")
print("""
Synteny is:
- Fundamental to comparative genomics
- Needed for orthology
- Needed for crop improvement
- Needed for assembly
- Key to evolution
The future is:
- Pangenome
- AI-augmented
- Ultra-large
- Cloud-native
- Integrated
"Synteny is the key to understanding
genome evolution and function."
Keep exploring. Keep building.
""")