cobriniklab / seuratTools

https://cobriniklab.github.io/seuratTools/
Other
4 stars 1 forks source link

Error in `seu[["gene"]]`: #2

Open jiansongatnih opened 3 months ago

jiansongatnih commented 3 months ago

Hi, I wanted to convert a Seurat object built using mouse scRNA data to a new Seurat object with human orthologs. I would like to perform CellphoneDB analysis on the mouse data, but CellPhoneDB requires Human gene symbols (human orthologs). The seurat object for mouse has 'features', not 'gene', so I got the following error:

CODE: WT_human_colon <- convert_mouse_seu_to_human(WT_mouse_colon)

ERROR: Error in seu[["gene"]]: ! ‘gene’ not found in this Seurat object

Backtrace:

  1. seuratTools::convert_mouse_seu_to_human(WT_mouse_colon)
  2. SeuratObject:::[[.Seurat(seu, "gene")

Thanks for your help!

whtns commented 3 months ago

Hi, Unfortunately this package has ended up largely being for our own internal use. Supporting conversion of symbols between species is not a priority at the moment. The error relates to an out-of-date format for handling seurat assays. You might be able to get what you need by replacing seu[["gene"]] with seu

AmyOlex commented 1 month ago

Hello @jiansongatnih, I recently ran into the same issue trying to use CellPhoneDB as well. Extract the code for the function convert_mouse_seu_to_human() from this package, rename it, and put it at the top of your R script. Then change the seu[["gene"]] to seu[["RNA"]] everywhere in the function and then it works fine. Note you still need to load this library though because it uses another function from this package and loads the table named "human_to_mouse_homologs" for the conversion. Hope this helps!