how can I do so that I can compare the diversity of different group

Hi @Chnyng !

First of all, I think maybe it is better to run the tools (DADA2, diversity) on all the samples inside the same QZA, not individually for each group. ¿Why? Because, for example, diversity metrics are really dependent on the depth you rarefy. If you rarefy each group to a different depth, I'm afraid those metrics are not comparable. So I would run all QIIME 2 commands in all samples from the beggining.

Now, your question:

As you want to compare diversity, you first need to compute diversity metrics with diversity plugin (using core-metrics, or core-metrics-phylogenetic, or alpha, or beta, etc). Then, here you have how I would compare alpha and beta diversity measures using diversity plugin:

  • Alpha diversity: Let's suppose you want to compare e.g. Shannon indexes. You can use the alpha-group-significance. This applies Kruskal-Wallis test to compare groups of alpha diversity values. The command should look something like:
qiime diversity alpha-group-significance \
          --i-alpha-diversity shannon_vector.qza \
          --m-metadata-file metadata.tsv \
          --o-visualization shannon_significance.qzv
  • Beta diversity: When you compute beta diversity metrics, you don't obtain a vector of values per sample. Instead, you obtain a matrix of distances for each sample against each of the other samples. For this kind of data we can use permutation-based statistical tests. One example is PERMANOVA. QIIME 2 allows you to perform those tests with beta-group-significance. In these cases, you need to specify the metadata column you want to test. Imagine you computed a beta metric (e.g. Bray-Curtis), and now you want to test if beta diversity is different in your samples according to the metadata column "bodysite". The command would be something like:
qiime diversity beta-group-significance \
          --i-distance-matrix bray_curtis_distance_matrix.qza \
          --m-metadata-file metadata.tsv \
          --m-metadata-column bodysite \
          --p-method permanova \ # you can also use anosim or permdisp
          --p-pairwise \
          --o-visualization bray_curtis_significance.qzv

Related and useful forum post for understanding diversity metrics: Alpha and Beta Diversity Explanations and Commands

Please note this is only one way to do it, not necessarily the only one, let alone the best.

Cheers,

Sergio

--

Disclaimer: I'm only another forum user, just like you. Please don't take my answer as a ground truth. A Forum Moderator would probably provide you with a more accurate answer.

1 Like