-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathREADME.Rmd
182 lines (138 loc) · 5.54 KB
/
README.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
---
output: rmarkdown::github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r echo=FALSE, message=FALSE}
knitr::opts_chunk$set(message=FALSE, comment="#>")
devtools::load_all(".")
```
# hypeR
<img src="media/logo.png" height="100px" align="right"/>
![](https://github.com/montilab/hypeR/workflows/build/badge.svg)
[![](https://img.shields.io/badge/bioconductor-3.11-3a6378.svg)](https://doi.org/doi:10.18129/B9.bioc.hypeR)
[![](https://img.shields.io/badge/platforms-linux%20%7C%20osx%20%7C%20win-2a89a1.svg)](https://bioconductor.org/checkResults/3.9/bioc-LATEST/hypeR/)
[![](https://lifecycle.r-lib.org/articles/figures/lifecycle-stable.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![](https://img.shields.io/github/last-commit/montilab/hypeR.svg)](https://github.com/montilab/hypeR/commits/master)
## Documentation
Please visit <https://montilab.github.io/hypeR-docs/>
You can also try out our [web-application](https://hyper-shiny.shinyapps.io/wapp/) if you prefer an interface!
## Requirements
We recommend the latest version of R (\>= 4.0.0) but **hypeR** currently requires R (\>= 3.6.0) to be installed directly from Github or Bioconductor. To install with R (\>= 3.5.0) see below. Use with R (\< 3.5.0) is not recommended.
## Installation
Install the development version of the package from Github. <span style="color:#0278ae">**[Recommended]**</span>
``` r
devtools::install_github("montilab/hypeR")
```
Or install the development version of the package from Bioconductor.
``` r
BiocManager::install("montilab/hypeR", version="devel")
```
Or install with Conda.
```bash
conda create --name hyper
source activate hyper
conda install -c r r-devtools
R
library(devtools)
devtools::install_github("montilab/hypeR")
```
Or install with previous versions of R.
```bash
git clone https://github.com/montilab/hypeR
nano hypeR/DESCRIPTION
# Change Line 8
# Depends: R (>= 3.6.0) -> Depends: R (>= 3.5.0)
R
install.packages("path/to/hypeR", repos=NULL, type="source")
```
## Usage
```{r, eval=FALSE}
library(hypeR)
```
```{r}
data(wgcna)
# Process many signatures
signatures <- wgcna[[1]]
str(signatures)
# Access to hundreds of genesets
genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG", clean=TRUE)
print(genesets)
```
```{r, message=FALSE, warning=FALSE, results='hide'}
mhyp <- hypeR(signatures, genesets, test="hypergeometric", background=30000)
```
```{r, fig.width=8, fig.align='center'}
hyp_dots(mhyp, merge=TRUE, fdr=0.05, title="Co-expression Modules")
```
## Terminology
### Signature
__hypeR__ employs multiple types of enrichment analyses (e.g. hypergeometric, kstest, gsea). Depending on the type, different kinds of signatures are expected. There are three types of signatures `hypeR()` expects.
```{r}
# Simply a character vector of symbols (hypergeometric)
signature <- c("GENE1", "GENE2", "GENE3")
# A ranked character vector of symbols (kstest)
ranked.signature <- c("GENE2", "GENE1", "GENE3")
# A ranked named numerical vector of symbols with ranking weights (gsea)
weighted.signature <- c("GENE2"=1.22, "GENE1"=0.94, "GENE3"=0.77)
```
### Geneset
A geneset is simply a list of vectors, therefore, one can use any custom geneset in their analyses, as long as it's appropriately defined.
```{r}
genesets <- list("GSET1" = c("GENE1", "GENE2", "GENE3"),
"GSET2" = c("GENE4", "GENE5", "GENE6"),
"GSET3" = c("GENE7", "GENE8", "GENE9"))
```
#### Hyper enrichment
All workflows begin with performing hyper enrichment with `hyper()`. Often we are just interested in a single signature, as described above. In this case, `hyper()` will return a `hyp` object. This object contains relevant information to the enrichment results and is recognized by downstream methods.
```{r}
hyp_obj <- hypeR(signature, genesets)
```
#### Downstream methods
Please visit the [documentation](https://montilab.github.io/hypeR-docs/) for detailed functionality. Below is a brief list of some methods.
##### Downloading genesets
```{r, eval=FALSE}
BIOCARTA <- msigdb_gsets(species="Homo sapiens", category="C2", subcategory="CP:BIOCARTA")
KEGG <- msigdb_gsets(species="Homo sapiens", category="C2", subcategory="CP:KEGG")
REACTOME <- msigdb_gsets(species="Homo sapiens", category="C2", subcategory="CP:REACTOME")
```
##### Visualize results
```{r, eval=FALSE}
# Show interactive table
hyp_show(hyp_obj)
# Plot dots plot
hyp_dots(hyp_obj)
# Plot enrichment map
hyp_emap(hyp_obj)
# Plot hiearchy map (relational genesets)
hyp_hmap(hyp_obj)
```
##### Saving results
```{r, eval=FALSE}
# Map enrichment to an igraph object (relational genesets)
hyp_to_graph(hyp_obj)
# Save to excel
hyp_to_excel(hyp_obj, file_path="hypeR.xlsx")
# Save to table
hyp_to_table(hyp_obj, file_path="hypeR.txt")
# Generate markdown report
hyp_to_rmd(hyp_obj,
file_path="hypeR.rmd",
title="Hyper Enrichment (hypeR)",
subtitle="YAP, TNF, and TAZ Knockout Experiments",
author="Anthony Federico, Stefano Monti")
```
## Related Repositories
- [hypeR-db](https://github.com/montilab/hypeR-db)
*A repository for commonly used open source genesets used by hypeR*
- [hypeR-shiny](https://github.com/montilab/hypeR-shiny)
*Our Shiny web application built on hypeR*
- [hypeR-modules](https://github.com/montilab/hypeR-modules)
*Integration of hypeR modules in custom Shiny applications*
- [hypeR-docs](https://github.com/montilab/hypeR-docs)
*Landing site for hosting documentation for hypeR*
- [hypeR-workshop](https://github.com/montilab/hypeR-workshop)
*Materials for a hypeR tutorial workshop*
## Cite
```{r}
citation("hypeR")
```