kegg富集的结果默认是按照pValue值展示前几条的通路
如
#绘制前10条通路
p1 <- barplot(kk, showCategory=10)
那如何在途中展示特定的通路呢,则需要我们提前对KEGG的结果进行筛选
注:示例数据,无意义
rm(list = ls())
load( file = 'step1.Rdata' )
#2.3 pathway----
library(patchwork)
library(org.Hs.eg.db)
library(org.Mm.eg.db)
library(clusterProfiler)
library(ggplot2)
library(stringr)
target_intersect <- c(target_intersect,"LRRK1")
unique(target_intersect)#14
#2.3.1 KEGG----
gene_target_case_entr=
as.character(na.omit(AnnotationDbi::select
(org.Hs.eg.db,keys = target_intersect,
columns = 'ENTREZID',keytype = 'SYMBOL')[,2]))
kk <- enrichKEGG(gene= gene_target_case_entr,
organism = 'hsa',
#universe = gene_all,
pvalueCutoff = 1,
qvalueCutoff =1)
kk <- setReadable(kk,
OrgDb = org.Hs.eg.db,
keyType = "ENTREZID")
#绘制前10条通路
p1 <- barplot(kk, showCategory=10)
如果我们要展示特定通路,需要提前筛选,如我只关注炎症和免疫反应相关的通路(查资料且保证原始k k@result中有对应通路)。
#显示特定的通路
selected_pathways <- c(
"B cell receptor signaling pathway",
"T cell receptor signaling pathway",
"Fc epsilon RI signaling pathway",
"PD-L1 expression and PD-1 checkpoint pathway in cancer",
"Th1 and Th2 cell differentiation",
"IL-17 signaling pathway",
"Th17 cell differentiation",
"MAPK signaling pathway",
"PI3K-Akt signaling pathway",
"Ras signaling pathway"
)
kk_filtered <- kk@result %>%
filter(Description %in% selected_pathways)
## 转换为 enrichResult 对象,以便绘图
kk_filtered <- new("enrichResult", result = kk_filtered)
# 绘制条形图
p1 <- barplot(kk_filtered, showCategory = length(selected_pathways))
ggsave(plot = p1,path = "plot/",
'Kegg_plot_修.pdf',width = 9,height = 6)
write.csv(kk,file="table/kegg_result.csv",
quote = F,row.names = F)
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。