ChiLiubio / microeco

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

Error in tans_beta$new #108

Closed JBL05 closed 2 years ago

JBL05 commented 2 years ago

Can anyone help, plz?

t1 <- trans_beta$new(dataset = dataset, group = "Reach", measure = "bray") Error in initialize(...) : Input measure should be one of beta_diversity distance in dataset !

JBL05 commented 2 years ago

Problem fixed by calculate bet_diversity distance matrix before using function trans_beta, sorry!

FreitasAndy commented 2 years ago

Hi all.

I had the same problem here, but did not found the function to calculate the beta diversity matrix as you showed.

Can anyone help me, please?

FreitasAndy commented 2 years ago

Just found here.

dataset$cal_betadiv(method = "bray")

spencerlong1 commented 2 years ago

Hi, I am a little stuck on this point as well and was wondering if you had a bit more detail on how to prevent the error. After you use dataset$cal_betadiv(method = "bray") how do you then use the output, so that you then get to the point where trans_beta$new(dataset = dataset, group = "Reach", measure = "bray") will work? For context I was then going to go straight into t1$cal_ordination(ordination = "PCoA") etc.

EDIT: Sorry, understand now. Was getting error due to issues with data frames used

ChiLiubio commented 2 years ago

Good question! trans_beta can use dataset$beta_diversity$bray matrix. So current logic is 1) dataset$cal_betadiv(method = "bray") can generate dataset$beta_diversity$bray 2) t1 <- trans_beta$new(dataset = dataset, group = "Reach", measure = "bray") can generate a t1 with bray in t1 in order for other operations calling bray matrix. To make the step simple, I will add a checking step in the function to automatically calculate bray if a microtable object is found without beta diversity matrix.

spencerlong1 commented 2 years ago

Thanks Chi!