merging taxonomy assignment table with rarefied feature table

Hi!

I rarefied my feature table after assigning taxonomy to features, thus, now I have the two separate files (rarefied feature table and taxonomy for all the original features). I am having trouble merging these two using feature ID as the factor for the merge. Thishttps://forum.qiime2.org/t/exporting-and-modifying-biom-tables-e-g-adding-taxonomy-annotations/3630 forum discussion recommends the following code for adding taxonomy to your biom file but for some reason it is not working. I did change the column headers but still taxonomy is not being added to my biom file.

biom add-metadata -i exported/feature-table.biom -o table-with-taxonomy.biom --observation-metadata-fp biom-taxonomy.tsv --sc-separated taxonomy

I am using the following code

qiime tools export --input-path rarefied-3065-table.qza --output-path exported
qiime tools export --input-path taxonomy-merged-paired-end.qza --output-path exported
cp exported/taxonomy.tsv biom-taxonomy.tsv
biom add-metadata -i exported/feature-table.biom -o table-with-taxonomy.biom --observation-metadata-fp biom-taxonomy.tsv --sc-separated taxonomy

This is how my taxonomy table looks like and the output I get from the last code:

I know I can do it using

qiime taxa collapse \

but I am interested in keeping ASVs separately.

Hi @JeanRodrig,

The following thread may be very useful to debug your problem, there are lots of suggestions you can try:

At first glance I would ask you which command you used to convert the ‘table-with-taxonomy.biom’ to txt file, did you add the ‘-header-key taxonomy’ to that? Without it your taxonomy data would not be exported in the file you are trying to import in OpenOffice!

Cheers

1 Like

Thank you, @llenzi ! The tab separation should indeed be the problem. I used this code

biom add-metadata -i exported/feature-table.biom -o table-with-taxonomy.biom --observation-metadata-fp biom-taxonomy.tsv --sc-separated taxonomy

I guess what I am not 100% is how to make sure I keep a tab separation. When I open my biom-taxonomy.tsv, it opens in LibreOffice. I just highlight and change the headers.

I did not add the

–header-key taxonomy

Where exactly should I add it within the

biom add-metadata -i exported/feature-table.biom -o table-with-taxonomy.biom --observation-metadata-fp biom-taxonomy.tsv --sc-separated taxonomy

Hi @JeanRodrig,

You are trying to open the file ‘OTU-table.tsv’ in OpenOffice, so you should have use a command looking something like:

biom convert -i table-with-taxonomy.biom -o OTU-table.tsv --to-tsv --header-key taxonomy

What I meant was if you added the ‘–header-key’ option in this last one!
Hope make sense!

Hi @llenzi

So, to confirm, I have to add two things.
based on the thread you sent me, I have to add

–observation-header taxonomy

into this part of the code

biom add-metadata -i exported/feature-table.biom -o table-with-taxonomy.biom --observation-metadata-fp biom-taxonomy.tsv --sc-separated taxonomy

and also,

–header-key taxonomy

into, as your last reply

biom convert -i table-with-taxonomy.biom -o OTU-table.tsv --to-tsv

Does this make sense?

Hi @JeanRodrig,

nope sorry! (Apology if I am not very clear, is evening here and I had a long day :sleeping:)

I think the command you used worked as expected, but the taxonomy column is not exported into the file you are loading in OpenOffice.

To test this, you need to change only the final ‘biom convert’ command, by adding the ‘–header-key taxonomy’ option.

Cheers

Thanks @llenzi!

It worked by just having it in the last code

hello, can you share the code with me? I got the same problem. thanks!!!

qiime tools export --input-path rarefied-3065-table.qza --output-path exported

qiime tools export --input-path taxonomy-merged-paired-end.qza --output-path exported

cp exported/taxonomy.tsv biom-taxonomy.tsv

biom add-metadata -i exported/feature-table.biom -o table- with -taxonomy.biom –observation-metadata-fp biom-taxonomy.tsv --sc-separated taxonomy

biom convert -i table-with-taxonomy.biom -o OTU-table.tsv --to-tsv --header-key taxonomy

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