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. The RDP training data is provided here in the data directory located at the github repository. But Silva and others can be used.
Thanks to Riffomonas for the inspiration — check out the videos on his YouTube channel.
Performance
Training on the full RDP reference database takes ~30 seconds on a 2020 Apple Intel MacBook Pro. 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.
Training Data
Download the RDP reference training set and an example dataset before classifying:
| File | Description |
|---|---|
| rdp_16S_v19.dada2.fasta | RDP trainset19072023, DADA2 format |
| dna_moving_pictures.fasta | Example dataset (Moving Pictures study) |
| The training data fasta descriptions should a taxonomy. By default the Species level is ignored. |
"Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species"
The taxon string in the fasta description should follow the semicolon-separated format like this:
>Bacteria;Pseudomonadota;Gammaproteobacteria;Enterobacterales;Enterobacteriaceae;Citrobacter
TAGAGTTTGATCCATGGCTCAGATTGAACGCTGGCGGCAGGCCTAACAC.....
Quick Start
1. Load training data and sequences to classify
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")
2. Train the classifier
database = classifier.make_classifier(rdp)
3. Classify sequences
classified = classifier.classify_sequences(moving_pics, database)
4. Format and export results
classified = results.summarize_predictions(classified)
print(classified.columns)
Output:
Index(['id', 'sequence', 'classification', 'Kingdom', 'Phylum', 'Class',
'Order', 'Family', 'Genus', 'observed', 'lineage'],
dtype='object')
classified.to_csv("classified_results.csv")
Complete Code Block
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)
print(classified.head())
classified.to_csv("classified_results.csv")
Example Classification Output
Taxonomic levels (Domain → Genus) are semicolon-separated. Numbers in parentheses represent bootstrap confidence scores. The default confidence threshold is 80%.
Bacteria(100);Pseudomonadota(99);Alphaproteobacteria(99);Rhodospirillales(99);Acetobacteraceae(99);Roseomonas(83)
Bacteria(99);Bacteroidota(97);Bacteroidia(93);Bacteroidales(93);Bacteroidales_unclassified(93);Bacteroidales_unclassified(93)
Bacteria(100);Bacteroidota(100);Bacteroidia(100);Bacteroidales(100);Bacteroidaceae(100);Bacteroides(100)
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
Release files for phylotypy 0.4.0
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.4.0.tar.gz | 303.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| phylotypy-0.4.0-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.4.0-cp313-cp313-macosx_10_13_universal2.whl | CPython 3.13 | CPython 3.13 | macOS 10.13+ universal2 (ARM64, x86-64) | Details |
| phylotypy-0.4.0-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.28+ x86-64, Linux glibc 2.17+ x86-64 | Details |
| phylotypy-0.4.0-cp312-cp312-macosx_10_13_universal2.whl | CPython 3.12 | CPython 3.12 | macOS 10.13+ universal2 (ARM64, x86-64) | Details |
| phylotypy-0.4.0-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.28+ x86-64, Linux glibc 2.17+ x86-64 | Details |
| phylotypy-0.4.0-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.1 MB
Release files / phylotypy-0.4.0.tar.gz
| Download URL | phylotypy-0.4.0.tar.gz |
|---|---|
| Size | 303.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40b56eb99df45df1693f2b50e03753f7d6f7c48af68b89642e7b63126bcc6449
|
|
BLAKE2b-256 checksum How to use checksums |
f014f64c8f3a74f6d8adca047d0b6b41ae9eaef875feffe6a906d2558ad00929
|
| 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 Aug 30, 2026.
Transparency logRelease files / phylotypy-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
| Download URL | phylotypy-0.4.0-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 |
afe3bacef384fd5b091235c549b7e649b13a8d7d13b575f79746852edb2e5531
|
|
BLAKE2b-256 checksum How to use checksums |
15e6aa4fb12f3ed0d2931bdcf137224a26ac67ca6bd3dbe95bfcfa80ee0dbc36
|
| 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 Aug 30, 2026.
Transparency logRelease files / phylotypy-0.4.0-cp313-cp313-macosx_10_13_universal2.whl
| Download URL | phylotypy-0.4.0-cp313-cp313-macosx_10_13_universal2.whl |
|---|---|
| Size | 544.6 kB |
| Tags | CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
148ed2f5788ae6e9056b55e70df6397f5e046a78ecf63dbd7c587bbd3b591f12
|
|
BLAKE2b-256 checksum How to use checksums |
a79b9f038ea5f27a77ada507a88446fc64d957fcf7b36ab50e706661b9ad7389
|
| 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 Aug 30, 2026.
Transparency logRelease files / phylotypy-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
| Download URL | phylotypy-0.4.0-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 |
6281dd5ec043ea72036b06b517a11a8a0cb7d4e4ddcfe318ceda590ff4e6a8cd
|
|
BLAKE2b-256 checksum How to use checksums |
c56548c9719306e6cb2957e328de6e20e3b6a933eadf7c7235769dfb1dd58d7c
|
| 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 Aug 30, 2026.
Transparency logRelease files / phylotypy-0.4.0-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | phylotypy-0.4.0-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 545.3 kB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
a7a2bbf1a1c95ecfe6f6cc572815e511ffe27df6e351b5c7cf7946b5c29aad1b
|
|
BLAKE2b-256 checksum How to use checksums |
5593b174b0dcf1afa8d521f3628b767bde0ae92162ba3fe6b229fd8920089106
|
| 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 Aug 30, 2026.
Transparency logRelease files / phylotypy-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
| Download URL | phylotypy-0.4.0-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 |
32b93689907114b64307efb57184005ad0a2f24ea4f6733c66aa3efa9ec80841
|
|
BLAKE2b-256 checksum How to use checksums |
42dd5a012cd3fa600aaee1e95a33159140e5ba9e297509e8d8574a7b58750530
|
| 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 Aug 30, 2026.
Transparency logRelease files / phylotypy-0.4.0-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | phylotypy-0.4.0-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 542.4 kB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
8d498c67fd16074fd20a4dbb0ce23ec5097530da7fd0fc2002b0822606b22e8d
|
|
BLAKE2b-256 checksum How to use checksums |
e93fb64d99edcb2f68ac128e64bfdb46c8b4f00606c0ff6a1dc98b86d0a5db13
|
| 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 Aug 30, 2026.
Transparency log