2022-03-20 GSEA 分析(一)

GSEA分析
根据测序公司返回来的分析数据,打开包含所有基因的数据的excel表


image.png

image.png

在excel 表中先进行部分操作

  1. 去除不含EntrezID的行,通过筛选去掉空的列
  2. 只保留gene_name, EntrezID 列以及log2(fc)列,其余列数去除
  3. 根据log2(fc)从大到小进行排列


    image.png

2. 转到R

setwd("I:/trit1/T202111_8dpf_and_16dpf/revised 更换了个野生型16d/Summary/coverage_gene")
library(stringr) 
library(clusterProfiler) 
library(org.Hs.eg.db)
library(ggridges)

T16<-read.csv("test1.csv") ## 读入之前保存的数据
head(T16)
dim(T16)
image.png
gene_fc=T16[,3]
head(gene_fc)
names(gene_fc)<-T16$EntrezID

gene_fc_sort<-sort(gene_fc,decreasing = TRUE)
head(gene_fc)
image.png
go_result <- gseGO(geneList = gene_fc, ont = "BP", OrgDb = org.Dr.eg.db,keyType = "ENTREZID",pvalueCutoff = 0.05, pAdjustMethod = "BH")#p值校正方法
head(go_result)

kegg_result <- gseKEGG(
  geneList = gene_fc,
  organism = "dre",
  keyType = "kegg",
  exponent = 1,
  minGSSize = 10,
  maxGSSize = 500,
  eps = 1e-10,
  pvalueCutoff = 0.05,
  pAdjustMethod = "BH",
  verbose = TRUE,
  use_internal_data = FALSE,
  seed = FALSE,
  by = "fgsea")
head(kegg_result)
head(go_result)
image.png

image.png

做图

library(enrichplot)

gseaplot2(
  go_result, #gseaResult object,即GSEA结果
  "GO:0007059",#富集的ID编号
  #标题
  color = "green",#GSEA线条颜色
  base_size = 11,#基础字体大小
  rel_heights = c(1.5, 0.5, 1),#副图的相对高度
  subplots = 1:3, #要显示哪些副图 如subplots=c(1,3) #只要第一和第三个图,subplots=1#只要第一个图
  pvalue_table = FALSE, #是否添加 pvalue table
  ES_geom = "line") #running enrichment score用先还是用点ES_geom = "dot"



gseaplot2(
  kegg_result, #gseaResult object,即GSEA结果
  "dre04744",#富集的ID编号
  #标题
  color = "green",#GSEA线条颜色
  base_size = 11,#基础字体大小
  rel_heights = c(1.5, 0.5, 1),#副图的相对高度
  subplots = 1:3, #要显示哪些副图 如subplots=c(1,3) #只要第一和第三个图,subplots=1#只要第一个图
  pvalue_table = FALSE, #是否添加 pvalue table
  ES_geom = "line") #running enrichment score用先还是用点ES_geom = "dot"

ridgeplot(go_result)
ridgeplot(kegg_result)
image.png

image.png
image.png

image.png
paths<-c("GO:0007601","GO:0000070")

gseaplot2(
  go_result, #gseaResult object,即GSEA结果
  paths,#富集的ID编号
  #标题
  color = "green",#GSEA线条颜色
  base_size = 11,#基础字体大小
  rel_heights = c(1.5, 0.5, 1),#副图的相对高度
  subplots = 1:3, #要显示哪些副图 如subplots=c(1,3) #只要第一和第三个图,subplots=1#只要第一个图
  pvalue_table = FALSE, #是否添加 pvalue table
  ES_geom = "line") #running enrichment score用先还是用点ES_geom = "dot"
image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容