GSEA分析
根據(jù)測(cè)序公司返回來(lái)的分析數(shù)據(jù),打開(kāi)包含所有基因的數(shù)據(jù)的excel表

image.png

image.png
在excel 表中先進(jìn)行部分操作
- 去除不含EntrezID的行,通過(guò)篩選去掉空的列
- 只保留gene_name, EntrezID 列以及l(fā)og2(fc)列,其余列數(shù)去除
-
根據(jù)log2(fc)從大到小進(jìn)行排列
image.png
2. 轉(zhuǎn)到R
setwd("I:/trit1/T202111_8dpf_and_16dpf/revised 更換了個(gè)野生型16d/Summary/coverage_gene")
library(stringr)
library(clusterProfiler)
library(org.Hs.eg.db)
library(ggridges)
T16<-read.csv("test1.csv") ## 讀入之前保存的數(shù)據(jù)
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結(jié)果
"GO:0007059",#富集的ID編號(hào)
#標(biāo)題
color = "green",#GSEA線條顏色
base_size = 11,#基礎(chǔ)字體大小
rel_heights = c(1.5, 0.5, 1),#副圖的相對(duì)高度
subplots = 1:3, #要顯示哪些副圖 如subplots=c(1,3) #只要第一和第三個(gè)圖,subplots=1#只要第一個(gè)圖
pvalue_table = FALSE, #是否添加 pvalue table
ES_geom = "line") #running enrichment score用先還是用點(diǎn)ES_geom = "dot"
gseaplot2(
kegg_result, #gseaResult object,即GSEA結(jié)果
"dre04744",#富集的ID編號(hào)
#標(biāo)題
color = "green",#GSEA線條顏色
base_size = 11,#基礎(chǔ)字體大小
rel_heights = c(1.5, 0.5, 1),#副圖的相對(duì)高度
subplots = 1:3, #要顯示哪些副圖 如subplots=c(1,3) #只要第一和第三個(gè)圖,subplots=1#只要第一個(gè)圖
pvalue_table = FALSE, #是否添加 pvalue table
ES_geom = "line") #running enrichment score用先還是用點(diǎn)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結(jié)果
paths,#富集的ID編號(hào)
#標(biāo)題
color = "green",#GSEA線條顏色
base_size = 11,#基礎(chǔ)字體大小
rel_heights = c(1.5, 0.5, 1),#副圖的相對(duì)高度
subplots = 1:3, #要顯示哪些副圖 如subplots=c(1,3) #只要第一和第三個(gè)圖,subplots=1#只要第一個(gè)圖
pvalue_table = FALSE, #是否添加 pvalue table
ES_geom = "line") #running enrichment score用先還是用點(diǎn)ES_geom = "dot"

image.png
