BayesSpace icon indicating copy to clipboard operation
BayesSpace copied to clipboard

How to use the AddModuleScore in BayesSpace?

Open CromitDolores0808 opened this issue 2 years ago • 1 comments

Hi! I would like to use the Seurat function AddModuleScore in BayesSpace object, but it can't work, can you help me? Thank you very much! Here is my code:

top <- scran::getTopHVGs(sce, n = 2000) hvgs <- top[grep("^RP[LS]", top, invert=TRUE)]

sce.enhanced <- enhanceFeatures(sce.enhanced, sce, model="xgboost", feature_names=hvgs, nrounds=0) Epi_ini <- Seurat::CreateSeuratObject(counts=logcounts(sce.enhanced), assay='Spatial', meta.data=as.data.frame(colData(sce.enhanced))) Epi_ini <- Seurat::SetIdent(Epi_ini, value = "spatial.cluster")

markers <- list() markers[["NEU"]] <- c("S100A4","S100A9","MMP9","FCGR3A","FCGR3B","ITGAM","ITGAX","CD14","CEACAM8","MME","CCL3","CXCR1","CXCR2","CXCR4","SELL","IFIT1","RSAD2","CD177","CD274","CD83","CSF3R","CSF1R","KIT","ARG1","TNF")

Epi_ini<- Seurat::AddModuleScore(object=Epi_ini,features=markers[["NEU"]],name = "NEU")

Error in sample.int(length(x), size, replace, prob) : 'replace = FALSE', can't take a sample larger than the population

CromitDolores0808 avatar Jan 29 '22 15:01 CromitDolores0808

Hi, I'm not too familiar with Seurat. I think it might be best if you ask the Seurat package maintainers first. If they aren't able to help, I can look into it more.

edward130603 avatar Feb 01 '22 18:02 edward130603