ChiLiubio / microeco

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

cal_process from null model #328

Open DpennaS opened 4 months ago

DpennaS commented 4 months ago

Hi there!

Thanks for so many answers on my topics. Your package is awesome and your answers are great as well!

I am doing a null model analysis with the betaNTI and RCbray approach. I have 10 different sites and I would like to have the table from cal_process for each site. Each site have 6 samples.

Now I am running the code like this:

x <- clone(ps_microeco) x$sample_table <- subset(x$sample_table, Local == "x") x$tidy_dataset()

x <- trans_nullmodel$new(x, env_cols = c(7:14,20,22))

Beta NTI

tmp <- "./null_models/x"; dir.create(tmp)

null_x$cal_ses_betamntd(runs = 999, abundance.weighted = TRUE, use_iCAMP = TRUE, iCAMP_tempdir = tmp)

RCbray

x$cal_rcbray(runs = 999)

View table

x$cal_process(use_betamntd = TRUE)

x$res_process

I don't know if make sense or its possible, but I think it would be nice to have a parameter inside cal_process to separate by groups from the sample_table

e.g. x$cal_process(use_betamntd = TRUE, group = "Local")

Thanks for the attention! Best regards, Penna

ChiLiubio commented 4 months ago

Hi Penna, Thanks for the suggestion. I have added the parameter group in the function cal_process. Please reinstall the package from github and try again. The CRAN version will be released in the coming days.

Best, Chi

DpennaS commented 4 months ago

Hello! Thanks for the quick answer!

I reinstalled with the command: devtools::install_github("ChiLiubio/microeco")

In the help I already see the new argument "group" in the function.

However, when i try to use an error occur. "Unused argument (group = "Local)

x$cal_process(use_betamntd = TRUE, group = "Local")

Best, Penna

ChiLiubio commented 4 months ago

Hi. You need to recreate the trans_nullmodel object as the x is created with previous version. New created object has the new parameter.

DpennaS commented 4 months ago

Hi!

Now it worked!

There are some sites with results really different from what I was doing earlier (e.g. 46 % homogeneous selection before and 100% homoegeneous selection after)

I don't know if this makes sense.

Best, Penna