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. 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 --help output 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.

Metadata

Release files for phylotypy 0.9.2

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.9.2
File Size Uploaded Provenance Actions
phylotypy-0.9.2.tar.gz 323.3 kB With provenance Details for phylotypy-0.9.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for phylotypy 0.9.2
File Actions
phylotypy-0.9.2-cp314-cp314-macosx_10_15_universal2.whl CPython 3.14 CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) Details for phylotypy-0.9.2-cp314-cp314-macosx_10_15_universal2.whl
phylotypy-0.9.2-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 for phylotypy-0.9.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
phylotypy-0.9.2-cp313-cp313-macosx_10_13_universal2.whl CPython 3.13 CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) Details for phylotypy-0.9.2-cp313-cp313-macosx_10_13_universal2.whl
phylotypy-0.9.2-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 for phylotypy-0.9.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
phylotypy-0.9.2-cp312-cp312-macosx_10_13_universal2.whl CPython 3.12 CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) Details for phylotypy-0.9.2-cp312-cp312-macosx_10_13_universal2.whl
phylotypy-0.9.2-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 for phylotypy-0.9.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
phylotypy-0.9.2-cp311-cp311-macosx_10_9_universal2.whl CPython 3.11 CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) Details for phylotypy-0.9.2-cp311-cp311-macosx_10_9_universal2.whl

Total release size: 5.7 MB

Release files / phylotypy-0.9.2.tar.gz

Download URL phylotypy-0.9.2.tar.gz
Size 323.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a04dcddd4c24407e3fb66544bda6761de63e73bf0fefb2c9a81973c0a29c6c7d
BLAKE2b-256 checksum
How to use checksums
821966b4eeedb3aa04b2ad8eaee784cd09c9cc624430d6c086afa3bd817578c2
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 Oct 5, 2026.

Transparency log

Release files / phylotypy-0.9.2-cp314-cp314-macosx_10_15_universal2.whl

Download URL phylotypy-0.9.2-cp314-cp314-macosx_10_15_universal2.whl
Size 557.8 kB
Tags CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
ec0dbe180493799e7998caf1059fd64749ea7d875f16f0e9c66b5475f75eb48f
BLAKE2b-256 checksum
How to use checksums
2f636965faa927cb15ad4799c3a9f6021e0c6fd1cb5bf2c31b6575ec9dd17ea6
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 Oct 5, 2026.

Transparency log

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

Download URL phylotypy-0.9.2-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
1d566acf38593adc6a4e8315c1fc38aaeef42c32b2fea6dcec35daadc545e8f1
BLAKE2b-256 checksum
How to use checksums
4e096411280c0a32df375edbc7160b0b9e04fc796c5a3e3d579312afe4c422b7
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 Oct 5, 2026.

Transparency log

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

Download URL phylotypy-0.9.2-cp313-cp313-macosx_10_13_universal2.whl
Size 557.0 kB
Tags CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
dfd0fbe47f8ec882f7d9739878d729fd1b337cd6ce0c49e89515cc65c9d18830
BLAKE2b-256 checksum
How to use checksums
e60adce7c78573b67e72443895facdc00b8695472792e7178307f431c8fbcc82
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 Oct 5, 2026.

Transparency log

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

Download URL phylotypy-0.9.2-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
d2996da1477be44fccaa0990ded82cb0a45381232a921a99e24e40a965c6f910
BLAKE2b-256 checksum
How to use checksums
d6779e54824126ea681f2d24835cff03068e9c958e7ee9125e7b8aa4aa02e151
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 Oct 5, 2026.

Transparency log

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

Download URL phylotypy-0.9.2-cp312-cp312-macosx_10_13_universal2.whl
Size 557.6 kB
Tags CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
af32691b5172c8ca6837ea50c2afc00d898b927a623b25570ea2f8f142003f9a
BLAKE2b-256 checksum
How to use checksums
b258f9d3c85184130fbd98036d12a483da8fceb5a5a09455cdafee0031579574
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 Oct 5, 2026.

Transparency log

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

Download URL phylotypy-0.9.2-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
ab198809f7f92966087591bbf7cf0918311b6a611717044ae333ea2693fd6868
BLAKE2b-256 checksum
How to use checksums
15f740179766d09dc991d4925c4eed08d67b1afc510185918707960abdd0dcb3
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 Oct 5, 2026.

Transparency log

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

Download URL phylotypy-0.9.2-cp311-cp311-macosx_10_9_universal2.whl
Size 554.7 kB
Tags CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
14193fffd3e421f4e30d38a9e47ef1df9a1ad8edc3d29193b77d0b9c5c1aee66
BLAKE2b-256 checksum
How to use checksums
ef1014a598135f5f992c69f68de111d2764ab31a412f02df441b59ca28034f0d
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 Oct 5, 2026.

Transparency log

Security for phylotypy 0.9.2

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.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for phylotypy-0.9.2.tar.gz

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 Oct 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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