Importing Qiime2 biom file with taxonomy to phyloseq

Hi,

I would like to import my .biom file with the corresponding taxonomy into phyloseq.
However, I realized that the .biom made by QIIME2 does not include the taxonomy. I tried to extract the taxonomy and merge them with tsv biom then back to a new biom file. However I got an error when transforming my .txt (Text (Tab delimited) (*.txt)) into a .biom file. Here is what I have done : I have merged the taxonomy info into the otu_table.txt. Here is a copy of the headers I have got in my final file .txt (tab delimited).

|#Constructed from BIOM file|
|#OTU ID|taxonomy|March2016.poc162|Jan2016.acr134|

However, when I try to convert this file .txt into .biom in qiime2
biom convert -i otu_table.txt -o new_otu_table.biom --to-hdf5 --table-type=“OTU table” --process-obs-metadata taxonomy

This gives me an error :

Traceback (most recent call last):
File “/Users/xx/miniconda3/envs/qiime2-2017.10/bin/biom”, line 6, in
sys.exit(biom.cli.cli())
File “/Users/xx/miniconda3/envs/qiime2-2017.10/lib/python3.5/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
,…
File “/Users/xx/miniconda3/envs/qiime2-2017.10/lib/python3.5/codecs.py”, line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte

You help would be really much appreciated,
Thanks in advance

Good morning,

You are correct; Qiime 2 does not put the taxonomy into the .biom file.

I would like to refer this question to @wasade. On github last year, we discussed if it’s better to include taxonomy in .biom tables and Daniel strongly supported keeping taxonomy and OTU tables separate. I think he can comment on what’s the best path forward now.

I really liked that Qiime 1 would include taxonomy by default, and I would also like to know the best way to handle this going forward with Qiime 2.

Colin

Hi @leila! Can you please try out the instructions in this forum topic? Let us know how it goes!

Hi @colinbrislawn!

In QIIME 2, we decided to store feature tables separately from taxonomy annotations for a few reasons, see @gregcaporaso's summary here:

This design decision makes things a little harder to interoperate with other software expecting a .biom file containing taxonomy annotations, but keeping the two pieces of data separate buys users and developers a lot when operating within QIIME 2. This was a tough decision; there are definitely pros and cons to either approach! Luckily it is easy to export your data and combine the two files, so there is always an "escape hatch" for users.

In general, when you're working in QIIME 2 you'll have two separate .qza files: one is the FeatureTable artifact, and the other is the FeatureData[Taxonomy] artifact. If you want to export these data for use with external programs, you can use qiime tools export to export a .biom file and TSV taxonomy file. You can then use biom add-metadata to add the taxonomy annotations to the .biom file (see this forum topic for examples).

Note: in @gregcaporaso's summary I linked to above, he describes how to import a .biom file containing taxonomy annotations into a FeatureData[Taxonomy] artifact. Thus, it is relatively straightforward to import a .biom file containing taxonomy annotations into QIIME 2 -- just run two import commands on the same .biom file (one command will specify --type FeatureTable[Frequency], the other will use --type FeatureData[Taxonomy]).

4 Likes

Thank you all for your inputs.
I will try this and will let you know.

1 Like

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