umerijaz / microbiomeSeq

An R package for microbial community analysis in an environmental context
66 stars 26 forks source link

Error with perform_anova function? #57

Open kilojarek opened 2 years ago

kilojarek commented 2 years ago

Hi,

I am trying to run the plot_anova_diversity function but it produces an error:

plot_anova_diversity(physeq1, method = "shannon", grouping_column = "Type")

Error in names(df_pw) <- c("measure", "from", "to", "y", "p") : 'names' attribute [5] must be the same length as the vector [1]

My grouping column "Type" has 2 levels. The function produces the anova_diversity.cvs but it contains rows with measures of diversity that I did not specify (e.g. richness and simpson). When I re-run plot_anova_diversity with the 3 measures of diversity as in the tutorial, the error changes slightly:

plot_anova_diversity(physeq1, method = c("richness","simpson", "shannon"), grouping_column = "Type")

Error in data.frame(x = c(which(levels(df[, grouping_column]) == as.character(df_pw[i, : arguments imply differing number of rows: 0, 2

Since I can run anova and calculate diversity manually on my phyloseq1 object, I tracked the source of the issue to the perform_anova function and the way it creates the df_pw data frame, but I am stuck there and can't figure out what's wrong. The anova_diversity.cvs has all 6 columns and I don't know what the "vector" in the first error message refers to.

Is this an error in the code? Or what am I missing? Any hints would be very appreciated.

kilojarek commented 2 years ago

I have realised that there is an outstanding PR for this very issue - https://github.com/umerijaz/microbiomeSeq/pull/29/commits/0242f438878805aefa910cf921fb9a4f4f078255

If anyone's reading this, the issue is with the column and object type. I have provisionally modified the perform.anova function and it seems to be working. But the PR was submitted 3 years ago and was not incorporated into the code. Is this package dead?