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 · 2 comments
Open

Error in RenameGenesSeurat #78

JH-42 opened this issue Jun 8, 2024 · 2 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 )

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

2 participants