DeepTaxa, a QIIME 2 plugin for 16S taxonomy

Hi everyone,

I want to share a QIIME 2 plugin that we just released for DeepTaxa. Maybe it is useful for your 16S analysis.

DeepTaxa is a deep learning model for the taxonomy of 16S rRNA sequences. It predicts all seven ranks, from domain to species, in a single step using a hybrid CNN-BERT network. On the Greengenes2 2024.09 test set, it reaches about 93% accuracy at the species level. We describe the method in our paper in Bioinformatics Advances (https://doi.org/10.1093/bioadv/vbag166).

The plugin is called q2-deeptaxa. It adds three actions:

  • qiime deeptaxa classify: assign taxonomy to your sequences using a trained model
  • qiime deeptaxa fit: train a model from your own reference sequences and taxonomy
  • qiime deeptaxa describe: print a summary of a trained model

The trained model is a regular QIIME 2 artifact (the type is DeepTaxaModel), so QIIME tracks its provenance like any other artifact. The output of classify is a normal FeatureData[Taxonomy], so you can use it with taxa barplot and the other QIIME tools.

To install (we tested this on Linux):

conda env create -n deeptaxa -f https://raw.githubusercontent.com/systems-genomics-lab/deeptaxa/main/environment-files/deeptaxa-qiime2-amplicon-2024.10.yml
conda activate deeptaxa
qiime dev refresh-cache
qiime deeptaxa --help

Then download a pretrained model for your amplicon region from our Hugging Face page ( systems-genomics-lab/deeptaxa · Hugging Face ), import it, and run classify:

qiime tools import \
  --type DeepTaxaModel \
  --input-path deeptaxa-full-length-v1.pt \
  --input-format DeepTaxaModelFormat \
  --output-path model.qza

qiime deeptaxa classify \
  --i-reads rep-seqs.qza \
  --i-classifier model.qza \
  --o-classification taxonomy.qza

The result is a taxonomy table. After you export it, one row looks like this:

Feature ID  Taxon                                                                                          Confidence
seq1        d__Bacteria; p__Pseudomonadota; c__Gammaproteobacteria; o__Enterobacterales; f__Enterobacteriaceae; g__Escherichia  0.97

By default, classify stops the lineage when the confidence drops below 0.7, the same idea as classify-sklearn. If you want all seven ranks, add --p-confidence disable. It works on CPU or GPU. A GPU is faster for big runs, but it is not required.

The code, a walkthrough, and tutorials are on GitHub ( GitHub - systems-genomics-lab/deeptaxa: Hybrid CNN-BERT deep learning for hierarchical taxonomic classification of 16S rRNA sequences · GitHub ). We are happy to receive your feedback; please let us know if anything does not work.

Thank you,
Ahmed

5 Likes

We have written a step-by-step tutorial that walks through the q2-deeptaxa workflow from start to finish. It imports a DeepTaxa model, classifies representative sequences into FeatureData[Taxonomy], inspects the result, and also covers describe and fit. The worked example uses a real 16S V4 dataset (an ALS gut-microbiome case study), and every command shows its actual output, including a genus-level bar plot.

Tutorial: https://systems-genomics-lab.github.io/deeptaxa/qiime2.html.

1 Like