Skip to content

Commit e42feaa

Browse files
author
William Ryan
committed
Update network plotting code
1 parent 66ea57b commit e42feaa

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

data.qmd

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ get_chea3_enrichment <- function(genes, query_name = "myQuery", url = "https://m
256256
#Predict transcription factors involved in all the data so far
257257
chea3_results <- get_chea3_enrichment(data %>% map(pull, name) %>% unlist) %>%
258258
percentile_rank(`TF`, `Rank`, desc = TRUE) %>%
259-
top_hits(prec_cutoff = -0.1, omic_type = "TF")
259+
top_hits(prec_cutoff = .9, omic_type = "TF") #Currently, select the top 10%
260260
261261
# CHEA3 always returns human symbols, lets convert back.
262262
if(params$species != "human") {
@@ -294,15 +294,15 @@ ppi <- bind_rows(string_ppi, phuego_ppi) %>%
294294
summarise(cost = mean(cost)) %>%
295295
ungroup()
296296
297-
kinograte_res <- quiet(kinograte(combined_df# %>% slice_sample(n=1000)
297+
kinograte_res <- quiet(kinograte(combined_df %>% slice_sample(n=250)
298298
, ppi_network = ppi, cluster = F, seed = 123, mu=1e-4))
299299
```
300300

301301
```{r}
302302
#| label: "data_visualizations"
303303
make_table(combined_df)
304304
305-
score_plot <- function(df, prec_cutoff = 0.8, title = "Prize Plot", subtitle = "", interactive = T) {
305+
score_plot <- function(df, title = "Prize Plot", subtitle = "", interactive = T) {
306306
307307
df %>%
308308
dplyr::mutate_if(is.numeric, round, 3) -> df
@@ -314,7 +314,6 @@ score_plot <- function(df, prec_cutoff = 0.8, title = "Prize Plot", subtitle = "
314314
echarts4r::e_visual_map(score) %>%
315315
echarts4r::e_x_axis(axisLabel = list(show = F)) %>%
316316
echarts4r::e_y_axis(name = "Normalized Prize", nameLocation = "center", nameGap = 40, nameTextStyle = list()) %>%
317-
#echarts4r::e_mark_line(data = list(yAxis = prec_cutoff), title = "Score Cutoff", symbolSize = F, silent = T) %>%
318317
echarts4r::e_tooltip(trigger = "axis") %>%
319318
echarts4r::e_title(title, subtext = subtitle)
320319
}

networks.qmd

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: last-modified
55
date-format: "[Last Updated on] MMMM DD, YYYY"
66
---
77

8-
These are your pathways.
8+
These are your networks.
99

1010
```{r}
1111
#| label: "networks_common"
@@ -31,15 +31,14 @@ generate_subnetwork <- function(kinograte_res, genes) {
3131
Kinase = as.numeric(str_detect(type.y, "Kinase")),
3232
Hidden = as.numeric(str_detect(type.y, "Hidden")),
3333
Protein = as.numeric(str_detect(type.y, "Protein")),
34-
Special = sample(c(TRUE, FALSE), nrow(.), replace = TRUE))
34+
Peptide = as.numeric(str_detect(type.y, "Peptide")),
35+
TF = as.numeric(str_detect(type.y, "TF")))
3536
3637
plot = plot_data %>%
3738
ggplot(aes(x = x, y = y, xend = xend, yend = yend)) +
3839
geom_edges(color = "grey50", curvature = 0.05) +
39-
#geom_nodes(aes(color=Special), size=11)+
40-
#geom_nodes(size=9, color = "white")+
41-
geom_scatterpie(data = plot_data %>% distinct(vertex.names, .keep_all = TRUE), cols = c("RNA", "Protein", "Kinase", "Hidden"), pie_scale = .5) +
42-
geom_nodetext_repel(aes(label = vertex.names), fontface = "bold", size = 11 / ggplot2:::.pt, box.padding = unit(.35, "lines")) +
40+
geom_scatterpie(data = plot_data %>% distinct(vertex.names, .keep_all = TRUE), cols = c("RNA", "Kinase", "Hidden", "Protein", "Peptide", "TF"), pie_scale = .5) +
41+
geom_nodetext_repel(aes(label = vertex.names), family = "Arial Narrow", fontface = "bold.italic", size = 9 / ggplot2:::.pt, box.padding = unit(.25, "lines")) +
4342
coord_equal() +
4443
theme_blank() +
4544
theme(legend.position = "none")
@@ -50,7 +49,7 @@ generate_subnetwork <- function(kinograte_res, genes) {
5049
```
5150

5251
```{r}
53-
genes_input <- gsea_pathways[831, ]$leadingEdge %>% unlist()
52+
genes_input <- names(combined) %>% sample(100)
5453
5554
plot <- generate_subnetwork(kinograte_res, genes_input)
5655

0 commit comments

Comments
 (0)