BiocManager::install("SingleR")
BiocManager::install("celldex")
library(SingleR)
library(celldex)
?SingleR
?MouseRNAseqData()
ref.se=MouseRNAseqData()
ref.se
pred = SingleR(test = pbmc@assays$RNA@data, ref = ref.se,
labels = ref.se$label.fine, method = "cluster",
clusters = pbmc@active.ident,
assay.type.test = "logcounts", assay.type.ref = "logcounts")
table(pred$labels)
celltype = data.frame(ClusterID=rownames(pred),
celltype=pred$labels, stringsAsFactors = F)
pbmc@meta.data$singleR=celltype[match(pbmc@active.ident,celltype$ClusterID),'celltype']
DimPlot(pbmc, reduction = "tsne", group.by = "singleR")
SingleR.png
网友评论