-
Notifications
You must be signed in to change notification settings - Fork 1
/
04-enrichr.Rmd
53 lines (41 loc) · 1.45 KB
/
04-enrichr.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
# Enrichr
This is Enrichr.
## Pathways
These are Enrichr pathways.
```{r, results='asis'}
global_state$data %<>%
map( ~ update_list(., bpn = {system("sleep 3"); quiet(do_enrichr_pod(.$bpn, useFDR=FALSE))}))
global_state$data %>%
map(~ knit_child(
"Rmd/enrichr_pathways.Rmd",
envir = environment(),
quiet = TRUE
)) %>%
list_c() %>%
cat(sep = "\n")
```
## PAVER
These are PAVER plots of the pathways from all comparisons
```{r, results='asis'}
input = global_state$data %>%
map(~ bind_rows(.$bpn@enrichr@sig_up_enrichr, .$bpn@enrichr@sig_down_enrichr %>% mutate(Combined.Score = Combined.Score * -1))) %>%
bind_rows(.id = "Group") %>%
select(GOID = Term, CS = Combined.Score, Group) %>%
mutate(CS = sign(CS) * log2(abs(CS)) + 1) %>%
mutate(GOID = str_extract(GOID, "\\bGO:\\d+")) %>%
distinct(GOID, Group, .keep_all = T) %>%
pivot_wider(names_from = Group, values_from = CS)
minClusterSize = 5
maxCoreScatter = 0.33
minGap = (1 - maxCoreScatter) * 3 / 4
ENRICHR_PAVER_result <- quiet(PAVER::prepare_data(input, global_state$embeddings, global_state$term2name) %>%
PAVER::generate_themes(maxCoreScatter = maxCoreScatter,
minGap = minGap,
minClusterSize = minClusterSize))
global_state$results <- c(global_state$results, lst(ENRICHR_PAVER_result))
list(ENRICHR_PAVER_result, "logCS") %>%
knit_child(text = readLines("Rmd/paver_report.Rmd"),
envir = environment(),
quiet = TRUE) %>%
cat(sep = "\n")
```