Open msmcfarlin opened 1 year ago
So in the original DivNet R package, there is a vignette that mentions using Bray-Curtis, Euclidean distance, and Aitchison distance as input into the testBetaDiversity
function. So there should be no trouble with using any of those distances as input to testBetaDiversity
.
The real trouble, which you have seen as you linked to #3, is that I don't have any tutorial showing how to calculate beta-diversity measure from the output that divnet-rs gives you. Or how to use that as input to the testBetaDiversity
function. You can do it for sure, but I left it as an exercise for the reader :laughing:!
However, @LTibbs was kind enough to provide code in which the bray-curtis measure and euclidean distance is calculated. (It is linked in that issue.) You could use that as a basis for your own R code, adding in the Aitchison distance (which is equivalent to the Euclidean distance on the centered-log-ratio scale...i.e., CLR transform the relative abundances, then do euclidean distance on that).
Finally, you will need to look at the source code for the testBetaDiversity
function in the DivNet R package and understand how the calculation works, and what type of data in needs for its input. Then you need to either 1) get the data from divnet-rs into that format, or 2) factor out the code used in testBetaDiversity
into the data format divnet-rs or LTibbs script outputs. (For reference, that function can be found here. At a quick glance, doesn't look too tricky to adapt to your needs.)
So the real answer to your question is, if your R skills are good, you can probably do it without too much trouble. Unfortunately, I will not be able to add a tutorial with example code to the docs, or to add code to the divnet-rs repository to handle this use-case for probably the next couple of months.
TL;DR: you can use Aitchison distance, but you need to write R code yourself. Then you need to get it in a format that testBetaDiversity
can handle.
Hello,
I am interested in using divnet-rs to calculate beta diversity measures and ideally then using them in the DivNet function testBetaDiversity() to test for significance. I saw the earlier posting, #3, that discussed this though it didn't address Aitchison distance or using the measures in testBetaDiversity().
Has anyone had any success in calculating Aitchison distance? And has anyone been able to use beta diversity metrics, Aitchison or others, in testBetaDiversity()?
Thanks, -Mike