chuiqin / irGSEA

The integration of single cell rank-based gene set enrichment analysis
Other
106 stars 17 forks source link

An error happens when irGSEA.density.scatterplot #40

Open CatCatLiang opened 5 months ago

CatCatLiang commented 5 months ago

HI Chuiqin, I met a problem like below when I run your tutorial, could you help me debug this issue? Thanks a ton!

irGSEA.density.scatterplot(object = pbmc3k.final, method = "UCell", show.geneset = "HALLMARK-INFLAMMATORY-RESPONSE", reduction = "umap") Error in as.vector(x, "character") : cannot coerce type 'environment' to vector of type 'character'

chuiqin commented 5 months ago

The occurrence of this error is confusing, can you post your complete process, Seurat version and irGSEA version? Just like the following code:

library(Seurat)
library(SeuratData)
library(RcppML)
library(irGSEA)
data("pbmc3k.final")
pbmc3k.final <- irGSEA.score(object = pbmc3k.final, assay = "RNA", slot = "data",ncores = 1,
                             msigdb = T, species = "Homo sapiens", category = "H", geneid = "symbol",
                             method = c("AUCell", "UCell", "singscore", "ssgsea"), kcdf = 'Gaussian')

scatterplot <- irGSEA.density.scatterplot(object = pbmc3k.final,
                                          method = "UCell",
                                          show.geneset = "HALLMARK-INFLAMMATORY-RESPONSE",
                                          reduction = "umap")
scatterplot
packageVersion("Seurat")
[1] ‘5.0.1’
packageVersion("irGSEA")
[1] ‘3.2.5’

image

If your problem still cannot be solved, you are welcome to add my wechat fcq065837 for discussion.

CatCatLiang commented 5 months ago

Hi Chuiqin, Thanks for your prompt response. I copied your above codes and error is still there. I checked all functions and all of them works perfectly except this one. It is really confusing as you said.

library(Seurat) library(SeuratData) library(RcppML) library(irGSEA) data("pbmc3k.final") pbmc3k.final <- irGSEA.score(object = pbmc3k.final, assay = "RNA", slot = "data",ncores = 1, msigdb = T, species = "Homo sapiens", category = "H", geneid = "symbol", method = c("AUCell", "UCell", "singscore", "ssgsea"), kcdf = 'Gaussian') scatterplot <- irGSEA.density.scatterplot(object = pbmc3k.final, method = "UCell", show.geneset = "HALLMARK-INFLAMMATORY-RESPONSE",reduction = "umap") scatterplot Error in as.vector(x, "character") : cannot coerce type 'environment' to vector of type 'character' packageVersion("Seurat") [1] ‘5.0.2’ packageVersion("irGSEA") [1] ‘3.2.5’

chuiqin commented 5 months ago

Can you provide your version of R package Nebulosa?

chuiqin commented 5 months ago

You can also try running this code to see where the error occurs.

library(Seurat)
library(SeuratData)
library(RcppML)
library(irGSEA)
data("pbmc3k.final")
pbmc3k.final <- irGSEA.score(object = pbmc3k.final, assay = "RNA", slot = "data",ncores = 1,
                             msigdb = T, species = "Homo sapiens", category = "H", geneid = "symbol",
                             method = c("AUCell", "UCell", "singscore", "ssgsea"), kcdf = 'Gaussian')
SeuratObject::DefaultAssay(pbmc3k.final) <- "UCell"
scores.scatterplot <- Nebulosa::plot_density(pbmc3k.final, 
                                             features = "HALLMARK-INFLAMMATORY-RESPONSE", 
                                             slot = "scale.data", 
                                             reduction = "umap", 
                                             method = "wkde", 
                                             joint = T) + 
  ggplot2::ggtitle(paste0("UCell", ": ", "HALLMARK-INFLAMMATORY-RESPONSE")) + 
  ggplot2::theme(plot.title = ggplot2::element_text(size = 10, hjust = 0.5), axis.title = ggplot2::element_text(size = 10))
scores.scatterplot
xyx2001222 commented 4 months ago

@CatCatLiang @chuiqin I had that problem, too, but I worked it out. As chuiqin said, Nebulosa has a problem. I use the detach (" package: Nebulosa ", unload = TRUE), devtools: : install_github (" powellgenomicslab/Nebulosa) reinstall the package and is ready to use now.