ChiLiubio / microeco

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

Mantel test and Pearson's correlation #393

Open johagcoria opened 1 month ago

johagcoria commented 1 month ago

Hi,

I have a question about Mantel test and Pearson's correlation.

I have a taxonomic profile of soil samples, I have calculated the alpha and beta diversity using Microeco. Then I ran a differential abundance test to evaluate my factors. Now I have selected only those bacterial genera involved in biological nitrogen fixation that had statistical significance in the treatment factor. Now I want to know if there is a correlation between the physicochemical properties of the soils, but I think that Microeco only allows this analysis with the most abundant genera, so what I have done is to select the counts of the significant genera and recreate the microtable object. However, as these correlations are calculated based on beta diversity, I am not sure if this analysis can be done in this way. Can you help me understand if this is correct? Or in any case, tell me if there is a way to select only the taxa that were significant and not the most abundant ones to do the analysis.

Thank you very much.

ChiLiubio commented 1 month ago

Hi. For the pearson correlation, please follow this example in the tutorial:

library(microeco)
library(magrittr)
data(dataset)
data(env_data_16S)

t2 <- trans_diff$new(dataset = dataset, method = "rf", group = "Group", rf_taxa_level = "Genus")
t1 <- trans_env$new(dataset = dataset, add_data = env_data_16S[, 4:11])
# provide taxa names to other_taxa param
t1$cal_cor(use_data = "other", other_taxa = t2$res_diff$Taxa[1:20])
t1$plot_cor()