Link BIOM table with taxonomy

Dear all,
@thermokarst @gregcaporaso

Firstly, my apologies if I'm not posting at the right page/platform, I’ve been following Qiime2 tutorials for 18S data analysis that helped me a lot being naive to Qiime2 (many thanks all for the posts and very helpful discussions) and now when I’m near the end of the analysis, I’ve spent a fair bit of time on creating and exporting BIOM table, but it looks like it doesn’t link with taxonomy (the taxonomy colum remains blank), please see below the codes and outcomes:
Any help to figure it out would be highly appreciated. Thank you in advance

qiime tools export --input-path table-Strongy-Chab-wf7.qza --output-path Biom-LScomplwf7
qiime tools export --input-path taxonomy-LScompl0.5filter-wf7.qza --output-path Biom-LScomplwf7

cp Biom-LScomplwf7/taxonomy.tsv Biom-LScomplwf7/biom-taxonomy.tsv

Change the first line of biom-taxonomy.tsv (i.e. the header) to this:
#OTUID taxonomy confidence

biom add-metadata -i Biom-LScomplwf7/feature-table.biom -o Biom-LScomplwf7/table-with-taxonomy.biom --observation-metadata-fp Biom-LScomplwf7/biom-taxonomy.tsv --observation-header "taxonomy" --sc-separated taxonomy

biom convert -i Biom-LScomplwf7/table-with-taxonomy.biom -o Biom-LScomplwf7/table.from_biom_w_taxonomywf7.tsv --to-tsv --header-key taxonomy


Hi @Ghaz, welcome to :qiime2:!

It looks like you have some extra and missing command options for biom add-metadata and biom convert. Checkout this post for more details.

1 Like

Many thanks for your kind response @SoilRotifer.

The good news is it did work, and taxonomy was added to the file, but it changed the OTU names from features ids to reference database ids, as highlighted in the below image, can I retain the feature ids as such?
Also I'm confused at the step where adding taxonomy (in step: biom add-metadata -i feature-table.biom -o feature-table-tax.biom --observation-metadata-fp 97_otu_taxonomy.txt --sc-separated taxonomy) to feature-table.biom, do I need to add reference taxonomy or taxonomy file generated after alignment of seqs-dada2?
Thank you so much

Hi @Ghaz, not sure how that happened unless the files are getting mixed up. I just tried the following commands using the table.qza and taxonomy.qza files from the Moving Pictures tutorial, and the commands below worked as expected.

# Export:
qiime tools export \
    --input-path table.qza \
    --output-path exported_table
    
qiime tools export \
    --input-path taxonomy.qza \
    --output-path exported_taxonomy/

Edit taxonomy header of exported_taxonomy/taxonomy.tsv :
- replace: "Feature ID Taxon Confidence"
- with: "#OTUID taxonomy confidence"

# Add metadata:
biom add-metadata \
	-i exported_table/feature-table.biom \
	--observation-metadata-fp exported_taxonomy/taxonomy.tsv \
	--sc-separated taxonomy \
	-o feature-table-tax.biom

# Make tsv:
biom convert \
	--table-type="OTU table" \
	-i feature-table-tax.biom \
	--to-tsv \
	--header-key taxonomy \
	-o feature-table-tax.tsv

Optional sanity-check: make a tsv file from your initially exported exported_table/feature-table.biom table, i.e. w/o taxonomy. Compare this to your feature-table-tax.tsv with the taxonomy.

biom convert \
	--table-type="OTU table" \
	-i exported_table/feature-table-tax.biom \
	--to-tsv \
	-o feature-table.tsv

You can find more information about biom conversion here.

2 Likes

Many thanks for your help @SoilRotifer. Much appreciated.
It worked finally :slight_smile:
cheers,

2 Likes

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