Biom add-metadata problem


I checked the past issue “Is there any way to summarize taxa plot by category?” and I tried it and used the command recommended Biom add-metadata other times without problem. I need have the biom with taxonomy to use in R studio phyloseq. This time I did exactly the same but despite of i do not have error message the resultant biom was without taxonomy, the command did not add anything.

I cannot understand why this time do not anything in my biom when the columns are the same. Any idea?
My biom comes to export from QIIME2 and in QIIME 2 I did before: deblur, assign taxonomy, filter samples (for a small group), and rarefy. Then I exported the feature table to biom; the taxonomy to tsv; and modified the tsv with the right headers.

Thank you for your help.

Hi @MMC_northS,
Have you seen this post?

We might not be able to help much with this problem if it is occurring post-QIIME2, but if you want us to take a look we will need to see the feature table and taxonomy artifacts. Thanks!


Yes, I saw it, and I followed those steps exactly. This is not my first time with this action but this time doesn’t work. Is it possible that the problem would be that I filtered the feature table? I mean, I have in my feature table two sample types and I filter the table just for working with one and the I used rarefied command to normalize my table. Then I tried to export to biom for using in R and was my problem.

In case this would be the problem, how can I solve? Because I cannot find any command to filter the taxonomy just for the OTUIDs that you have in your selected subsample data. Due to this, my taxonomy file has more entrances than my feature table.

Thanks in advance!

Hi @MMC_northS!

In order us to figure out if we can provide assistance, we need a few things from you first:

  • What version of QIIME 2 are you running?
  • What is the exact command or commands you are running? Please copy and paste.
  • What is the exact error you are seeing? Copy and paste the results when run with --verbose (if it is a QIIME 2 command).

As @Nicholas_Bokulich mentioned above though, if your errors are related to the biom tool, we won’t be able to provide support here, since that isn’t developed as part of QIIME 2.

Keep us posted! :t_rex:

Hellos @thermokarst,

  • my version of QIIME2 is QIIME2-2018.2

  • the commands that I run were:

  1. qiime diversity alpha-rarefaction --i-table demux_Deblur120-table.qza --p-max-depth 15000 --p-metrics observed_otus --m-metadata-file Mapping_file.tsv --o-visualization demux_Deblur120-table_alpha-rarefaction15000.qzv

  2. qiime feature-table filter-samples --i-table demux_Deblur120-table.qza --m-metadata-file Mapping_file.tsv --p-where “SampleType=‘WaterFilter’” --p-exclude-ids --o-filtered-table demux_Deblur120-table_ONLY_MOCKs.qza

  3. qiime feature-table summarize --i-table demux_Deblur120-table_ONLY_MOCKs.qza --m-sample-metadata-file Mapping_file.tsv --o-visualization demux_Deblur120-table_ONLY_MOCKs.qzv

  4. qiime feature-table rarefy --i-table demux_Deblur120-table_ONLY_MOCKs.qza --p-sampling-depth 16771 --o-rarefied-table demux_Deblur120-table_ONLY_MOCKs_rarefied16771.qza

  5. qiime tools export demux_Deblur120-table_ONLY_MOCKs_rarefied16771.qza --output-dir Exported_Mocks_rarefied_table

qiime tools export demux_Deblur120-seqs_Taxonomy90.qza --output-dir Exported_Mocks_taxonomy90

that taxonomy was the assigned to the deblur table through Vsearch classifer

  1. biom add-metadata -i Exported_Mocks_rarefied_table/feature-table.biom -o Exported_Mocks_rarefied_table/feature_table_withTaxonomy.biom --observation-metadata-fp Exported_Mocks_taxonomy90/taxonomy2.tsv --sc-separated taxonomy

Before do “biom add-metadata” order I changes the headers of taxonomy in the same way that it is explained in the mentioned tutorial in the forum.

  • When I did “biom add-metadata” I could not see any error, so I will convert my biom to json biom for using in R studio (what was my objective), and was in R when I saw the error “the biom is not compatible”. When I converted that biom to tsv in order to check the format I noticed that really I did not have the taxonomy in the biom, I just had the usual columns #OTUID, and each of my samples with the abundances of the OTUs, but not the taxonomy in anywhere.

I did these steps other times using files from QIIME2, but with any filter and I did not have problems. It I because I do not know if this time the problem is that I filtered my feature table but not the taxonomy.

Thanks for your help!

This sounds like an error with the R biom package - we won’t be able to provide support for that here (sorry!). The only other thing that comes to mind to check before asking for help is to make sure that the filtered and rarefied feature table still has samples and features — it is possible you are filtering/rarefying it into an empty state? You can run feature-table summarize on the table before exporting to get the details on it. Let us know what you learn! :t_rex:

Hi there,

I have also problems with adding metadata into a biom file, so this thread could be the right one :slight_smile:

I have a ready-made .biom file, in which I’d like to add some extra metadata. However, runnign the command:$ biom add-metadata -i original.biom -o original-with-additions.biom --sample-metadata-fp additions.txt results in error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 4668: invalid continuation byte

Any ideas how to go around this?

My goal is to have a biom-file, which could be then stripped out into compatible input-files to taxa barplot command.


Hi @opaque,
It’s most likely that your file doesn’t actually contain utf-8 encoded data, but some other encoding. You could try saving your file in a text editor (e.g. TextWrangler) with UTF-8 encoding to see if that resolves your issue.

However, I should note that in Qiime2, the metadata is kept separate from the feature table for most applications including taxa barplot, so there’s no need to add the metadata to the biom table. See the example below.

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