图片alt

图片alt

获取feature(gene)的count值

as.data.frame(thymus.combined.filter@assays$RNA@counts[,] )[c("CD8A","CD8B"),1:3]
GetAssayData(object = thymus.combined.filter, 
             assay = "RNA", slot = "counts")[c("CD8A","CD8B"), ] 
addMeta <- function(obj,genes){
  for(gene in  genes){
    count <- GetAssayData(object = thymus.combined.filter, 
                 assay = "RNA", slot = "counts")[gene, ] 
    obj <- AddMetaData(obj,count,gene)
  }
  obj
}
test <- addMeta(thymus.combined.filter,c("CD8A","CD8B"))
test@meta.data[1:3,]