Skip to main content

phylotypy

PyPI version Python 3.11+ License: MIT

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.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phylotypy 0.3.4
File Size Uploaded
phylotypy-0.3.4.tar.gz 304.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for phylotypy 0.3.4
File
phylotypy-0.3.4-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.3.4-cp313-cp313-macosx_10_13_universal2.whl CPython 3.13 CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) Details
phylotypy-0.3.4-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.3.4-cp312-cp312-macosx_10_13_universal2.whl CPython 3.12 CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) Details
phylotypy-0.3.4-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.3.4-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.3.4.tar.gz

Download URL phylotypy-0.3.4.tar.gz
Size 304.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6963ebe5a5d000bc30cada0f0d34292d016b85cbc784af825806c77d39ec025b
BLAKE2b-256 checksum
How to use checksums
43e24cd3b2a8c80a5d0aefbdd2a596b04a85825da2768828495878c25dde7175
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

Release files / phylotypy-0.3.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL phylotypy-0.3.4-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
f3712c193a87f4c27637dd98235dbad1b9596b23272c8819bba5c2222d61ab63
BLAKE2b-256 checksum
How to use checksums
89d3b44661bdb52a6646ba19f55935399a18a5df848795815c4d0419fd17d25a
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

Release files / phylotypy-0.3.4-cp313-cp313-macosx_10_13_universal2.whl

Download URL phylotypy-0.3.4-cp313-cp313-macosx_10_13_universal2.whl
Size 546.5 kB
Tags CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
08619650b544ad26cfaa1517a64d70fe598b8ce1c82d28ede540f602e69477cb
BLAKE2b-256 checksum
How to use checksums
ae003f6e3d5d08edaf4763287a848803f5bdcf15b3ab8d6b24661d998fb2148a
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

Release files / phylotypy-0.3.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL phylotypy-0.3.4-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
a49139bff344d45eaf8651078269dbcac8bcbad4712b03740ef72c82a091fdfe
BLAKE2b-256 checksum
How to use checksums
6841976f8e7033d8bb7228269f68f6c1afd988767fc4dca2ef8df6233eb8805f
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

Release files / phylotypy-0.3.4-cp312-cp312-macosx_10_13_universal2.whl

Download URL phylotypy-0.3.4-cp312-cp312-macosx_10_13_universal2.whl
Size 547.2 kB
Tags CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
a90b77c206315ec48364558edb791ae9df3bb6b8d904948dc98190ed68b980a6
BLAKE2b-256 checksum
How to use checksums
1ea5665389134f2caa8e9ad6b7e3a3317d55a5fcbc9cfccdcbcdcaa9438b7179
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

Release files / phylotypy-0.3.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL phylotypy-0.3.4-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
16f7cfe17a0400b725eba9eeb3e0dade4971a87dd2113b18b0882e710219fd3d
BLAKE2b-256 checksum
How to use checksums
1a7d3df2a95738b8f48a38eb9c27238b186a56764e3561e4ba16d95b53019c25
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

Release files / phylotypy-0.3.4-cp311-cp311-macosx_10_9_universal2.whl

Download URL phylotypy-0.3.4-cp311-cp311-macosx_10_9_universal2.whl
Size 544.3 kB
Tags CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
3d82d3b23db8ec7110f21277d8ebd3dbc33d5638939a5ffc6e1e19293a5428d2
BLAKE2b-256 checksum
How to use checksums
864bf7b79d2f4b7aa8ab064d09291501b0720bef10dcda2fadc9c732a41242cc
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

Release history Release notifications | RSS feed

0.9.1

7 release files

0.9.0

7 release files

0.7.5

7 release files

0.6.0

7 release files

0.5.0

7 release files

0.4.0

7 release files

This release

0.3.4 This release

7 release files

0.3.2

10 release files

0.3.1

1 release file

0.3.0

4 release files

0.2.7

4 release files

0.2.6

4 release files

0.2.5

4 release files

0.2.4

3 release files

0.2.3

3 release files

0.2.2

3 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page