library(Seurat)
Men <- readRDS('Men.rds')
chr_deg <- read.csv('chr_DEGs.csv')
exprs <- data.frame(FetchData(object = Men, vars = chr_deg))
exprs <- t(exprs) #行列变换
write.csv(exprs,file = 'chr_DEGs_exprs.csv')
FetchData: Access cellular data in SeuratObject: Data Structures for Single Cell Data (rdrr.io)