ChiLiubio / microeco

An R package for data analysis in microbial community ecology
GNU General Public License v3.0
181 stars 55 forks source link

PerMANOVA for trans_alpha$cal_diff() #315

Closed biazen123 closed 1 month ago

biazen123 commented 5 months ago

Hi I did PerMANOVA for beta diversity cal_diff() in microeco package. Is that possible to apply it for Alpha diversity in trans_alpha$cal_diff() like other functions (Eg. KW, KW_dunn, anova etc) because PerMANOVA would be better to test the difference for experiments with an unbalanced design? If that is, looking for your suggestion how to run it in microeco. Regards!

ChiLiubio commented 5 months ago

Hi. To temporarily apply it, how about converting the alpha diversity to a Euclidean distance matrix and view it as a "beta diversity" dismilarity matrix like the following shows?

library(microeco)
data(dataset)
dataset$cal_alphadiv()
tmp <- as.matrix(dist(dataset$alpha_diversity[, "Shannon", drop = F]))
dataset$beta_diversity$tmp <- tmp
t1 <- trans_beta$new(dataset = dataset, group = "Group", measure = "tmp")
t1$cal_manova(manova_all = TRUE)
t1$res_manova

Best, Chi

biazen123 commented 5 months ago

Hi Chi Thank you very much for your prompt suggestions.