-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkegg_pathway_enrichment.Rmd
More file actions
executable file
·116 lines (89 loc) · 2.45 KB
/
kegg_pathway_enrichment.Rmd
File metadata and controls
executable file
·116 lines (89 loc) · 2.45 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
title: "KEGG pathway enrichment"
author:
- name: Xiaotao Shen PhD (https://www.shenxt.info/)
date: "Created on 2020-03-28 and updated on `r Sys.Date()`"
output:
html_document:
df_print: paged
toc: no
pdf_document:
toc: no
vignette: >
%\VignetteIndexEntry{KEGG pathway enrichment}
%\VignettePackage{metpath}
%\VignetteEngine{knitr::rmarkdown}
%\usepackage[utf8]{inputenc}
%\VignetteEncoding{UTF-8}
---
```{r, include=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
out.width = "100%"
)
```
# **Load packages**
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
library(metpath)
library(tidyverse)
```
# **Load KEGG pathway human database**
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
data("kegg_hsa_pathway", package = "metpath")
kegg_hsa_pathway
```
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
get_pathway_class(kegg_hsa_pathway)
```
# **Pathway enrichment**
We use the demo compound list from `metpath`.
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
data("query_id_kegg", package = "metpath")
query_id_kegg
```
Remove the disease pathways:
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
#get the class of pathways
pathway_class =
metpath::pathway_class(kegg_hsa_pathway)
head(pathway_class)
remain_idx =
pathway_class %>%
unlist() %>%
stringr::str_detect("Disease") %>%
`!`() %>%
which()
remain_idx
pathway_database =
kegg_hsa_pathway[remain_idx]
pathway_database
```
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
result =
enrich_kegg(query_id = query_id_kegg,
query_type = "compound",
id_type = "KEGG",
pathway_database = pathway_database,
p_cutoff = 0.05,
p_adjust_method = "BH",
threads = 3)
```
Check the result:
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
result
```
# **Plot to show pathway enrichment**
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
enrich_bar_plot(object = result)
```
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
enrich_scatter_plot(object = result)
```
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
enrich_network(object = result)
```
# **Session information**
```{r,eval = TRUE,warning=FALSE, message=FALSE,R.options="",cache=TRUE}
sessionInfo()
```