ChiLiubio / microeco

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

Mantel + Correlation heatmap #307

Closed DpennaS closed 7 months ago

DpennaS commented 8 months ago

Hello!

Fist of all, congrats for microeco package, i love it!

I was following the tutorial to perform a Mantel test + Heatmap correlogram and I have a little doubt about.

The partial mantel test used more than 2 matrixes, so the function cal_mantel() also have the add_matrix parameter. However, in the tutorial Mantel test + Heatmap correlogram:

t1 <- trans_env$new(dataset = d1, env_cols = 8:15) t1$cal_mantel(use_measure = "bray", partial_mantel = TRUE)

It is used the partial_mantel = TRUE, why?

Best regards,

ChiLiubio commented 8 months ago

Hi. Thanks. The cal_mantel function can automatically split the envs into two when partial_mantel = TRUE. One (target variable) is for the correlation, and the other (all the remained) is for the third matrix "zdis". The add_matrix parameter here is used for customized beta diversity input matrix or other matrix for the correlation, not for the partial mantel. Please feel free to tell me if you have other suggestions.

Best, Chi

DpennaS commented 8 months ago

Oh got it, so when the partial mantel is TRUE it will use all the environmental variables matrix combined as the third matrix?

Because I have different results with the correlation with Phylum when using partial mantel or not

Best, Daniel

ChiLiubio commented 8 months ago

Yes. All the environmetal variables except the one for the 'ydis'. Do you think is it necessary to add a parameter for the customized input of the third matrix instead of the default variables?

Best, Chi

DpennaS commented 8 months ago

I dont think it is necessary to add a parameter for the customized input. However I have doubts about what is the variable being selected for the ydis.

For example, I have around 6 variables besides the distance matrix. Those variables are temperature, pH, atmospheric temperature etc

What of those is the ydis?

Because the results are different when i choose partial or not partial mantel

Best, Penna

ChiLiubio commented 8 months ago

When the function runs mantel test, it will do that for each variable seperately. So for pH, the ydis is the euclidean distance matrix from pH. If the partial mantel test is applied, ydis is same, and zdis is the distance generated from remained five variables.

DpennaS commented 8 months ago

Ohh now I understand better So i think that the function actually is working pretty well. I can evaluate the major influence of that variable, but with influence from the other ones as well Good job!

Thanks, Penna