NICHES icon indicating copy to clipboard operation
NICHES copied to clipboard

Function RunNICHES does not work for one-cell case

Open noahwang1991 opened this issue 1 year ago • 1 comments

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 

noahwang1991 avatar May 31 '24 19:05 noahwang1991

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

jcyang34 avatar Jul 17 '24 03:07 jcyang34

feel free to reopen the issue if there are additional questions

jcyang34 avatar Sep 24 '24 17:09 jcyang34