Function RunNICHES does not work for one-cell case
I am trying to run NICHES analysis on a splitted, un-imputed data set. The data set has 6 samples (annotated by 'Condition'), and 13 cell types (annotated by 'Global_CellType_V2'). Some cell types contain few cells, and that caused the problem -- when a cell type has only 1 single cell, RunNICHES reports an error: https://github.com/satijalab/seurat/issues/8362
Error in methods::slot(object = object, name = "layers")[[layer]][features, : incorrect number of [dimensions]
Below is the code, and the cell type distribution when i=2 (where the problem occurs).
split <- SplitObject(All_Annotated_V2.imputed,split.by='Condition')
names(split)
# Cell To Cell (CTC)
scc.list <- list()
for(i in 1:length(split)){
print(i)
scc.list[[i]] <- RunNICHES(split[[i]],
LR.database="fantom5",
species="mouse",
assay="RNA",
cell_types = "Global_CellType_V2",
meta.data.to.map = names(split[[i]]@meta.data),
SystemToCell = F,
CellToCell = T,
CellToSystem=F)
}
names(scc.list) <- names(split)
table(Idents(split[[i]]))
Adipogenic_Precursor_Cells Dcn+_Fibroblasts Dkk2+_Fibroblasts Endothelial
16 1686 468 22
Epithelial Fibroblasts_Cycling IFN_Stimulated_Fibroblasts Immune
2 345 41 202
Myh11+_Fibroblasts Rspo3+_Frzb+_Fibroblasts Schwann_Cells Schwann_Cycling
1 583 1390 137
Taco1+_Fibroblasts
34
I tried to reproduce this with a simulation example using Seurat V4 and V5. Seurat V4 works fine in RunNICHES even with just one cell in one of the cell types. The problem is with the layers in Seurat V5, which is mentioned in your link and it seems not resolved yet by the Seurat team. Honestly I would proceed with min.cells.per.ident in RunNICHES set to a reasonable number, like 10, to filter out such cell types, because I don't think just 1 or 2 cells in a cell type are representative enough for that cell type. What do you think? @msraredon
feel free to reopen the issue if there are additional questions