satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.3k stars 918 forks source link

Error in .subscript.2ary(x, i, j, drop = drop): subscript out of bounds #9492

Open zhouliping718828 opened 4 days ago

zhouliping718828 commented 4 days ago

mCT.keggCompare <- lapply(c('Epithelial', 'Neutrophil', 'Myeloid', 'NK', 'T', 'B', 'Fibroblast'), function(x){ select <- at.meta%>% subset(mCT == x) Idents(select) <- factor(select$group, levels = c('old', 'young'))

                 result <- FindAllMarkers(select, assay = "RNA", slot = "counts",
                                          min.pct = 0, min.cells.group = 0, 
                                          logfc.threshold = 0, return.thresh = Inf, test.use = "wilcox")
                 result <- result %>% subset(cluster == "old") %>% 
                           # subset(p_val<0.05 & p_val_adj<0.25 & avg_log2FC>0.25) %>% 
                           .[order(-.$avg_log2FC),] %>%
                           transform(mCT = x) %>% 
                           dplyr::rename(c('kegg' = 'gene'))
                 return(result)
               })

I allow this code to analyze my seurat object, the error is as follows, “ Error in .subscript.2ary(x, i, j, drop = drop): subscript out of bounds”please help me analyze the possible reasons