How to output bar-plot without taxa collapse

Hi, thanks for reading my topic!
We found a unique bacteria in our data.
When we go back to check their ASV sequences, they mainly belong to two strains (we blasted their sequences).
Now we want to check their distribution in each patient, but the taxa barplot function seems collapse all ASVs with same taxonomy into one bar. (ie, there are 6 E. coli ASVs but the barplot show only 1 E. coli)
Can we output bar plot with each ASVs?

Thank you!

commands I use:
qiime taxa barplot
--i-table table-dada2.qza
--i-taxonomy taxonomy.qza
--m-metadata-file sample-metadata-all.tsv
--o-visualization taxa-bar-plots.qzv

Hello @RayLin
That's quiet interesting question!
Unfortunately, there is no such function in the Qiime2 by default.
As an alternative, you can use heatmap directly with your feature table.

But it bothered me for a while, and I wanted to try one trick to create an asvbarplot, although never implemented it until you asked the same question!
So, here is an illegal solution :wink::
1 Export your taxonomy as a tsv file:

qiime tools export \
  --input-path taxonomy.qza \
  --output-path ./

2 Open resulted taxonomy.tsv file in any editor you like and copy Feature ID column values (ASV hashes). Replace taxonomy annotations in Taxon column by ASV IDs. Save changes into the same file. Or, you can rename taxonomy annotations in taxon column to ASV1, ASV2.. ASVn if you would like so on this step
Screenshot from 2021-09-24 09-26-30

3 Import this file back into the Qiime:

qiime tools import \
  --type 'FeatureData[Taxonomy]' \
  --input-path taxonomy.tsv \
  --output-path mock_taxa_asv.qza

4 Create an ASVbarplot:

qiime taxa barplot \
  --i-table feature-table.qza \
  --i-taxonomy mock_taxa_asv.qza \
  --m-metadata-file metadata.tsv \
  --o-visualization asv-barplot.qzv

Which will create barplot with ASVs instead of taxa


Hi @timanix , thanks for quick reply.
Heatmap is my backup solution because bar plot can show only the ASVs I want to see.
I will try your suggestions later.

Thank you and have a nice weekend !


Hello @timanix

I got the ASV bar plot by following your instructions, it's quite clear and simple.

Thank you !

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