Metadata-Version: 2.5
Name: omnitax
Version: 0.1.0
Summary: Biological taxonomies (NCBI, GTDB and a few more) as Python objects, in one SQLite file or behind a small server, with a benchmarked way to translate between NCBI and GTDB.
Project-URL: Homepage, https://abrinca.github.io/omnitax/
Project-URL: Documentation, https://abrinca.github.io/omnitax/
Project-URL: Repository, https://github.com/Abrinca/omnitax
Author: Thomas Roder, Abrinca Genomics
License-Expression: MIT
License-File: LICENSE
Keywords: bioinformatics,lineage,ncbi,taxid,taxonomy
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: httpx
Provides-Extra: server
Requires-Dist: anyio; extra == 'server'
Requires-Dist: starlette; extra == 'server'
Requires-Dist: uvicorn; extra == 'server'
Provides-Extra: taxdump
Requires-Dist: xxhash; extra == 'taxdump'
Description-Content-Type: text/markdown

# omnitax

Biological taxonomies (NCBI, GTDB and a few more) as Python objects, in one SQLite file or behind a small server, with a benchmarked way to translate between NCBI and GTDB.

> **Please read first.** omnitax was written with LLM coding agents and reviewed by a human. It is largely untested in practice: it has one real user so far ([sylphd](https://github.com/Abrinca/sylphd)). APIs may change before 1.0. It runs on Linux only for now. Check results on your own data before you rely on them.

## Goals

1. **Many taxonomies, handled the same way**: download, parse, one set of Python objects, conversion, export to standard formats. "All taxonomies" is not the aim; the common ones for microbiome work, and a pattern to add more, is.
2. **One API, several backends**: a SQLite file, or a server on a Unix socket or HTTP, with the same answers.
3. **Benchmarked translation between taxonomies**, with the method and results published. NCBI ↔ GTDB first.
4. **Taxonomies you can change**: your own taxa as a small set of files that is applied again to every new release.
5. **Reproducibility**: dated, checksummed snapshots of several taxonomies and versions in one file.

## What works today

- Loaders for NCBI (current, or any monthly archive since 2018-12), GTDB 80 to 232, SILVA, Greengenes2, Open Tree, custom tables, and taxdump files (gtdb-taxdump, ictv-taxdump, TaxonKit output). SILVA, Greengenes2 and Open Tree load the real files but have had little more checking than that.
- Lineages, ranks, LCA, consensus, exact and fuzzy name search, subsets and edits, export as a taxdump or a table.
- Translation between NCBI and GTDB through shared genome accessions. Only GTDB 232 → NCBI has been measured; see [Translation](https://abrinca.github.io/omnitax/guides/translation/).
- Your own taxa as an overlay, a few files applied to each rebuild.
- A server, a client, and a command line (`build`, `list`, `lookup`, `lineage`, `search`, `translate`, `link`, `annotate`, `export-taxdump`, `serve`).

## What does not work yet

SILVA, Greengenes2 and Open Tree cannot be translated to anything (no loader makes links for them). Not supported: native ICTV, GBIF, Catalogue of Life, UNITE, PR2, LTP, RDP, BOLD. Export is a taxdump or a table; there is no Newick or QIIME-style output. Linux only: Windows and macOS are not supported. See the [roadmap](https://github.com/Abrinca/omnitax/blob/main/ROADMAP.md).

## Install

```bash
uv add omnitax                           # the library (needs only httpx); or: pip install omnitax
uv tool install 'omnitax[server]'        # the command line, with `omnitax serve`
```

Python 3.12 or newer.

## Use

```bash
omnitax build -o taxonomies.sqlite ncbi+gtdb:232 gtdb:232    # downloads about 500 MB, takes minutes
omnitax lookup --db taxonomies.sqlite -t ncbi 562 "Homo sapiens"
omnitax translate --db taxonomies.sqlite -t gtdb:232 --to ncbi "s__Escherichia coli"
```

```python
import omnitax

ncbi = omnitax.open("taxonomies.sqlite", "ncbi")
ncbi["562"].lineage_string()          # d__Bacteria;p__Pseudomonadota;...;s__Escherichia coli
ncbi.consensus({"562": 6, "564": 4}, threshold=0.5, exclude=ncbi.uninformative)
tiny = ncbi.subset(["561"], descendants=True)       # a new taxonomy, in a temporary file
```

Documentation: <https://abrinca.github.io/omnitax/>

## Credits

- [sylphd](https://github.com/Abrinca/sylphd): omnitax began as its NCBI taxonomy code.
- [multitax](https://github.com/pirovc/multitax) (MIT): the source URLs and file formats, and the inspiration.
- [get-tax-info](https://github.com/MrTomRod/get-tax-info): an earlier tool that loads NCBI's taxdump into SQLite.
- [TaxonKit](https://github.com/shenwei356/taxonkit) (MIT): the recipe for taxids of taxonomies that have none.
- [gtdb-taxdump](https://github.com/shenwei356/gtdb-taxdump): the published taxdumps that omnitax's output is checked against.

How omnitax differs from these and from related tools is on [its own page](https://abrinca.github.io/omnitax/project/comparison/).

## Licence

MIT.
