-
Notifications
You must be signed in to change notification settings - Fork 7
/
01_quick_start.Rmd
216 lines (164 loc) Β· 5.74 KB
/
01_quick_start.Rmd
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# Quick start {#quick-start}
```{r include=FALSE}
library(knitr)
opts_chunk$set(message = FALSE, warning = FALSE, eval = TRUE, echo = TRUE, cache = TRUE)
library(genekitr)
library(dplyr)
library(DT)
```
> This part helps users quickly go through function usage. Click each title to view more details.
## [Search gene metadata](#search-gene-metadata-1)
```{r eval=FALSE}
id <- c("MCM10", "CDC20", "S100A9", "MMP1", "BCC7","FAKEID","HBD", "NUDT10")
info <- genInfo(id, org = "hs")
# keep unique records
info2 <- genInfo(id, org = "hs", unique = TRUE)
```
## [Search PubMed records](#search-pubmed-1)
```{r eval=FALSE}
## check package version
packageVersion("genekitr")
## for version < 0.8.6
term <- c("Tp53", "Brca1", "Tet2")
keys <- c("stem cell", "mouse")
l <- getPubmed(term, keys)
## for version > 0.8.6
term <- c("Tp53", "Brca1", "Tet2")
add_term <- c("stem cell", "mouse")
l <- getPubmed(term, add_term, num = 30)
# set "num" larger to get all records
all <- getPubmed(term, add_term, num = 666666)
```
## [Gene ID conversion](#gene-id-conversion-1)
```{r eval=FALSE}
id <- c("Cyp2c23", "Fhit", "Gal3st2b", "Trp53", "Tp53")
sym2ens <- transId(id ,transTo = "ensembl", org = "mouse")
# keep unique records
sym2ensent <- transId(id ,transTo = c("ensembl","entrez"), org = "mouse", unique = TRUE)
```
## [Protein ID conversion](#protein-id-conversion-1)
```{r eval=FALSE}
id <- c("P27364", "P14046", "P15650", "P16638", "P24483")
protein2sym <- transId(id ,transTo = "sym", org = "rat")
```
## [Probe ID conversion](#probe-id-conversion-1)
```{r eval=FALSE}
id <- c('205647_at','204857_at','201394_s_at','210377_at')
probe2sym <- transProbe(id, transTo = 'sym',org = 'hs')
```
> To faciliate gene enrichment analysis, I developed `r CRANpkg("geneset")`
## [Get gene sets](#get-gene-sets-1)
```{r eval=FALSE}
# install.packages("geneset")
library(geneset)
gs <- getGO(org = "human",ont = "mf")
gs <- getKEGG(org = "hsa",category = "pathway")
gs <- getMesh(org = "human", method = "gendoo", category = "A")
gs <- getMsigdb(org = "human", category = "H")
gs <- getWiki(org = "human")
gs <- getReactome(org = "human")
gs <- getEnrichrdb(org = "human", library = "COVID-19_Related_Gene_Sets")
gs <- getHgDisease(source = "do")
```
## [ORA analysis (over-representation analysis)](#ora-analysis-1)
```{r eval=FALSE}
# 1st step: get input IDs
id <- c("TP53","BRCA1", "PD1", "PDL1")
# 2nd step: get gene set
gs <- geneset::getGO(org = "human",ont = "mf")
# 3rd: analysis
ego <- genORA(id,
geneset = gs,
p_cutoff = 0.05,
q_cutoff = 0.05
)
```
## [FCS GSEA analysis](#functional-class-scoring-1)
> FCS stands for "functional-class-scoring".
`geneList` is an order ranked gene list in decreasing order. Input IDs can be Entrez, Ensembl, symbol or UniProt IDs.
```{r eval=FALSE}
# 1st step: get pre-ranked gene list
data(geneList, package = "genekitr")
# 2nd step: get gene set
gs <- geneset::getGO(org = "human",ont = "mf")
# 3rd: analysis
gse <- genGSEA(genelist = geneList,
geneset = gs,
p_cutoff = 0.05,
q_cutoff = 0.05)
```
## [Import external data](#import-external-data-1)
### Import Panther of GeneOntology website
```{r eval=FALSE}
# here we save panther result as "analysis.txt"
panther_res <- importPanther("analysis.txt")
```
### Import clusterProfiler result
```{r eval=FALSE}
library(clusterProfiler)
library(org.Hs.eg.db)
data(geneList, package="DOSE")
gene <- names(geneList)[abs(geneList) > 2]
## GO result from clusterProfiler
go <- enrichGO(gene = gene,
OrgDb = org.Hs.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff = 0.01,
qvalueCutoff = 0.05)
## GSEA result from clusterProfiler
kk <- gseKEGG(geneList = geneList,
organism = 'hsa',
minGSSize = 120,
pvalueCutoff = 0.05,
verbose = FALSE)
## Other ORA result from clusterProfiler
# (e.g. KEGG/DOSE/WikiPathways...)
do <- enrichDO(gene = gene,
ont = "DO",
pvalueCutoff = 0.05,
pAdjustMethod = "BH",
universe = names(geneList),
minGSSize = 5,
maxGSSize = 500,
qvalueCutoff = 0.05)
## Import
go_easy <- importCP(go, type = "go")
kk_easy <- importCP(kk,type = 'gsea')
do_easy <- importCP(do,type = 'other')
```
## [Plot ORA](#plot-ora-1)
Supported types include: `bar`, `wego`, `bubble`, `dot`, `lollipop`, `geneheat`, `genechord`,
`network`, `gomap`, `goheat`, `gotangram`, `wordcloud`, `upset` and `two-group barplot`
```{r eval=FALSE}
plotEnrich(ego, plot_type = "dot")
plotEnrich(keg, plot_type = "bar")
plotEnrich(ego, plot_type = "geneheat")
plotEnrich(ego, plot_type = "network", scale_ratio = 0.5)
```
## [Plot GSEA](#plot-gsea-1)
Supported types include: `volcano`, `classic`, `fgsea`, `ridge` and `bar`
```{r eval=FALSE}
plotGSEA(gse, plot_type = "volcano", show_pathway = 3)
genes <- c("MET", "TP53", "PMM2")
plotGSEA(gse, plot_type = "classic", show_pathway = pathways, show_gene = genes)
plotGSEA(gse, plot_type = "fgsea", show_pathway = 3)
```
## [Plot Venn](#plot-others-1)
```{r eval=FALSE}
set1 <- paste0(rep("gene", 100), sample(1:1000, 100))
set2 <- paste0(rep("gene", 100), sample(1:1000, 100))
set3 <- paste0(rep("gene", 100), sample(1:1000, 100))
# classic venn plot
plotVenn(list(gset1 = set1, gset2 = set2, gset3 = set3), use_venn = TRUE)
# UpSet plot
plotVenn(list(gset1 = set1, gset2 = set2, gset3 = set3), use_venn = FALSE)
```
## [Plot DEG Volcano](#plot-others-1)
```{r eval=FALSE}
data(deg, package = "genekitr")
plotVolcano(deg, "p.adjust",
remove_legend = T,
show_gene = c("CD36", "DUSP6", "IER3", "CDH7")
)
```