Hi @Yujun, thanks for writing! From what I understand, you are looking for help with annotating taxonomy metadata to a feature table, and collapsing these data to some specified taxonomic level (judging from your filename otu_table_mc2_w_tax_no_pynast_failures_L6.txt
, that is).
The q2-taxa
plugin has a method called collapse
, which is able to do the first part of what you are looking for. Make sure that you have this plugin installed before proceeding. You can do that by running:
$ qiime info
If you don’t see taxa
listed under Installed plugins
, then install by running the following in your activated conda
environment:
$ conda install -c qiime2 q2-taxa
There is an example of how to do this in the “Moving Pictures” tutorial on the docs site:
$ qiime taxa collapse \
--i-table table.qza \
--i-taxonomy taxonomy.qza \
--p-level 2 \
--o-collapsed-table table-l2.qza
For the “Moving Pictures” tutorial, the input file table.qza
is the feature table that is emitted from the qiime dada2 denoise
step, and the input file taxonomy.qza
is emitted from the qiime feature-classifier classify
step.
Once you have the collapsed table (table-l2.qza
), you can extract the BIOM file for your downstream analyses:
$ qiime tools extract table-l2.qza
OUTPUT:
Extracted to /Users/matthew/moving-pictures/ec02f06d-943b-43e6-9450-17aa99a23178
$ biom head -i ec02f06d-943b-43e6-9450-17aa99a23178/data/feature-table.biom
OUTPUT:
# Constructed from biom file
#OTU ID L1S105 L1S140 L1S208 L1S257 L1S281
k__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;f__Bacillaceae;g__Bacillus 0.0 0.0 0.0 0.0 0.0
k__Bacteria;p__Proteobacteria;c__Alphaproteobacteria;o__Rhodobacterales;f__Rhodobacteraceae;g__Rhodobacter 0.0 0.0 0.0 0.0 0.0
k__Bacteria;p__Proteobacteria;c__Betaproteobacteria;o__Burkholderiales;f__Burkholderiaceae;g__Lautropia 0.0 0.0 0.0 0.0 0.0
k__Bacteria;p__Bacteroidetes;c__Bacteroidia;o__Bacteroidales;f__Porphyromonadaceae;g__Parabacteroides 0.0 137.0 249.0 560.0 233.0
k__Bacteria;p__Proteobacteria;c__Betaproteobacteria;o__Neisseriales;f__Neisseriaceae;g__Vogesella 0.0 0.0 0.0 0.0 0.0
Thanks!