-
Notifications
You must be signed in to change notification settings - Fork 0
/
figure1.R
49 lines (42 loc) · 1.51 KB
/
figure1.R
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
library(tidyverse)
generate_figure <- function(gene, cell_lines, section = "inflammation") {
selected <- cell_lines
prefix <- "results/"
file <- paste(gene, "csv", sep = ".")
df <- read_csv(paste(prefix, file, sep = "/")) %>%
filter(cellline %in% selected)
p <- ggplot(df,
aes(x = perturbagen,
y = similarity,
group = cellline,
color = cellline,
shape = cellline,
label = similarity)
)
bp <- p + geom_point() + geom_line() +
scale_x_discrete(limits = c("Bupropion", "Chloroquine", "Carbetocin")) +
xlab("Medication") +
ylab(paste("Similarity Score relative to", gene, "Knockout")) +
scale_color_discrete(name = "Cell Line") +
scale_shape_manual(
name = element_blank(),
values = c(16, 16)
) +
geom_label(hjust = -0.5, vjust = 0) +
guides(size=FALSE,
color = FALSE,
shape = FALSE
)
bp
figure_file <- paste(paste(section, "comparison", gene, sep = "-"),
c("png", "pdf"), sep = ".")
figure_prefix = "figures"
fig_path <- paste(figure_prefix, figure_file, sep = "/")
ggsave(fig_path[1], device = "png")
ggsave(fig_path[2], device = "pdf")
}
generate_figure("TNF", c("HA1E"))
generate_figure("ARG1", c("HA1E"), section = "immune")
generate_figure("CD83", c("HA1E"), section = "immune")
generate_figure("TLR7", c("HA1E"), section = "immune")
generate_figure("TLR9", c("HA1E"), section = "immune")