首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >R语言进行生信分析,GO分析goplot()反复报错?

R语言进行生信分析,GO分析goplot()反复报错?

提问于 2024-10-19 18:31:57
回答 0关注 0查看 88

**R语言生信GO分析报错**

在进行生信分析中的Go分析时,按照教程运行脚本06中goplot(ego_BP)画有向无环图时,如下为视频教程截图

自己运行时反复报错

请教多方无果,网上查找资料仍无果,恳求指点。原脚本运行包俯下。本人使用R版本为4.4.1

代码语言:txt
复制
rm(list = ls())  
load(file = 'step4output.Rdata')
library(clusterProfiler)
library(ggthemes)
library(org.Hs.eg.db)
library(dplyr)
library(ggplot2)
library(stringr)
library(enrichplot)


# 1.GO 富集分析----(用差异基因做富集分析)

#(1)输入数据:上调和下调基因的ENTREZID
gene_up = deg$ENTREZID[deg$change == 'up'] 
gene_down = deg$ENTREZID[deg$change == 'down'] 
gene_diff = c(gene_up,gene_down)

#(2)富集——运用函数enrichGO()
#以下步骤耗时很长,设置了存在即跳过
f = paste0(gse_number,"_GO.Rdata")
if(!file.exists(f)){
  ego <- enrichGO(gene = gene_diff,
                  OrgDb= org.Hs.eg.db,#分析基因的类别:人类?鼠?
                  ont = "ALL",
                  readable = TRUE)#"readable"让基因名称变得可读
  ego_BP <- enrichGO(gene = gene_diff,
                  OrgDb= org.Hs.eg.db, 
                  ont = "BP",
                  readable = TRUE)
  #ont参数:One of "BP"(生物学过程), "MF"(分子功能), and "CC"(细胞组件) subontologies, or "ALL" for all three.
  save(ego,ego_BP,file = f)
}
load(f)

#(3)可视化
#条形图
barplot(ego)
    #分面条形图
barplot(ego, split = "ONTOLOGY", font.size = 10, 
        showCategory = 5) + 
  facet_grid(ONTOLOGY ~ ., space = "free_y",scales = "free_y") 

#气泡图
dotplot(ego)
    #分面气泡图
dotplot(ego, split = "ONTOLOGY", font.size = 10, 
        showCategory = 5) + 
  facet_grid(ONTOLOGY ~ ., space = "free_y",scales = "free_y") 

#(3)展示top通路的共同基因(即P值比较小的基因),要放大看。

#gl 用于设置下图的颜色
gl = deg$logFC
names(gl)=deg$ENTREZID
#Gene-Concept Network,要放大看
cnetplot(ego,
         #layout = "star",
         color.params = list(foldChange = gl),
         showCategory = 3)
goplot(ego_BP)

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档