phylotypy
A Naive Bayesian Classifier for 16S rRNA gene sequences, inspired by the phylotypr R package by Riffomonas. Designed for classifying amplicon sequence variants (ASVs) from DADA2, QIIME2, or raw FASTA files against a reference database of 16S rRNA sequences. PhylotyPY was built to run on a laptop with modest hardware. The project is memory opitmized and takes advantage of a computer's mutiple cpus.
DADA2's assignTaxonomy has no option to save and reuse a classifier. And large reference fasta files like Silva can tie up a computer for an extended time period. QIIME2 requires conda installation and produces artifact files needing to be inter-converted.
Phylotypy was created to be a drop-in replacement for DADA2 and QIIME2's classifcation steps. Phylotypy takes fasta files and csv/tsv file as input options. The output is a tsv file with columns containing several lineage formats and separate taxonomic levels:
# lineage with percent confidence scrores
Bacteria(100);Pseudomonadota(95);Deltaproteobacteria(92);Desulfovibrionales(92);Desulfovibrionaceae(90);Desulfovibrio(80)
# semicolon separate lineage
Bacteria;Pseudomonadota;Deltaproteobacteria;Desulfovibrionales;Desulfovibrionaceae;Desulfovibrio
# qiime formated lineage
k__Bacteria;p__Pseudomonadota;c__Deltaproteobacteria;o__Desulfovibrionales;f__Desulfovibrionaceae;g__Desulfovibrio
| Kingdom | Phylum | Class | Order | Family | Genus |
|---|---|---|---|---|---|
| Bacteria | Pseudomonadota | Deltaproteobacteria | Desulfovibrionales | Desulfovibrionaceae | Desulfovibrio |
Phylotypy was written from the ground up but using methods presented in Riffamonas's CodeClub series. I want to thank P. Schloss and Riffomonas for the inspiration to write phylotypy. Check out the videos on his YouTube channel.
Performance
The full RDP reference database takes ~7.5 seconds and the full Silva reference database (genus level) takes ~19 seconds on a 2020 Apple Intel MacBook Pro with 16Gb of RAM. Newer systems should see a substantial increase in performance.
How to Install
Using pip:
pip install phylotypy
Using uv (recommended — how to install uv):
uv pip install phylotypy
Note: Intel Mac (x86_64) users are limited to numba 0.62.1, which is pinned in this package. Apple Silicon (M-series) users are not affected.
Quickstart
Download the RDP reference training set and an example dataset (see Training Data for details and download links), then classify from the command line:
phylotypy classify --input dna_moving_pictures.fasta \
--db rdp_16S_v19.dada2.fasta \
--out classified_seqs.tsv \
--save-db rdp_classifer.pickle \
--terminal-report \
--verbose
--save-db pickles the built classifier so later runs against the same reference
skip rebuilding it. --terminal-report prints a bar-chart summary of the results
straight to the terminal:
Phylum-level summary 770 sequences · 20 taxa (19 named)
────────────────────────────────────────────────────────────────────────────────
Bacillota ████████████████████████████████████████████ 277 36.0%
Pseudomonadota ███████████████████████▉ 150 19.5%
Bacteroidota █████████████████████▊ 137 17.8%
Bacteria_unclassified ██████████▋ 67 8.7%
Actinomycetota ██████████ 63 8.2%
...
────────────────────────────────────────────────────────────────────────────────
resolved at phylum: 703/770 (91.3%) · mean confidence 98.4
You can also regenerate that same chart later from a results file, without
re-classifying, using phylotypy report:
phylotypy report --input classified_seqs.tsv
See docs/cli-reference.md for reusing a saved database,
the terminal report's rank/top options, the report subcommand, and full
--help output for build, classify, and report.
Using the API instead
The same steps from a Python script or notebook:
from phylotypy import classifier, results, read_fasta
rdp = read_fasta.read_taxa_fasta("rdp_16S_v19.dada2.fasta")
moving_pics = read_fasta.read_taxa_fasta("dna_moving_pictures.fasta")
database = classifier.make_classifier(rdp)
classified = classifier.classify_sequences(moving_pics, database)
classified = results.summarize_predictions(classified)
classified.to_csv("classified_results.csv")
See docs/api-guide.md for the full walkthrough, including formatting/export options and example output.
Documentation
- docs/training-data.md — downloading reference data, required FASTA header format, and fixing "ragged" (inconsistent-depth) taxonomy strings
- docs/cli-reference.md — full CLI usage: building/reusing a
database, the terminal report, and
--helpoutput for every subcommand - docs/api-guide.md — step-by-step API usage and a complete code example
- benchmarks/ — speed comparisons against other 16S classification tools
Working with Your Own Data
phylotypy works with FASTA files from DADA2, QIIME2, or any standard pipeline. See read_fasta.py for utilities to load and convert sequence data into the required format.
A complete walkthrough is available in vignette.py.
Requirements
Dependencies are installed automatically via pip. See pyproject.toml for the full list.
Citation
If you use phylotypy in your research, please cite:
- Wang, Q., Garrity, G.M., Tiedje, J.M., Cole, J.R. (2007) Naive Bayesian Classifier for Rapid Assignment of rRNA Sequences into the New Bacterial Taxonomy. Applied and Environmental Microbiology, 73(16), 5261–5267.
- Schloss PD.2025.phylotypr: an R package for classifying DNA sequences. Microbiol Resour Announc14:e01144-24.https://doi.org/10.1128/mra.01144-24
- Saltikov, C. (2024) phylotypy: Python implementation of a Naive Bayesian 16S rRNA classifier. https://github.com/csaltikov/phylotypy
AI Assistance
Portions of this project (code and documentation) were developed with the assistance of Anthropic's Claude.
Release files for phylotypy 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| phylotypy-0.9.1.tar.gz | 322.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| phylotypy-0.9.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| phylotypy-0.9.1-cp313-cp313-macosx_10_13_universal2.whl | CPython 3.13 | CPython 3.13 | macOS 10.13+ universal2 (ARM64, x86-64) | Details |
| phylotypy-0.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| phylotypy-0.9.1-cp312-cp312-macosx_10_13_universal2.whl | CPython 3.12 | CPython 3.12 | macOS 10.13+ universal2 (ARM64, x86-64) | Details |
| phylotypy-0.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| phylotypy-0.9.1-cp311-cp311-macosx_10_9_universal2.whl | CPython 3.11 | CPython 3.11 | macOS 10.9+ universal2 (ARM64, x86-64) | Details |
Total release size: 5.2 MB
Release files / phylotypy-0.9.1.tar.gz
| Download URL | phylotypy-0.9.1.tar.gz |
|---|---|
| Size | 322.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a172e2cb49e58c486e431300cbd8cef8e51510084c921f05ead5c47747e2791c
|
|
BLAKE2b-256 checksum How to use checksums |
2e8308b2aea8cbd4d6810fd222cc9cdb9abe16709c7a25d7aab88a0d7882eda4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / phylotypy-0.9.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
| Download URL | phylotypy-0.9.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
511f550ef732fed99b15d4a99a4a836451113ae2394ec086845823da482ed9c9
|
|
BLAKE2b-256 checksum How to use checksums |
8f3c16d4b3c0b82f0e60689beea49930f348d49c96ea959f93b970b77696b16c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / phylotypy-0.9.1-cp313-cp313-macosx_10_13_universal2.whl
| Download URL | phylotypy-0.9.1-cp313-cp313-macosx_10_13_universal2.whl |
|---|---|
| Size | 556.4 kB |
| Tags | CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
f4bb97a772387f2d5fa9087926ba78dbfe5e9f79ec3bf2563d334be39167f075
|
|
BLAKE2b-256 checksum How to use checksums |
30f109300bc7f3cd479beb846ffbb7145395ed721a5b335498f430933050f933
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / phylotypy-0.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
| Download URL | phylotypy-0.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ec92120274b1e61a1285fd1ca5421bae8b3ab25539c41cf86c757a521aed104c
|
|
BLAKE2b-256 checksum How to use checksums |
413942a5a1b227f97c9e0f54ed92a901abda5c395ad14406efcbdbd0294aa33a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / phylotypy-0.9.1-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | phylotypy-0.9.1-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 557.1 kB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
1d1a8c115914e68beb03306d88289fa198f7f5bae86a93485564dd8dcbf0833e
|
|
BLAKE2b-256 checksum How to use checksums |
408e1764cb3a4ca983e2a36f5a6875eadfda4d26159b41239308bd761a1b1acc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / phylotypy-0.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
| Download URL | phylotypy-0.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1ce99ef732e1741b408503b44edd835faee27634611e884bf537ee6a57c065c9
|
|
BLAKE2b-256 checksum How to use checksums |
5cbcbc480d2628460f1ea291995e781abd6249836b1ac1e2de8b97291d97a38a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / phylotypy-0.9.1-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | phylotypy-0.9.1-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 554.2 kB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
e5b87af0e188f42b2d5ba00e836650eb907a2321cfe2eb373dfe8c244e8bb26e
|
|
BLAKE2b-256 checksum How to use checksums |
d9650c525ef7a4d6905ee03fa859b552fa3e76a35ca58210ed015d677c6f7068
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency log