clusterProfiler包

分析

clusterprofiler简介.png
clusterProfiler-diagram.png

enrichGO.png
GO 输入数据.png
GOprofiler输出结果.png

输入数据:富集分析基因列表
输出数据:富集结果
输出结果:go.RData

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# load packages -----------------------------------------------------------

library(clusterProfiler)
library(org.Bt.eg.db)
library(readxl)

# load data ---------------------------------------------------------------

rna <- read_xlsx("gene.xlsx")
SYMBOL <- unique(rna$geneSymbol)
rna <- data.frame(SYMBOL)

# Id transition -----------------------------------------------------------

gene.list <- bitr(rna$SYMBOL,
fromType = "SYMBOL",
toType = "ENTREZID",
OrgDb = org.Bt.eg.db)
head(gene.list)


# prepare analysis --------------------------------------------------------

gene <- gene.list$ENTREZID

# GO analysis -------------------------------------------------------------

go <- enrichGO(gene = gene,
OrgDb = org.Bt.eg.db,
keyType = "ENTREZID",
ont = 'ALL',
pvalueCutoff = 0.05,
pAdjustMethod = 'BH',
qvalueCutoff = 0.05,
minGSSize = 10,
maxGSSize = 500,
readable = T,
pool = F)


# Output the result -------------------------------------------------------

write.csv(go@result, file = "go_enrichresults.csv")
save(go, file = "go.RData")

enrichKEGG.png
KEGGj结果.png

输出数据:富集结果
输出结果:kegg.RData

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# kegg analysis -----------------------------------------------------------

# 接GO富集分析的数据进行分析

kegg <- enrichKEGG(gene = gene,
organism = "bta",
pvalueCutoff = 0.05,
pAdjustMethod = "BH",
minGSSize = 10,
maxGSSize = 500,
qvalueCutoff = 0.2,
use_internal_data = F) %>%
setReadable(OrgDb = org.Hs.eg.db, keyType="ENTREZID")



# Output the KEGG result --------------------------------------------------
write.csv(kegg@result, file = "kegg_enrichresults.csv")

可视化

barplot.png

1
barplot(go, showCategory = 20, color = "pvalue")

dotplot.png

1
dotplot(go, showCategory =20, color = "pvalue")

cnetplot.png

1
cnetplot(kegg, circular = T, colorEdge = T)

heatplot.png

1
heatplot(go) #   可添加差异倍数,增加色彩

emapplot.png
goplot.png

1
emapplot(pairwise_termsim(go))

upsetplot.png

1
upsetplot(go)