How to create a beta diversity plot similar to this one from the Global Gut study?

Hello everyone,

In this Youtube lecture by Dr. Dan Knights (Microbiome Discovery 9: UniFrac - YouTube), he mentioned a "neat trick" that they used in the Global Gut study, that is, to plot beta diversity values as single variables by comparing each sample to a baseline/population.

I would like to create a similar plot with my data but I'm not sure I understand this properly and which values from QIIME2 should I take. I tried exporting my weighted_unifrac_pcoa_results.qza using qiime tools export, and it gave me a file called "ordination.txt" that looks like this if I open it in Excel:

As you can see here, each sample here has many (beta diversity) values - which value should I take?
And does anyone know what is this plot usually called (beta diversity plot where the values are represented as average distance values to a certain sample/population)?
I would like to learn more about this but I cannot find other tutorials that explain such plots.

Many thanks for your kind help!

Hi @fgara,
I have good news. In QIIME 2 that sort of analyses is available out of the box, no "neat tricks" required :grin:

This can be done using the first-distances action, which has an option to compare to some baseline value:

That baseline value can even be configured so that the "baseline" can be a reference sample from another subject by editing the sample metadata to link those samples. E.g., I have used that action to measure the distance of infants at different ages to their mothers at birth.

For more specifics though or if that does not match what you are trying to do, you should probably contact the original authors of that study to see what they did, since you are trying to replicate their plot.

Good luck!


Hi @Nicholas_Bokulich,

OH WOW thank you very much for pointing this out!!!
I’ll try this!

And thank you for being extremely helpful!
This is why we love QIIME2 (and you all) so much! :grin:


Hi @Nicholas_Bokulich,
Hope you are well! :slight_smile:

I couldn’t seem to find the right command to visualize the result of first-distance command (e.g. first-distances-baseline-0.qza).

How do I convert this .qza to .qzv?

Thank you so much once again!!

1 Like

Use the volatility visualizer (described earlier in that tutorial).

Good luck!


Thank you so much!
May I just ask for your quick confirmation please, if the following is the correct output plot (visualization of first-distances-baseline-0.qza)?

I used the following command:

qiime longitudinal volatility --m-metadata-file ecam-sample-metadata.tsv --m-metadata-file first-distances-baseline-0.qza --p-default-metric Distance --p-default-group-column delivery --p-state-column month --p-individual-id-column studyid --o-visualization volatility-first-distances-baseline-0.qzv

Thank you very much indeed!

Yes, that’s the correct visualization. This is showing you distance to baseline in each subject at each time point (starting at month 1). The x-axis is quite stretched out but you can see that the vaginally delivered group experiences a very modest increase in distance over time (basically because by month 1 the gut microbiome has already changed quite a bit since birth!)

1 Like