saeyslab / nichenetr

NicheNet: predict active ligand-target links between interacting cells
483 stars 118 forks source link

Error in DE analysis for each sender cell type #85

Closed geekbio closed 3 years ago

geekbio commented 3 years ago

Hi Developer,

            Nichenetr is a interesting tool and I am using it to explore the my data. I got an error during the DE analysis, the following are my script and error

DE_table_all = Idents(ALL.integrated) %>% levels() %>% intersect(sender_celltypes) %>% lapply(get_lfc_celltype, seurat_obj = ALL.integrated, condition_colname = "type", condition_oi = condition_oi, condition_reference = condition_reference, expression_pct = 0.10) %>% reduce(full_join) DE_table_all[is.na(DE_table_all)] = 0

Error: Cannot find 'celltype' in this Seurat object

In my seurat object no celltype column instead of the name is new.ident, so how can I specify in the script to look for new.ident rather than celltype. Please let me know. Thanks for your help.

browaeysrobin commented 3 years ago

Hi @geekbio

If you update nichenetr now, you will be able to solve your issue. You can 1) define the name of your metadata column of interest instead of "celltype' as value of the new celltype_col argument.

celltype_col = "new.ident" DE_table_all = Idents(ALL.integrated) %>% levels() %>% intersect(sender_celltypes) %>% lapply(get_lfc_celltype, seurat_obj = ALL.integrated, condition_colname = "type", condition_oi = condition_oi, condition_reference = condition_reference, celltype_col = celltype_col , expression_pct = 0.10) %>% reduce(full_join)

or 2) if your celltype identifiers are the identities of your seurat object, you can put that argument to NULL

DE_table_all = Idents(ALL.integrated) %>% levels() %>% intersect(sender_celltypes) %>% lapply(get_lfc_celltype, seurat_obj = ALL.integrated, condition_colname = "type", condition_oi = condition_oi, condition_reference = condition_reference, celltype_col = NULL, expression_pct = 0.10) %>% reduce(full_join)