Continuing the discussion from Retaining mantel test output data:
Hi,
Sorry for the naive questions but I wanted to reproduce the plot in R so I can label the plots but I have some questions:
- I read that the mantel test qiime 2 implements is the skbio.stats.distance.mantel function in python, which is similar to vegan::mantel. I tried doing mantel test in R (from the vegan library) on a pair of distance matrices I exported from qiime 2 and the p values I got were off:
WUnifxMetadata1
In qiime 2 (2019.1)
Mantel test results
Method: Spearman
Sample size: 14
Permutations: 999
Alternative hypothesis: two-sided
Spearman rho: -0.0915592
p-value: 0.548
In R:
Call:
mantel(xdis = distmat_wunif, ydis = distmat_metadata1, method = “spearman”, permutations = 999)
**Mantel statistic r: -0.2183 **
**Significance: 0.982**
Upper quantiles of permutations (null model):
90% 95% 97.5% 99%
0.212 0.292 0.365 0.428
Permutation: free
Number of permutations: 999
WUnifxMetadata2
In qiime 2 (2019.1):
Mantel test results
Method: Spearman
Sample size: 14
Permutations: 999
Alternative hypothesis: two-sided
Spearman rho: 0.531181
p-value: 0.021
In R:
Call:
mantel(xdis = distmat_wunif, ydis = distmat_metadata2, method = “spearman”, permutations = 999)
**Mantel statistic r: -0.2216 **
**Significance: 0.871**
Upper quantiles of permutations (null model):
90% 95% 97.5% 99%
0.304 0.379 0.480 0.551
Permutation: free
Number of permutations: 999
1b. In my results from qiime 2 I see some metadata measures with weak to moderate correlation (around 0.25-0.5) but whose p value is highly significant (p < 0.025 or less)-- how do I interpret results like these?
- I wanted to reproduce the scatter plot produced in qiime 2 in R; do I understand it correctly that the visualization in qiime 2 is just a correlation plot between the values from the two measures (e.g., beta-diversity and numeric metadata)? That means that each point in the plot represents a pairing of distances (betadivdistAB-metadatadistAB, betadivdistAB-metadatadistAC; given samples A, B, C… etc).
-
Can I please ask help how I may be able to do this starting from the two distance matrices? There were some directions in the post I linked but I didn’t really get it.
-
Will it make sense to want to color these data points by a metadata category given that these represent pairs instead of individual samples (I wanted to see if the plots with significant correlation show grouping by metadata category, in which case it would make sense to re-do the mantel test on a subgroup)?