assign_ligands_to_celltype erroe message
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.
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.
thx this helped!