grunwaldlab / metacoder

Parsing, Manipulation, and Visualization of Metabarcoding/Taxonomic data
http://grunwaldlab.github.io/metacoder_documentation
Other
134 stars 28 forks source link

Error for running alpha diversity analysis #316

Closed biosciences closed 7 months ago

biosciences commented 2 years ago

I tried to run alpha diversity analysis from https://grunwaldlab.github.io/metacoder_documentation/workshop--07--diversity_stats.html, and test below codes: library(vegan) sample_data$alpha <- diversity(obj$data$otu_rarefied[, sample_data$SampleID], MARGIN = 2, index = "invsimpson") hist(sample_data$alpha)

It returned such error: Error: Corrupt grouped_df using old (< 0.8.0) format. ℹ Strip off old grouping with ungroup(). Run rlang::last_error() to see where the error occurred.

rlang::last_trace() <error/rlang_error> Corrupt grouped_df using old (< 0.8.0) format. ℹ Strip off old grouping with ungroup(). Backtrace: █

  1. ├─base::$<-(...)
  2. └─dplyr:::$<-.grouped_df(...)
  3. ├─name %in% group_vars(x)
  4. ├─dplyr::group_vars(x)
  5. └─dplyr:::group_vars.data.frame(x)
  6. ├─generics::setdiff(names(group_data(x)), ".rows")
  7. ├─dplyr::group_data(x)
  8. └─dplyr:::group_data.grouped_df(x)
  9. └─dplyr::validate_grouped_df(.data)
zachary-foster commented 2 years ago

I do not get that error when I tried it just now. Try downloading "clean_data.Rdata" again and to make sure it is the updated version and try the code again.

Unaimend commented 10 months ago

I also got this error right now

zachary-foster commented 10 months ago

I am still not getting this error:

load("~/Downloads/clean_data.Rdata")

library(vegan)
#> Loading required package: permute
#> Loading required package: lattice
#> This is vegan 2.6-4
sample_data$alpha <- diversity(obj$data$otu_rarefied[, sample_data$SampleID],
                               MARGIN = 2,
                               index = "invsimpson")
hist(sample_data$alpha)

Created on 2023-09-05 with reprex v2.0.2

Can someone send me the URL to the "clean_data.Rdata" file they are using (or attach it) and their sessionInfo? Thanks

kayanac commented 7 months ago

Hello,

I am also having exactly the same issue.

Have you found a solution for this?

Thanks,

KY

zachary-foster commented 7 months ago

I have not been able to reproduce the problem. Until I can do that, there is very little hope of fixing the issue. Can you send me the URL to the "clean_data.Rdata" file you are using (or attach it) and your sessionInfo? Thanks

kayanac commented 7 months ago

Thank you for your quick response! I downloaded from the link below.

https://grunwaldlab.github.io/analysis_of_microbiome_community_data_in_r/07--diversity_stats.html

zachary-foster commented 7 months ago

Ahh, ok, that was the original website for the workshop, but we have been keeping an updated version here:

https://grunwaldlab.github.io/metacoder_documentation/workshop--00--introduction.html

I thought that website had been taken down actually. I will replace it with a link to the current location

kayanac commented 7 months ago

Thanks! Glad that it's solved.