Hi @m-ocejo! We currently don’t have that functionality in QIIME 2’s taxa barplots. I created an issue to track the addition of that feature. Note that you can sort the samples by a metadata category, so that samples from the same category will be grouped together (but each bar will still represent a single sample).
If you’re interested in using QIIME 1 to produce these grouped barplots, you can export your BIOM table and taxonomy data from your .qza files. In order to use summarize_taxa_through_plots.py, you’ll need to export a feature table that hasn’t been collapsed to a particular taxonomic level yet, along with the table’s corresponding taxonomic annotations.
For example:
qiime tools export table.qza --output-dir exported
qiime tools export taxonomy.qza --output-dir exported
Next, we’ll need to modify the exported taxonomy file’s header before using it with BIOM software. Before modifying that file, make a copy:
cp exported/taxonomy.tsv biom-taxonomy.tsv
The first few lines in biom-taxonomy.tsv
should look something like this (the actual data will differ):
Feature ID Taxon Confidence
0204aa97a655fab087a6f6902be35eb6 k__Bacteria; p__Bacteroidetes; c__Sphingobacteriia; o__Sphingobacteriales; f__Sphingobacteriaceae; g__Sphingobacterium; s__faecium -1.0
5cfeeb662c643e512cbfc724c984f53d k__Bacteria; p__Firmicutes; c__Bacilli; o__Lactobacillales; f__Lactobacillaceae; g__Lactobacillus; s__ -1.0
4dc10ad4afd35b9803d853e819d3cec5 k__Bacteria; p__Firmicutes; c__Clostridia; o__Clostridiales; f__Lachnospiraceae; g__; s__ -1.0
...
Change the first line of biom-taxonomy.tsv
(i.e. the header) to this:
#OTUID taxonomy confidence
Note that you’ll need to use tab characters in the header since this is a TSV file.
Your biom-taxonomy.tsv
file should now look something like this (the actual data will differ):
#OTUID taxonomy confidence
0204aa97a655fab087a6f6902be35eb6 k__Bacteria; p__Bacteroidetes; c__Sphingobacteriia; o__Sphingobacteriales; f__Sphingobacteriaceae; g__Sphingobacterium; s__faecium -1.0
5cfeeb662c643e512cbfc724c984f53d k__Bacteria; p__Firmicutes; c__Bacilli; o__Lactobacillales; f__Lactobacillaceae; g__Lactobacillus; s__ -1.0
4dc10ad4afd35b9803d853e819d3cec5 k__Bacteria; p__Firmicutes; c__Clostridia; o__Clostridiales; f__Lachnospiraceae; g__; s__ -1.0
...
Finally, add the taxonomy data to your .biom file:
biom add-metadata -i exported/feature-table.biom -o table-with-taxonomy.biom --observation-metadata-fp biom-taxonomy.tsv --sc-separated taxonomy
You can now use table-with-taxonomy.biom
as input to summarize_taxa_through_plots.py
.
Let us know how it goes!