taxa barplot per two groups

Hi everyone!

I wanted to know if there is a way to display in the taxa barplot exclusively the two groups that I am going to analyze and not every single sample.
Let me explain better: I have two groups, control and treated diets to analyse and for each diet I have 12 replications.
Is there the possibility of having only two barplots, one for the control diet and the other for the treated diet by putting the replications together?
I attach photos of my situation
taxa-bar-plots-bsf.qzv (377.9 KB)

Thanks in advance

Please check out this post and comments on it.
In short, you will need to group your table, modify metadata, and recreate the barplot with the grouped table.


1 Like

thank you so much!

I'm sorry, i don't understand how modify metadata.
I need to group control=c and treated=t for the treatment column.
I've done this command qiime feature-table group
--i-table table-no-mitochondria-no-chloroplast.qza
--p-axis sample
--m-metadata-file sample metadata.txt
--m-metadata-column "treatment"
--p-mode sum
--o-grouped-table grouped_treatmet_table.qza

Here, my sample metadata
sample-metadata-grouped.txt (790 Bytes)

thank you in advance for your help :slight_smile:

1 Like

So your grouped metadata should have only two rows with c and t as SampleID. It is needed only for the barplot plugin.

1 Like

Do you mean like this?
sample-metadata-grouped.txt (237 Bytes)

I tryed and I obtained this error
Plugin error from taxa:
Sample IDs found in the table are missing in the metadata: {'c', 't'}.
Debug info has been saved to /tmpscratch/labenaim/6213893/qiime2-q2cli-err-ai_ojtqc.log

could you show me an example of metadata with my characteristics?

As I wrote above, new metadata file should have only 2 rows with group IDs in the SampleID column.

When you grouped your feature table, all samples were joined together according your grouping column, so this grouped feature table should have only two samples, consisting of all samples from the group (mean or summ depending on the command you run). Now it requires a new metadata with this two group IDs as samples.


1 Like

thank you so much! In the meantime I tried again and now it works.

thanks a lot

Hi @Linda_Abenaim and @timanix,
I just want to jump in here to point out one thing. Grouping your samples in this way can lead to misleading results, as it hides variance across the samples. For example, if most of the samples look the same across your two groups, but you have a couple of outlier samples in one of your groups, that information will not be apparent in the grouped taxa bar plots. It could cause you to conclude that the groups are either more or less similar than they really are. For this reason, I generally advocate for showing all of the samples but sorting by group within the barplot.

For example, something like this based on the .qzv file that you shared:

Hope this helps!


Thank you for the input!

Yes, that's true. I also noticed that in some of my datasets taxonomy profiles were very different so I used all the samples and grouped them by subplots.


Thank you so much for your suggestion @gregcaporaso!
I thought to show both plot, what do you think?
@timanix what do you mean with grouped them by subplots?

1 Like

Subplots are a good way to do it too. If I'm thinking about this the same way you are @timanix, to achieve that you could use qiime feature-table split --m-metadata-column treatment ... to create one feature table per treatment group, and then call qiime taxa barplot on each of those feature tables.


Unfortunately I have this error.
Could do you help me?

Error: QIIME 2 plugin 'feature-table' has no action 'split'.

this was may command:

qiime feature-table split
--i-table taxonomyrdp/table-no-mitochondria-no-chloroplast.qza
--m-metadata-file sample-metadata.txt
--m-metadata-column treatment
--o-tables taxonomyrdp/table-split-treatment.qza

Another question: do you suggest using the rarefied table for taxa barplot?

thanks again

Hi @Linda_Abenaim,

What version of QIIME 2 are you using? The split action within q2-feature-table wasn't available until 2023.9, so you'll want to make sure you have that version of the amplicon distribution installed in order to utilize this method.

Cheers :lizard:


Iā€™m using Qiime2-2023.2

Can I install this?

Hi @Linda_Abenaim,

Gotcha! That version of QIIME 2 wouldn't have the split method, so this makes sense. Yep, go ahead and follow the install instructions I linked in my previous reply!


Thank you so much, I will try :grinning:

1 Like