PySyntenyViz
A CLI to create and annotate synteny plots for microbial genomes or plasmids. It uses GenBank files as input and creates alignment on the fly. It provides additional tools to edit the GenBank files to customize the synteny plot.
Requirement
MUMmer and/or MMSeqs should be installed to run the aligner.
Installation
Install from PyPI
pip install PySyntenyViz
Install from source:
git clone https://github.com/acarafat/PySyntenyViz/
cd PySyntenyViz
pip install .
Alternatively to build and install from source using pip wheel:
pip install wheel
git clone https://github.com/acarafat/PySyntenyViz/
cd PySyntenyViz
python3 setup.py sdist bdist_wheel
pip install dist/bioinfutils-0.1.0-py3-none-any.whl --force-reinstall
Also, you can use the Dockerfile to build and run image.
Usage
pysyntenyviz <command> [<args>]
Available commands: synteny, revcomp, reorder, change_origin
Commands
synteny: Generate synten plotchange_origin: Change origin of a GenBank filerevcomp: Reverse-complement particular contig or whole GenBank file sequencereorder: Reorder contigs of GenBakn file
Getting help
Use -h or --h flag to get details of the command, i.e.: pysyntenyviz <command> --help
Annotation options
There are two options for annotating the synteny plot. One option is by providing GenBank features, which will annotate the particular feature of interest based on its presence in the GenBank file. Another option is to provide exact coordinates, so that those coordinates will be annotated specifically.
Generating Synteny with two different annotation options
Input file strainlist.txt:
/path/to/Strain_1.gbk
/path/to/Strain_2.gbk
/path/to/Strain_3.gbk
Coordinate file for annotation using --coordinate flag: coordinates.tsv
| gbk | locus | label | start | end | color | strand | plotstyle |
|---|---|---|---|---|---|---|---|
| Strain_1 | Contig_1 | nod | 5413 | 14992 | blue | 1 | box |
| Strain_1 | Contig_1 | nif/fix | 19407 | 42752 | magenta | 1 | box |
| Strain_1 | Contig_1 | nif/fix | 175637 | 187210 | magenta | 1 | box |
| Strain_1 | Contig_1 | T4SS | 357052 | 370816 | brown | 1 | box |
| Strain_1 | Contig_1 | bio | 377557 | 381609 | black | 1 | box |
| Strain_1 | Contig_1 | pan | 386274 | 387991 | black | 1 | box |
| Strain_1 | Contig_1 | nod | 391054 | 393012 | blue | 1 | box |
| Strain_1 | Contig_1 | nif/fix | 421473 | 429473 | magenta | 1 | box |
| Strain_1 | Contig_1 | T4SS | 557560 | 569180 | brown | 1 | box |
| Strain_2 | Contig_1 | nod | 3972 | 9259 | blue | 1 | box |
| Strain_2 | Contig_1 | nif/fix | 30871 | 44544 | magenta | 1 | box |
| Strain_2 | Contig_1 | nif/fix | 68132 | 84403 | magenta | 1 | box |
| Strain_2 | Contig_1 | bio | 297983 | 302023 | black | 1 | box |
| Strain_2 | Contig_1 | pan | 306814 | 308405 | black | 1 | box |
| Strain_2 | Contig_1 | nif/fix | 330400 | 338787 | magenta | 1 | box |
| Strain_2 | Contig_1 | T4SS | 392045 | 403669 | brown | 1 | box |
Command for synteny plot:
pysyntenyviz synteny --input_list strainlist.txt --output synteny_output.pdf --alignment mmseqs --coordinate coordinates.tsv
If you want to use feature types for generic annotation, use the --annotate flag and provide annotation.tsv file instead:
| feature_type | qualifier | value | face_color | label |
|---|---|---|---|---|
| CDS | product | bio | black | bio |
| gene | gene | nif | magenta | nif |
| gene | gene | nod | magenta | nod |
| gene | gene | fix | magenta | fix |
| mobile_element | mobile_element_type | T4SS | brown | ICE |
Command:
pysyntenyviz synteny --input_list strainlist.txt --output synteny_output.pdf --alignment mmseqs --annotate annotate.tsv
Examples
Read GenBank files as input from directory, plot Agrobacterium synteny with MMSeqs2 alignment and annotate by GenBank feature:
pysyntenyviz synteny --input_dir agrobacterium --output agro_original.png --annotate annotate_synteny.tsv --alignment mmseqs
Use MUMmer alignment instead:
pysyntenyviz synteny --input_dir agrobacterium --output agro_original.mummer.png --annotate annotate_synteny.tsv
Reverse-complement a contig and plot synteny, take input from a list:
pysyntenyviz revcomp -i agrobacterium/47_2_polished_final_renamed.gbk -o agrobacterium/47_2_polished_final_renamed.rc.gbk -c chromosome
pysyntenyviz synteny --input_list agrolist.txt --output agro_rc.mmseqs.png --alignment mmseqs --annotate annotate_synteny.tsv
Reorder contigs by custom-order and plot synteny:
grep "LOCUS" agrobacterium/47_2_polished_final_renamed.rc.gbk
pysyntenyviz reorder --input agrobacterium/47_2_polished_final_renamed.rc.gbk --output agrobacterium/47_2_polished_final_renamed.rc.order.gbk --order chromosome chromid pTi plasmid1 plasmid2
grep "LOCUS" agrobacterium/47_2_polished_final_renamed.rc.order.gbk
Reorder contigs by size and plot synteny:
grep "LOCUS" agrobacterium/47_2_polished_final_renamed.rc.gbk
pysyntenyviz reorder --input agrobacterium/47_2_polished_final_renamed.rc.gbk --output agrobacterium/47_2_polished_final_renamed.rc.order.gbk --by_size
grep "LOCUS" agrobacterium/47_2_polished_final_renamed.rc.order.gbk
Change contig origin in GenBank file and plot synteny:
pysyntenyviz change_origin -i agrobacterium/47_2_polished_final_renamed.rc.order.gbk -o agrobacterium/47_2_polished_final_renamed.rc.order.origin.gbk --origin 346694 --contig chromosome_rc
pysyntenyviz synteny --input_list agrolist.txt --output agro_rc.mmseqs.png --alignment mmseqs --annotate annotate_synteny.tsv
Annotate synteny with specific feature coordinates:
pysyntenyviz synteny --input_list bradylist.txt --output brady_original.mmseqs.png --alignment mmseqs --coordinate coordinates.tsv
Citation
Sanath-Kumar R, Rahman A, Ren Z, Reynolds IP, Augusta L, Fuqua C, Weisberg AJ, Wang X. 2025. Linear dicentric chromosomes in bacterial natural isolates reveal common constraints for replicon fusion. mBio 16:e01046-25.
https://doi.org/10.1128/mbio.01046-25
Metadata
Release files for PySyntenyViz 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pysyntenyviz-0.2.3.tar.gz | 11.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pysyntenyviz-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.2 kB
Release files / pysyntenyviz-0.2.3.tar.gz
| Download URL | pysyntenyviz-0.2.3.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e4a8f2460a245bbb2c07876ff4a72c27eea1bb9d8e85358fde7647bcb0603ce
|
|
BLAKE2b-256 checksum How to use checksums |
fd3e96dcf736b486a3a8dc8ce1e3f026257c9e39caef0112d34736224e1e062b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / pysyntenyviz-0.2.3-py3-none-any.whl
| Download URL | pysyntenyviz-0.2.3-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c2d989c58402692341466f182fe058a4ec25dc0ab9fcfb95cd0705e4e0b62cd
|
|
BLAKE2b-256 checksum How to use checksums |
3c10c6bd169d042eeae0e58da6f2693ba8ec80150f71760197d779ec262121df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|