Adonis in R vs. qiime diversity adonis

Hi QIIME2 Folks,

I’m running adonis in R (RStudio 1.1.456) and using qiime diversity adonis (qiime2-2019.1) and getting very different results using the same distance matrix and mapping files. I suspect I’m doing something wrong in R - any suggestions?

qiime2 commands
qiime tools import
–input-path /weighted_unifrac_nasal.dm.txt
–output-path /weighted_unifrac_nasal.dm.qza
–type DistanceMatrix

qiime diversity adonis --i-distance-matrix /weighted_unifrac_nasal.dm.qza --m-metadata-file /mapping.nasal.removedlowreads.txt
–p-formula “Farm * Status” --o-visualization /adonis.nasal.farm*status.qzv

Results:
Df SumsOfSqs MeanSqs F.Model R2 Pr(>F)
Farm 5 0.115266 0.023053 1.665557 0.233208 0.070
Status 2 0.080406 0.040203 2.904591 0.162678 0.010
Farm:Status 6 0.132498 0.022083 1.595455 0.268071 0.099
Residuals 12 0.166094 0.013841 NaN 0.336043 NaN
Total 25 0.494263 NaN NaN 1.000000 NaN

R adonis commands
UF7 <- weighted_unifrac_nasal.dm.txt
AH <- mapping_nasal_removedlowreads.txt

adonis(UF7 ~ Farm * Status, data=AH)

Results:
Call:
adonis(formula = UF7 ~ Farm * Status, data = AH)

Permutation: free
Number of permutations: 999

Terms added sequentially (first to last)

        Df SumsOfSqs  MeanSqs F.Model      R2 Pr(>F)

Farm 5 0.08422 0.016844 0.88366 0.17039 0.599
Status 2 0.05281 0.026407 1.38534 0.10685 0.208
Farm:Status 6 0.12849 0.021416 1.12350 0.25997 0.311
Residuals 12 0.22874 0.019061 0.46279
Total 25 0.49426 1.00000

Note: When I upload the distance matrix file in R, I say “Yes” to the Heading row with sample IDs and “Use first column” (of sample IDs) as Row Names.

Thanks for any advice anyone can provide on this!

-V. Hale

Welcome @V.Hale!

I have a guess: I believe vegan-adonis assumes that the distance matrix and sample metadata list samples in the same order. Your samples must be in different orders, so you do not see significance in R.

qiime diversity adonis is actually just running vegan-R under the hood. You can see the R script here: https://github.com/qiime2/q2-diversity/blob/master/q2_diversity/_beta/adonis_assets/run_adonis.R

Try ordering your sample IDs and let us know if that works!

3 Likes

AH! Such an easy fix. Thanks so much!
-V. Hale

1 Like

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