How to combine Feature Table with the taxonomy class

Hi @cyy,

I would export your data to a biom file, export your taxonomy to a tsv, combine them, and then convert to a text file. I'll put those commands below.

However, my unsolicited reply is also to strongly discourage the use of STAMPS. It's taxonomic comparisons are based on tests that aren't appropriate for microbiome data (the user manual shows anova(!!!!) as a possible statistical test which makes all kinds of assumptions that got thrown out 2014-2017). There are a couple of posts that list some issues; here's one that links to about half a dozen more posts:

You can use ANCOM, which is compositionally aware, within QIIME 2, which I might recommend as a starting point.

And, that warning issued, here's hwat I would do:

  1. Export feature table to a qza. Im going to assume your feature table is called feature-table.qza
qiime tools export \
 --input-path feature-table.qza \
 --output-path feature-table
  1. Then export your taxonomy
qiime tool export \
 --input-path taxonomy.qza \
 --output-path taxonomy
  1. Open the taxonomy and change the header. When you open it, you'll see the header looks like this:
Feature ID	Taxon	Confidence

where the spaces are tabs. You need to change it to this:

#otu-id	taxonomy	Confidence
  1. Add the metadata to the biom table
biom add-metadata \
 --input-fp table/feature-table.biom \
 --observation-metadata-fp taxonomy/taxonomy.qza \
 --output-fp biom-with-taxonomy.biom
  1. Export the biom table to text
biom convert \
 --input-fp biom-with-taxonomy.biom \
 --output-fp biom-with-taxonomy.tsv \
 --to-tsv \
 --output-observation-metadata \
 --header-key taxonomy
  1. Carefully edit the file according to your needs, wants and desires. If you're using excel, you want to open AS TEXT. Alternatively I would recommend python, R, or another text-handling programatic software of your choice. (Although if you're using Python, I suggest the python API for both biom and :qiime2:, since they're going to be easier.)

And :boom:, you now have a tax with taxonomy that is appropriate for all sorts of other visualisation software but probably shouldn't go into stamps for the aforementioned reasons.

Best,
Justine

12 Likes