美文网首页
报错: All cells have the same valu

报错: All cells have the same valu

作者: oceanandshore | 来源:发表于2023-11-20 16:33 被阅读0次

    在看指控的时候出现以下报错:

    > pcovid_sn_1<-VlnPlot(covid_sn_1, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)
    Warning message:
    In SingleExIPlot(type = type, data = data[, x, drop = FALSE], idents = idents,  :
      All cells have the same value of percent.mt.
    

    搜到两篇解决的:Seurat 计算线粒体基因比例时,基因非MT-开头 - 简书 (jianshu.com)

    单细胞测序分析R包Seurat质量控制小提琴图QC VlnPlot --关于MT的问题 - 简书 (jianshu.com)

    Seurat可以利用PercentageFeatureSet计算线粒体基因比例并添加到meta.data,但是我们在使用

    sce[["percent.mt"]] = PercentageFeatureSet(sce, pattern = "^MT-")

    计算线粒体比例时,会遇到结果为0的情况。

    其可能是由于比对时使用的gtf文件线粒体基因为非MT-开头。

    image image

    那么,如何在seurat_object添加线粒体比例呢?

    方案一:

    #这里线粒体基因的名字可以查看你用的gtf文件里是哪些
    
    MT <- c("COX1","COX2","COX3","ND1","ND2","ND3","ND4L","ND4","ND5","ND6","CYTB","ATP6","ATP8")
    
    ##table(grepl("^MT-",rownames(sce)))
    
    #根据PercentageFeatureSet的function()源码做了修改
    
    sce[["percent.mt"]]  = colSums(x = GetAssayData(object = sce,
     assay = "RNA", slot = "counts")[MT, , drop = FALSE])/sce[[paste0("nCount_","RNA")]] * 100
    

    方案二:

    在cellranger制备参考基因组前,把gtf文件里的线粒体基因添加“MT-”前缀。

    作者:zhangsiyu
    链接:https://www.jianshu.com/p/953692edb712
    来源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

    相关文章

      网友评论

          本文标题:报错: All cells have the same valu

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