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')
网友评论