# Diversity analysis with otu table and taxonomy data

**URL:** https://forum.qiime2.org/t/diversity-analysis-with-otu-table-and-taxonomy-data/1602
**Category:** User Support
**Tags:** taxonomy, taxa
**Created:** [October 24, 2017, 4:27pm UTC](https://forum.qiime2.org/t/diversity-analysis-with-otu-table-and-taxonomy-data/1602 "2017-10-24T16:27:00Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![pumpkin](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/p/ccd318/32.png) [@pumpkin](https://forum.qiime2.org/u/pumpkin)
#### Post date: [October 24, 2017, 4:27pm UTC](https://forum.qiime2.org/t/diversity-analysis-with-otu-table-and-taxonomy-data/1602/1 "2017-10-24T16:27:00Z")

</div>

Hi,

I am beginning to use Qiime2, and I try to do the diversity analysis. The aim is to discover the relationship between the diversity and the status.  
Now, I receive some datasets from collaborators.  
OTU\_table ( otu id and the sample identify).  
OTU\_mapping file (OTU\_id, acc, full\_name, taxonomy)  
Sample mapping file (ids, type, etc)  
According to the tutorial, I first generate a biom file with sample identify, otu id and taxonomy, then import it to qiime. I think this is the feature table. Because it gives me the information counts with each sample and each feature.

**First Question:** I check the import example, feature-table-v210.biom. it seems that the biom file doesn't contain the taxonomy. When I play the following code  
biom validate-table -i feature-table-v210.biom  
Unknown BIOM type: Table  
The input file is not a valid BIOM-formatted file.  
But my biom is a valid one. Why it happens? Because I get the biom from the otu table which contains taxonomy?  
Besides, I can not view the my-feature-table directly  
qiime tools view my-feature-table.qzv  
Usage: qiime tools view [OPTIONS] VISUALIZATION\_PATH  
**Error:** Visualization viewing is currently not supported in headless environments. You can view Visualizations (and Artifacts) at [https://view.qiime2.org](https://view.qiime2.org).  
But it can be viewed online.

Next step, I want to get the Feature Data. But I do not know what to do next. It seems that I should use the otu mapping file which contains the otu id, and taxonomy. When I import it into qiime2, what I get is just the feature ID and taxon. Should I train it? Do I miss something?

Could anyone give me some suggestions? Thanks!!!!

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [October 24, 2017, 5:28pm UTC](https://forum.qiime2.org/t/diversity-analysis-with-otu-table-and-taxonomy-data/1602/3 "2017-10-24T17:28:31Z")

</div>

Hi @pumpkin,  
Thanks for posting!

> [@pumpkin](#):
>
> it seems that the biom file doesn’t contain the taxonomy

Feature tables in QIIME2 do not contain taxonomy, and will be discarded upon import. Taxonomy is contained in a separate `FeatureData[Taxonomy]` artifact. If you or your collaborators have a list of taxonomy assignments for each feature ID, you can import a file in the following format into qiime:

```auto
Feature ID	Taxon
229854	k __Bacteria; p__ Proteobacteria; c __Gammaproteobacteria; o__ Legionellales; f __Legionellaceae; g__ Legionella; s__
367523	k __Bacteria; p__ Bacteroidetes; c __Flavobacteriia; o__ Flavobacteriales; f __Flavobacteriaceae; g__ Flavobacterium; s__
239330	k __Bacteria; p__ Proteobacteria; c __Deltaproteobacteria; o__ Desulfuromonadales; f __Geobacteraceae; g__ Geobacter; s__

```

Import like this:

```auto
qiime tools import \
  --input-path taxonomy.tsv \
  --output-path taxonomy.qza \
  --type 'FeatureData[Taxonomy]'

```

Alternatively, if you only have the reference sequences associated with each feature ID, or want to classify using the taxonomy classifiers in QIIME2, import as described [here](https://docs.qiime2.org/2017.9/tutorials/importing/#per-feature-unaligned-sequence-data-i-e-representative-sequences).

> [@pumpkin](#):
>
> When I play the following code
> 
> biom validate-table -i feature-table-v210.biom
> 
> Unknown BIOM type: Table
> 
> The input file is not a valid BIOM-formatted file

This is an issue with BIOM formats and out of scope of the QIIME2 forum — you can get support with BIOM on the [qiime 1 forum](http://forum.qiime.org/) (the issue is probably that you have an old version of biom installed or need to specify the biom format (e.g., 2.1.0) that you are using).

> [@pumpkin](#):
>
> Error: Visualization viewing is currently not supported in headless environments.

It sounds like you may be trying to visualize on a remote computing cluster? E.g., see [this post](https://forum.qiime2.org/t/qiime-tools-view-on-headless-server/113) for more details.

> [@pumpkin](#):
>
> When I import it into qiime2, what I get is just the feature ID and taxon

Perfect — sounds like you already figured out how to import `FeatureData[Taxonomy]` as I described above (I've left that advice there in case I misunderstood your post). This is how taxonomy information is handled in QIIME 2. If you want to visualize taxonomic abundances in a barplot, use [`barplot`](https://docs.qiime2.org/2017.9/plugins/available/taxa/barplot/). If you want to collapse your feature table to taxonomic groups and use those groups for downstream analyses, e.g., testing whether taxa are differentially abundant between groups, use [`collapse`](https://docs.qiime2.org/2017.9/plugins/available/taxa/collapse/) and proceed with other commands.

I hope that fixes all of your (non-BIOM-related) problems! Please let us know if these do not resolve the issues you are having.

---

<div class="post-metadata">

### Author: ![pumpkin](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/p/ccd318/32.png) [@pumpkin](https://forum.qiime2.org/u/pumpkin)
#### Post date: [October 25, 2017, 6:56pm UTC](https://forum.qiime2.org/t/diversity-analysis-with-otu-table-and-taxonomy-data/1602/5 "2017-10-25T18:56:44Z")

</div>

Hi @Nicholas_Bokulich,

Thank you for your detailed and clear explanation.  
It seems that I have some misunderstandings about the feature ID and OTU\_ID. As I explained, I have the OTU table that contains the otu\_id and the sample identifier. Also, I have the otu mapping files, which contains the OTU\_ID, acc, taxonomy. The OTU IDs are like CsrLava3, CsrNeon2, etc. Not just the numbers. The acc is the identifier assigned by **SILVA**.  
Here is my question.  
At first, I thought the OTU ID was the feature ID. But now, It seems that the acc is the feature ID? So does it means that the OTU ID is just an index? What I should use is the acc, treated it as the feature ID?  
In addition, there are some data from the website. Could I use the 97\_otus.tre as the phylogenetic tree? If the tree is ready, why do we need to generate the tree for phylogenetic as the tutorial did?

> **[Archive](https://www.arb-silva.de/no_cache/download/archive/qiime/)**
>
> SILVA provides comprehensive, quality checked and regularly updated databases of aligned small (16S / 18S, SSU) and large subunit (23S / 28S, LSU) ribosomal RNA (rRNA) sequences for all three domains of life (Bacteria, Archaea and Eukarya).

Thank you!!!

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [October 25, 2017, 7:24pm UTC](https://forum.qiime2.org/t/diversity-analysis-with-otu-table-and-taxonomy-data/1602/6 "2017-10-25T19:24:04Z")

</div>

Hi @pumpkin,

> [@pumpkin](#):
>
> Also, I have the otu mapping files, which contains the OTU\_ID, acc, taxonomy

The taxonomy assignments should only contain two columns before importing to QIIME (see the example I gave above). If I am correct, it sounds like you need to delete the `acc` column before importing so that the OTU IDs (which can have letters in the name, they don't need to just be numbers) are mapped to the predicted taxonomy.

> [@pumpkin](#):
>
> At first, I thought the OTU ID was the feature ID. But now, It seems that the acc is the feature ID?

OTU ID should be the feature ID (after all, these are the IDs used in your OTU/feature table).

> [@pumpkin](#):
>
> Could I use the 97\_otus.tre as the phylogenetic tree?

That probably will not work, unless if your OTU IDs correspond to the labels on the tree (e.g., if you used a closed-reference OTU picking method that assigns OTU IDs that correspond to the reference sequences. It sounds like that probably isn't the case).

> [@pumpkin](#):
>
> If the tree is ready, why do we need to generate the tree for phylogenetic as the tutorial did?

The trees prepared in SILVA and other reference sequence databases are phylogenetic trees based on alignment of all reference sequences in that database; in QIIME2 we typically make our own alignments/trees because while OTU picking strategies do exist we recommend using dada2 or deblur denoising algorithms, which remove erroneous sequences and delivery sequence variants (think of these as OTUs clustered at 100% similarity) — and dada2/deblur OTU ids will not correspond to the IDs used by the reference database.

You may want to consider asking your collaborators for the raw sequence data and processing those data through QIIME 2, since this alleviates some of the awkwardness of trying to squeeze data generated on different platforms into QIIME 2. You would also benefit from using methods like dada2 or deblur for denoising/dereplicating, which are more sensitive that OTU picking methods (and yield fewer sequence variants that OTUs because many OTUs are spurious/noisy, making taxonomy classification and other downstream steps faster).

Hope that helps!

---

<div class="post-metadata">

### Author: ![pumpkin](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/p/ccd318/32.png) [@pumpkin](https://forum.qiime2.org/u/pumpkin)
#### Post date: [October 25, 2017, 7:50pm UTC](https://forum.qiime2.org/t/diversity-analysis-with-otu-table-and-taxonomy-data/1602/7 "2017-10-25T19:50:46Z")

</div>

Thank you @Nicholas_Bokulich  
It is very clear to me now!!!

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [November 26, 2017, 1:50am UTC](https://forum.qiime2.org/t/diversity-analysis-with-otu-table-and-taxonomy-data/1602/8 "2017-11-26T01:50:58Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
