Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in RenameGenesSeurat #78

Open
JH-42 opened this issue Jun 8, 2024 · 4 comments
Open

Error in RenameGenesSeurat #78

JH-42 opened this issue Jun 8, 2024 · 4 comments

Comments

@JH-42
Copy link

JH-42 commented Jun 8, 2024

Hi, thank you for the wonderful function!
I met the same problem as jenellewallace.

> HGNC.updated <- HGNChelper::checkGeneSymbols(rownames(Tcells), unmapped.as.na = FALSE, map = NULL, species = "human")

>  Tcells@version
[1] ‘5.0.1> Tcells<-Seurat.utils::RenameGenesSeurat(obj = Tcells,newnames = HGNC.updated$Suggested.Symbol,assay = "RNA",slots=c("data","counts"))
RenameGenesSeurat, assay: RNA
Warning in Seurat.utils::RenameGenesSeurat(obj = Tcells, newnames = HGNC.updated$Suggested.Symbol,  :
  Run this before integration and downstream processing. It only attempts to change
          @counts, @data, and @meta.features in obj@assays$YOUR_ASSAY.
[1] "Present:  counts data scale.data"
[1] "Replaced:  counts data"
[1] "counts"
counts
Error in rownames(assayobj@features@.Data) :
  no slot of name "features" for this object of class "Assay"
@vertesy
Copy link
Owner

vertesy commented Jun 14, 2024

Hey JH,

thanks and sorry for the trouble. Very busy these days, try to address it next week.

//A

@JH-42
Copy link
Author

JH-42 commented Jun 14, 2024

Thanks for your help. I solved my problem using other methods. I'm writing my solution here in case anyone needs it in the future.

library(nichenetr)
library(Seurat)
exp_mtx <- as.matrix(Tcells1@assays$RNA@data)
con_df <- data.frame(mouse = rownames(exp_mtx),
                     hum_orig = convert_mouse_to_human_symbols(rownames(exp_mtx)),
                     stringsAsFactors = F)

con_df <- con_df[!is.na(con_df$hum_orig),,F]
exp_mtx <- exp_mtx[con_df$mouse,]
rownames(exp_mtx) <- con_df$hum_orig
human_SO <- CreateSeuratObject(counts = exp_mtx, meta.data = Tcells1@meta.data )

@gabrielascui
Copy link

Hi, I'm getting the same error, is there a way to do this with generating a new matrix with the new names?

I'm using a dataset I downloaded as an .rds file from https://cellxgene.cziscience.com/datasets

tabula.sapiens.ref <- readRDS(path.ref) # single cell database for large intestine human
tabula.sapiens.ref <- UpdateSeuratObject(tabula.sapiens.ref)

tabula.sapiens.ref <- RenameGenesSeurat(tabula.sapiens.ref, newnames = as.character(tabula.sapiens.ref@[email protected]$feature_name))

I'm not sure were is the features slots being called by the function.

@vertesy
Copy link
Owner

vertesy commented Dec 19, 2024

Hi,

sorry was traveling and years end is very busy.

  • RenameGenesSeurat is designed for fresh and vanilla objects, not imported ones. It may have all kind of assays, in all kind of formats. etc.
  • In January I may have time to look into this deeper.
  • My best guess it is a Seurat object version issue.
  • Please use Seurat.utils::UpdateSeuratObjectProperly(), because SeuratObject::UpdateSeuratObject() does not do what the name suggests, and they ignored it when I raised their attention to it.
  • Not sure if it will fix it because UpdateSeuratObjectProperly is still a nascent function. Also it wont deal with any non-standard reductions, assays etc either.

hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants