Seurat的subset,数据提取方法

Idents(scRNA) <- scRNA$Majory_type
subset(scRNA, cells = c("cell.1","cell.2","cell.3",...), invert = F) #根据cell.id提取
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[,[email protected]$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')

版权声明:
作者:Alex
链接:https://www.techfm.club/p/56134.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>