ChiLiubio / microeco

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

questions about db-RDA implementation #263

Open jamorillo opened 1 year ago

jamorillo commented 1 year ago

Hello! We have been using your package with great success, however, we have encountered a few challenges when conducting the dbRDA analysis. We'd appreciate your guidance on these points to fully understand how the function works. Here are our questions:

Q1) Do you recommend using the ASV table data that has been normalized (via rarefaction) as an input for trans_env, or should we use non-normalized data?

Q2) Regarding the scaling/transforming of the feature table prior to running the RDA analysis, we noticed a previous issue that was discussed here: https://github.com/ChiLiubio/microeco/issues/246. In your response, you mentioned the scale = TRUE option in trans_env$cal_ordination. However, it appears that the scale parameter doesn't seem to do anything. Could you please explain the exact operation behind "scale OTUs to unit variance"? Furthermore, when we referred to the ?trans_env documentation, scale isn't listed as an option in the cal_ordination function. We are currently using microeco version 20.0 (updated today).

Here's an example of how we're using the function:

trans_env_ITS <- trans_env$new(dataset = microecoITS_norm, add_data = var_selected)

trans_env_ITS$cal_ordination(method = "dbRDA", use_measure = "bray", feature_sel = TRUE, taxa_level = "OTU", scale = TRUE) # scale seems to do nothing(?)

Q3) Would it be possible to apply a sqrt transform to the ASV table in microeco? If not, we believe we could export to vegan to achieve this. What would you suggest.

Q4) We're using ASVs, but we assume that we need to specify taxa_level = "OTU" in cal_ordination - is that correct? We aim to conduct this analysis at the ASV level, which we believe is the default?

Q5) We aim to calculate the percentage of variation in ASV data explained by each environmental variable. It seems that dbRDA may not be the best approach for this since r^2 values are calculated individually. Is there an alternative method within microeco for this purpose?

Thank you very much for sharing your expertise and for developing this excellent package.

Best regards from Spain!

ChiLiubio commented 1 year ago

Hi Thanks. The following are my limited knowledge and understanding on these questions. Q1) Two ways are both fine. Using rarefaction is easy to do and can reduce operation steps. As you said, using non-normalized data require normalization. Q2) scale = TRUE can only be applied to "RDA", not method = "dbRDA". The reason is scale parameter is passed to rda function of vegan package to normalize the taxa data. However, the input of dbRDA is beta diversity distance matrix, not the species abundance table. So now the input is the distance microecoITS_norm$beta_diversity$bray Q3) I will consider to move the trans_norm class (https://chiliubio.github.io/microeco_tutorial/mecodev-package.html#trans_norm) of mecodev package to microeco package to make the data transformation easier. Thanks. Q4) Yes. They are same. Here 'OTU' represents all types of features in the otu_table, OTU/ASV/genes. Q5) It is hard to say whether there is a perfect way to get the variations for each variable. To see which variable is more important, it is better to use significance coming from cal_ordination_anova function. If the variables number is low, you can try to use varpart function of vegan package to do variance partitioning analysis. Generally, the best way to use R2 is to get the total model R2 explained by all variables. When there are many variabels, I am not sure whether we can get an R2 for each variable exactly.

Best, Chi

jamorillo commented 1 year ago

Hello, Thanks a lot for your ideas! We used mecodev to transform the ASV table, is easy and works well. I only have one question, do you know if in the output there is a global p-value indicating significance of the full dbRDA model? I see R2 but not that p. Best, jose