Cannot Add Taxonomy to ASV table

I've been looking at a number of other User questions but I can't get anything to work for me.

This is the code I have put together looking from a number of places

#exporting the ASV table
qiime tools export \
  --input-path table.qza \
  --output-path ASV_table

  #export taxonomy table
  qiime tools export --input-path taxonomy.qza --output-path ASV_table

#nano into taxonomy.tsv and change header to OTU ID "tab" taxonomy "tab" confidence

biom add-metadata -i ASV_table/feature-table.biom \
-o ASV_table/ASV_with_taxonomy.biom \
--observation-metadata-fp ASV_table/taxonomy.tsv --sc-separated taxonomy \
--observation-header OTU\ ID,taxonomy,confidence

#convert to .tsv

biom convert -i ASV_table/ASV_with_taxonomy.biom -o ASV_table/ASV_with_taxonomy.tsv --to-tsv

The second command qiime export gives taxonomy.tsv. the header line looks like
Feature ID Taxon Confidence

The final command created a file ASV_with_taxonomy.tsv that is only the ASV table. The header looks like

Constructed from biom file

#OTU ID CH0 CH1 CH2 CH3 CH4 TI0 TI1 TI2 TI3 TI4

Other posts suggested changing the header in the taxonomy.tsv file to match this so I nano in and change the first line to:
OTU ID taxonomy confidence

Which is why I added that step in the comments. But I am still just getting a ASV table in the ASV_with_taxonomy.tsv file.

I don't know how to "look" into the biom files so I'm not sure what is going on in there.

Any suggestions?

Perhaps it's easier to do this step in R somehow?

Hi @Bonita_Mc ,
See the following topic. It is possible to merge the taxonomy and ASV table (once the table is transposed so that feature IDs are the row labels to match the taxonomy).

Good luck!

2 Likes

The feature IDs are the row labels in the taxonomy file. The column names are:

Feature ID Taxon Confidence

transposing it makes them the column labels and simply transposes my final output. It is still just an ASV table but with the sample IDs as row names.

I finally found the forum post talking about changing the header names. It is here:

But I have made sure my header has tabs and it opens proper in excel so I don't think that's the problem.

The solution you suggested uses a different command altogether. I can try this as well but I was hoping to create both a .biom and .tsv file of the ASV table with taxonomy information.

Hi @Bonita_Mc ,

Okay I understand. From your first post it sounded to me like you wanted the TSV in the end, and biom-format was just used to merge the metadata before creating the TSV.

If you want both the biom and TSV then you will need to use a different approach to figure out how to add metadata to a biom table using biom-format or another package (sorry, can't help you there; short answer is: there is no way to add the metadata into a biom table format using QIIME 2). Unless if it is possible to import an annotated OTU table into biom format (I am not sure about this) — if so, you could follow the solution I shared above and then convert to a biom table with biom-format.

Good luck!

1 Like

Ok, I understand.

I guess that ability must have been lost in a version update because I was finding people who had been successful (like the post I shared) but the posts were all old.

Thanks for you help!