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

assign_ligands_to_celltype erroe message #303

Open
wang2034 opened this issue Sep 13, 2024 · 1 comment
Open

assign_ligands_to_celltype erroe message #303

wang2034 opened this issue Sep 13, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@wang2034
Copy link

Hi,
When I ran: igand_type_indication_df <- assign_ligands_to_celltype(seuratObj,
nichenet_output$top_ligands,
celltype_col = "cell_type2")
I got a error:

Error in h(simpleError(msg, call)) :
error in evaluating the argument 'j' in selecting a method for function '[': comparison of these types is not implemented
In addition: Warning message:
In seuratObj_subset[, seuratObj_subset[[celltype_col]] == celltype] :
Incompatible methods ("Ops.data.frame", "Ops.factor") for "=="

My Seurat object was created using Seurat V5.

@csangara
Copy link
Member

Hi,

I think this occurred because the cell type column is a factor. A workaround for now would be to create a new metadata column as a character, as follows:

seuratObj$celltype_char <- as.character(seuratObj$cell_type2)
ligand_type_indication_df <- assign_ligands_to_celltype(seuratObj,
    nichenet_output$top_ligands,
    celltype_col = "celltype_char")

I will implement a fix for this in the next patch.

@csangara csangara self-assigned this Sep 20, 2024
@csangara csangara added the bug Something isn't working label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants