How to add taxonomy to feature-table.qza and get otu id of each taxonomy and number of otus

Hi @Yanfei-Geng,
I think I can help with part of what you’re looking for, but some of it may be functionality that we don’t currently have in QIIME 2.

First, I think what you are looking for is the qiime taxa collapse command. This will group features together based on their taxonomy, and generate a new feature table where the feature ids are taxonomic labels.

You could run this as follows:

qiime taxa collapse \
  --i-table feature-table-2.qza \
  --i-taxonomy taxonomy.qza \
  --p-level 3 \
  --o-collapsed-table feature-table-class.qza

The value that you provide for --p-level may change, depending on how many taxonomic levels are used in your taxonomy. In my case, I’m assuming kingdom is level 1, phylum is level 2, and class is level 3.

In QIIME 2, the taxonomy is never included in the feature table, but always in the corresponding FeatureData[Taxonomy] artifact (the taxonomy.qza file, in this example). This is so that different taxonomies can be easily associated with a single feature table. If you want a .biom file with taxonomy, you can see how to do that here.

We don’t currently include feature ids (such as your JX870786) in the taxonomy barplots, as often there will be too many of them for that to be useful. You might try running qiime feature-table summarize and looking for that feature in the Feature Detail tab, as there will be some basic information about it there. Alternatively, if you need to see counts of that feature on a per sample basis, you can export the feature table, convert it to tsv with biom convert, and find that feature in the resulting tsv file to get that information.

We also don’t currently have a way to generate counts of the features that were grouped into each taxonomy. It should be fairly straight-forward to get that information though from the tabulated taxonomy. You can access that by running the following command, and then clicking the button for Download metadata as TSV file:

qiime metadata tabulate \
  --m-input-file taxonomy.qza \
  --o-visualization taxonomy.qzv

I hope this helps. Please let me know if you have any additional questions, or if I’ve misunderstood any of your questions.