rm(list = ls())
library(Seurat)
pbmc<-readRDS("pbmc3k_final.rds")
pbmc$orig.ident <- colnames(pbmc)
set.seed(111) # 让每次抽样可重复
sampled.cells <- names(sample(x = pbmc@active.ident, size = 500, replace = F)) # size选择抽取细胞数
pbmc_500 <- subset(pbmc,subset = orig.ident %in% sampled.cells )
网友评论