distance matrix and clustering by taxa marplot

I've even completed the process of making a taxonomy barplot using my data. My boss wants me to use the distance matrix in this taxonomy to group things with similar taxonomy configurations. What should I do?

How do you calculate the distance matrix and how can you group(clustering) it?

Hello @rbfks100333,

ok good job so far!

One way to answer your question would be to perform beta-diversity analysis on your samples.
Pleas take a look at the 'Moving picture tutorial' (“Moving Pictures” tutorial — QIIME 2 2022.8.3 documentation), 'Alpha- and Beta- diversity analysis ' section.
There is a plug in (qiime diversity core-metrics-phylogenetics) which may be help you (if you dont have the phylogenetic tree, you could use is version without the phylogenetic aspect).
THis plug in will do many operation behind the scene, which are: rarefaction of all samples at same total count to normalise them; creating distance matrix using many distance metrics; creating emperor plot to visualise the samples in a 3d space (according to the used metric).
Then you can select the one showing best separation among your groups to performe the significance analysis, using the 'qiime diversity beta-group-significance' plug in.

All this step will be performed using the ASVs, which is more sensitive then using any specific taxonomic level. You may repeat all these steps after collapsing all the data to a certain taxonomic level but for now I would suggest to do not do that! You cold lose some information collapsing to a any taxonomical level!

Hop eit helps


Hi @llenzi !
Thank you for leaving comments!
But I've already done the beta diversity stage... I would like to group the samples through distance matrix verification between the finally released samples.

1 Like

Hi @rbfks100333,

Could you clarify what is your aim? Maybe pointing to an example of what you would like to get?

If your aim is to visualize samples contained in the same cluster grouped by circles in the emperor plot, I don't think you can do within qiime2, but you need to import the distance matric in R and plot as you prefer.

If your aim is to grouping different clusters if their distance is less then a threshold, I am not sure there is a plug in that enable you to do that. However, you could manually create a metadata column which will reflect the cluster you want and plot by that.

Another option could be to collapse the taxonomy at any level you like, and visualize it as heatmap (heatmap: Generate a heatmap representation of a feature table — QIIME 2 2022.8.3 documentation), this will apply a distance metrix and will sort the column accordingly to their distance, so that similar samples will be closeby in the heatmap.

Hope it helps

1 Like

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