当前位置: 首页 > 工具软件 > Subset > 使用案例 >

Seurat的subset,数据提取方法 提取子集 按条件要求

陈高寒
2023-12-01
Seurat的subset,数据提取方法
Idents(scRNA) <- scRNA$Majory_type
subset(x = scRNA, idents = c("CD4 T cells", "CD8 T cells"))
subset(x = scRNA, subset = nFeatures > 500 & PC1 > 5, idents = "B cells")
subset(x = scRNA, subset = orig.ident == "Replicate1")
subset(x = scRNA, downsample = 100)
subset(x = scRNA, features = VariableFeatures(object = scRNA))
scRNA= scRNA[,scRNA@meta.data$seurat_clusters %in% c(0,2)]
scRNA= scRNA[, Idents(scRNA) %in% c( "T cell" ,  "B cell" )] 


矩阵提取
#assay数据提取
GetAssayData( scRNA, slot = "counts")
scRNA<- SetAssayData(scRNA, slot = "scale.data", new.data = new.data)
#embeddings 数据提取
Embeddings(object = scRNA, reduction = "pca")
# FetchData can pull anything from expression matrices, cell embeddings, or metadata
FetchData(object = scRNA, vars = c("PC_1", "percent.mito"))
exprs <- data.frame(FetchData(object = scRNA, vars =  VariableFeatures(object = scRNA)))
exprs <- t(exprs)  #行列变换
write.csv(exprs,file = 'exprs.csv')

 类似资料: