jn-goe / gruffi

Granular Functional Filtering (Gruffi) to isolate stressed cells
GNU General Public License v3.0
11 stars 6 forks source link

Error message related with Idents #10

Closed ibassets closed 1 year ago

ibassets commented 1 year ago

Hi, I would please appreciate help installing Gruffi. I get an error message during the installation that I try to describe below. (note: I have limited R knowledge). After all packages have been installed and loaded, including also the Seurat object, I run the following code extracted from GitHub edited to include the the name of my Seurat object ('all samples.combined')

combined.obj <- Seurat.utils::SetupReductionsNtoKdimensions(obj = allsamples.combined, nPCs = 30, dimensions=1:20, reduction="umap") ensembl <- biomaRt::useEnsembl("ensembl", dataset = "hsapiens_gene_ensembl") go1 <- "GO:0006096" # Glycolysis go2 <- "GO:0034976" # ER-stress go3 <- "GO:0042063" # Gliogenesis, negative filtering combined.obj <- aut.res.clustering(obj = combined.obj) granule.res.4.gruffi <- combined.obj@misc$gruffi$'optimal.granule.res' combined.obj <- reassign.small.clusters(combined.obj, ident = granule.res.4.gruffi) granule.res.4.gruffi <- paste0(granule.res.4.gruffi, '.reassigned') combined.obj <- GO_score_evaluation(obj = combined.obj, GO_term = go1, save.UMAP = TRUE, new_GO_term_computation = T, clustering = granule.res.4.gruffi, plot.each.gene = F)

At this point, I get an error message: Error in Idents<-: ! 'value' must be a factor or vector Run rlang::last_trace() to see where the error occurred.

As suggested, I run the code to see the error:

rlang::last_trace() <error/rlang_error> Error in Idents<-: ! 'value' must be a factor or vector

Backtrace: ▆

  1. └─gruffi::GO_score_evaluation(...)
  2. ├─Seurat::Idents<-(*tmp*, value = obj@meta.data[clustering])
  3. └─SeuratObject:::Idents<-.Seurat(*tmp*, value = obj@meta.data[clustering]) Run rlang::last_trace(drop = FALSE) to see 1 hidden frame.

As suggested, I run the code to see the error:

rlang::last_trace(drop = FALSE) <error/rlang_error> Error in Idents<-: ! 'value' must be a factor or vector

Backtrace: ▆

  1. └─gruffi::GO_score_evaluation(...)
  2. ├─Seurat::Idents<-(*tmp*, value = obj@meta.data[clustering])
  3. └─SeuratObject:::Idents<-.Seurat(*tmp*, value = obj@meta.data[clustering])
  4. └─rlang::abort(message = "'value' must be a factor or vector")

I do not know how to fix the issue. Thank you in advance. Ivan

Additional information: The following are the open packages and I am using a saved session in which I created the Seurat object library(pdist) library(raster) library(DOSE) library(org.Hs.eg.db) library(sparseMatrixStats) library(biomaRt) library(Stringendo) library(CodeAndRoll2) library(ReadWriter) library(MarkdownHelpers) library(MarkdownReports) library(ggExpress) library(Seurat.utils) library(gruffi)

lindaboshans commented 1 year ago

I also have this issue. Please advise on how to proceed? I'm unable to run gruffi because of this error

jn-goe commented 1 year ago

Hi, thanks for the issue and the details on the error message.

The error was likely caused by a change in the Seurat::Idents() function and is now fixed in the latest gruffi update. Please reinstall gruffi and let me know if the updated version works for you:

devtools::install_github(repo = "jn-goe/gruffi", force = TRUE)

Best, Julia

lindaboshans commented 1 year ago

Thank you Julia, the issue has been fixed!