Repository navigation
Expand file tree
/
Copy pathplot_cnetplot_core.R
More file actions
39 lines (38 loc) · 1.54 KB
/
Copy pathplot_cnetplot_core.R
File metadata and controls
39 lines (38 loc) · 1.54 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
library(dplyr)
library(ggplot2)
library(clusterProfiler)
library(org.Hs.eg.db)
df <- read.csv("./data/core_final_LINCS_ad_gene_nw_modified_with_symbols.csv")
top_bottom <- c("top", "bottom")
universe_genes <- read.csv("./data/universe_genes_LINCS.csv") %>% pull(gene) %>% unique()
for (name in top_bottom){
if (name == "top"){
gene_list <- df %>%
filter(Weight == 1)%>%
pull(Target)
} else {
gene_list <- df %>%
filter(Weight == -1)%>%
pull(Target)
}
gene_list <- unique(gene_list)
enrich_results <- enrichGO(
gene = gene_list,
OrgDb = org.Hs.eg.db,
keyType = "SYMBOL",
universe = universe_genes,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff = 0.05,
qvalueCutoff = 0.05
)
df_result <- as.data.frame(enrich_results)
write.csv(df_result, file = paste0("./data/core/enr_", name, "_core.csv"), row.names = FALSE)
cnet <- cnetplot(enrich_results,
layout = 'circle',
showCategory = 10,
color_edge = "category")
title <- paste0("Gene-concept network of", name, "10 enriched BPs for core based on ORA")
cnet <- cnet + ggplot2::ggtitle(title)
ggplot2::ggsave(paste0("./img/core/cnetplot_", name, "_core.png"), cnet, width = 15, height = 15)
}