-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path03-gsea.Rmd
80 lines (63 loc) · 1.72 KB
/
03-gsea.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
# GSEA
This is GSEA.
## Pathways
These are GSEA pathways.
```{r, results='asis'}
global_state$data %<>%
map(~ update_list(
.,
bpn = do_gsea_pod(
.$bpn,
gmtfile = paste0("extdata/", global_state$gmt),
rankWithSignificance = TRUE,
species = NULL,
useFDR = FALSE,
)
))
global_state$data %>%
map(~ knit_child(
"Rmd/gsea_pathways.Rmd",
envir = environment(),
quiet = TRUE
)) %>%
list_c() %>%
cat(sep = "\n")
```
## Leading Edge
These are leading edge genes.
```{r, results='asis'}
global_state$data %<>%
map(~ update_list(., bpn = do_leading_pod(.$bpn)))
global_state$data %>%
map(~ knit_child(
"Rmd/gsea_le.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@gsea@sig_pos_enriched, .$bpn@gsea@sig_neg_enriched)) %>%
bind_rows(.id = "Group") %>%
select(GOID = pathway, NES, Group) %>%
mutate(GOID = str_split_i(GOID, "%", -1)) %>%
distinct(GOID, Group, .keep_all = T) %>%
pivot_wider(names_from = Group, values_from = NES)
minClusterSize = 5
maxCoreScatter = 0.33
minGap = (1 - maxCoreScatter) * 3 / 4
GSEA_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(GSEA_PAVER_result))
list(GSEA_PAVER_result, "NES") %>%
knit_child(text = readLines("Rmd/paver_report.Rmd"),
envir = environment(),
quiet = TRUE) %>%
cat(sep = "\n")
```