单细胞seurat中提取细胞子集
常规的提取法
# Subset Seurat object based on identity class, also see ?SubsetData
subset(x = pbmc, idents = "B cells")
subset(x = pbmc, idents = c("CD4 T cells", "CD8 T cells"), invert = TRUE)
# Subset on the expression level of a gene/feature
subset(x = pbmc, subset = MS4A1 > 3)
# Subset on a combination of criteria
subset(x = pbmc, subset = MS4A1 > 3 & PC1 > 5)
subset(x = pbmc, subset = MS4A1 > 3, idents = "B cells")
# Subset on a value in the object meta data
subset(x = pbmc, subset = orig.ident == "Replicate1")
# Downsample the number of cells per identity class
subset(x = pbmc, downsample = 100)
如果我们从meatadata中提取好几个条件怎么办呢?
试试这个:
test.subset <- subset(x = epithelial, subset = (stim == "condition1" | stim == "another_condition"));
seurat.subset <- subset(x = epithelial, subset = (stim == "Healthy" & stim == "Others") & (another_condition == "Ambigious"))