美文网首页单细胞
R package:SingleR自动注释单细胞类群

R package:SingleR自动注释单细胞类群

作者: 佳名 | 来源:发表于2020-09-25 18:14 被阅读0次
    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

    相关文章

      网友评论

        本文标题:R package:SingleR自动注释单细胞类群

        本文链接:https://www.haomeiwen.com/subject/vlczyktx.html