美文网首页
unable to find an inherited meth

unable to find an inherited meth

作者: scdzzdw | 来源:发表于2023-03-23 12:32 被阅读0次

进行GO和KEGG富集后,想使用dotplot进行可视化,代码如下:

goEnrichment <- function(x, pvalueCutoff = 0.05, pAdjustMethod = "BH"){
                          en <- enricher(gene=x,
                                          pvalueCutoff = pvalueCutoff,
                                          pAdjustMethod = pAdjustMethod,
                                          qvalueCutoff = 0.1,
                                          TERM2GENE = term2gene,
                                          TERM2NAME = go2term)
                          res <- en@result
                          res <- merge(res, go2ont, by.x="ID", by.y="go_id", all.x=T)
                          res <- res[order(res[,"p.adjust"]),]
                          return(na.omit(res))
}

GO_A9_12_up <- goEnrichment(A9_12_up)

dotplot(GO_A9_12_up)

报错

> dotplot(GO_A9_12_up)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘dotplot’ for signature ‘"data.frame"’

原因在于富集后的对象为enrichResult,而在函数中,我将输出对象转换为了data.frame
如果使用dotplot(en)则正确,或者重新创建enrichResult对象

y <- new("enrichResult",
      result=GO_A9_12_up)

dotplot(y)

即可正常出图


image.png

参考:https://cloud.tencent.com/developer/article/1553920

相关文章

网友评论

      本文标题:unable to find an inherited meth

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