https://github.com/althonos/pyorthoani
A Python implementation of the OrthoANI algorithm for nucleotide identity measurement.
https://github.com/althonos/pyorthoani
average-nucleotide-identity bioinformatics biopython orthoani python python-module
Last synced: 4 months ago
JSON representation
A Python implementation of the OrthoANI algorithm for nucleotide identity measurement.
- Host: GitHub
- URL: https://github.com/althonos/pyorthoani
- Owner: althonos
- License: mit
- Created: 2020-06-15T14:59:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-07-21T16:17:32.000Z (6 months ago)
- Last Synced: 2025-08-01T03:53:20.877Z (5 months ago)
- Topics: average-nucleotide-identity, bioinformatics, biopython, orthoani, python, python-module
- Language: Python
- Size: 2.23 MB
- Stars: 31
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: COPYING
- Citation: CITATION.cff
Awesome Lists containing this project
README
# PyOrthoANI [](https://github.com/althonos/orthoani/stargazers)
*A Python implementation of the [OrthoANI](https://doi.org/10.1099/ijsem.0.000760) algorithm for nucleotide identity measurement.*
[](https://github.com/althonos/pyorthoani/actions)
[](https://choosealicense.com/licenses/mit/)
[](https://github.com/althonos/pyorthoani/)
[](https://codecov.io/gh/althonos/pyorthoani/)
[](https://pypi.org/project/pyorthoani)
[](https://pypi.org/project/pyorthoani/#files)
[](https://pypi.org/project/pyorthoani/#files)
[](https://pypi.org/project/pyorthoani/#files)
[](https://github.com/althonos/pyorthoani/)
[](https://github.com/althonos/pyorthoani/issues)
[](https://github.com/althonos/pyorthoani/blob/master/CHANGELOG.md)
[](https://pepy.tech/project/pyorthoani)
[](https://academic.oup.com/nargab/article/7/3/lqaf095/8196481)
## πΊοΈ Overview
OrthoANI is a metric proposed by Lee *et al.*[\[1\]](#ref1)
in 2016 to improve computation of Average Nucleotide Identity. It uses
[BLASTn](https://en.wikipedia.org/wiki/BLAST_(biotechnology)) to find orthologous
blocks in a pair of sequences, and then computes the average identity only
considering alignments of reciprocal orthologs.

PyOrthoANI is a reimplementation of the closed-source Java implementation
provided by the authors on [`ezbiocloud.net`](https://www.ezbiocloud.net/sw/oat).
It relies on [Biopython](https://biopython.org/) to handle the I/O, and calls
the BLAST+ binaries using the `subprocess` module of the Python standard
library.
## π§ Installing
Installing with `pip` is the easiest:
```console
$ pip install pyorthoani
```
PyOrthoANI also requires the BLAST+ binaries to be installed on your machine
and available somewhere in your `$PATH`.
## π‘ Example
Use Biopython to load two FASTA files, and then `orthoani.orthoani` to compute
the OrthoANI metric between them:
```python
import pyorthoani
from Bio.SeqIO import read
genome_1 = read("sequence1.fa", "fasta")
genome_2 = read("sequence2.fa", "fasta")
ani = pyorthoani.orthoani(genome_1, genome_2)
```
`pyorthoani` can also be used from the CLI using a very simple command-line
interface mimicking the original Java tool:
```console
$ pyorthoani -q sequence1.fa -r sequence2.fa
57.25
```
## π Memory
`orthoani` uses the machine temporary folder to handle BLAST+ input and output
files, which is configurable through
[`tempfile.tempdir`](https://docs.python.org/3/library/tempfile.html#tempfile.tempdir).
On some systems (like ArchLinux), this filesystem can reside in memory, which means
that your computer could have trouble processing very large files. If this
happens, try changing the value of the `tempfile.tempdir` to a directory that
is actually located on physical storage.
## π Precision
Values computed by this package and the original Java implementation may differ
slightly because in Java the authors perform rounding of floating-point values
at the sub-percent level, while this library uses the full values.
## π Citation
If you found PyOrthoANI useful, please cite [our paper](https://academic.oup.com/nargab/article/7/3/lqaf095/8196481), as well as the original [OrthoANI paper](https://www.microbiologyresearch.org/content/journal/ijsem/10.1099/ijsem.0.000760#tab2).
To cite PyOrthoANI:
> Martin Larralde, Georg Zeller, Laura M. Carroll. 2025. PyOrthoANI, PyFastANI, and Pyskani: a suite of Python libraries for computation of average nucleotide identity. *NAR Genomics and Bioinformatics* 7(3):lqaf095. doi:10.1093/nargab/lqaf095.
To cite OrthoANI:
> Imchang Lee, Yeong Ouk Kim, Sang-Cheol Park, Jongsik Chun. 2016. OrthoANI: An improved algorithm and software for calculating average nucleotide identity. *International Journal of Systematic and Evolutionary Microbiology* 66(2):1100-1103. doi:10.1099/ijsem.0.000760.
## π About
This library is provided under the open-source
[MIT license](https://choosealicense.com/licenses/mit/).
*This project is in no way not affiliated, sponsored, or otherwise endorsed by
the [original OrthoANI authors](http://www.chunlab.com/). It was developed by
[Martin Larralde](https://github.com/althonos/orthoani) during his PhD project
at the [European Molecular Biology Laboratory](https://www.embl.de/) in
the [Zeller team](https://github.com/zellerlab).*
## π References
- \[1\] Imchang Lee, Yeong Ouk Kim, Sang-Cheol Park and Jongsik Chun. *OrthoANI: An improved algorithm and software for calculating average nucleotide identity* (2016). International Journal of Systematic and Evolutionary Microbiology. [doi:10.1099/ijsem.0.000760](https://doi.org/10.1099/ijsem.0.000760). [PMID:26585518](https://pubmed.ncbi.nlm.nih.gov/26585518/).