-
Notifications
You must be signed in to change notification settings - Fork 0
/
figure2.R
72 lines (61 loc) · 3.64 KB
/
figure2.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
library(tidyverse)
library(RColorBrewer)
library(gplots)
library(reshape2)
# order <- rev(c("Carbetocin", "Desmopressin", "Hydroxychloroquine", "Chloroquine",
# "Bupropion", "Ritonavir", "Lopinavir", "Benazepril", "Captopril", "Enalapril",
# "Fosinopril", "Lisinopril", "Moexipril","Perindopril", "Quinapril",
# "Ramipril", "Telmisartan", "Valsartan", "Olmesartan"))
order <- rev(c("Carbetocin", "Desmopressin", "Hydroxychloroquine", "Chloroquine",
"Bupropion", "Ritonavir", "Lopinavir"))
all_averaged <- read_csv("results/all_averaged.csv")
all_averaged_cross <- all_averaged %>%
dcast(perturbagen ~ treatment, value.var = "mean_similarity") %>%
filter(perturbagen != "Desmopressin") %>%
select_if(names(.) %in% c("IL1A", "IL1B", "IL1R1", "IL1R2", "IL1RN",
"IL1RAP", "IL1RL1", "IL1RL2", "IL6", "IL6R", "IL6ST", "TNF",
"ARG1", "TLR9", "CD40", "CD46", "CTLA4",
"perturbagen")) %>%
column_to_rownames("perturbagen") %>%
as.matrix()
order <- order[order %in% rownames(all_averaged_cross)]
all_averaged_cross <- all_averaged_cross[order,]
all_averaged_cross_inf <- all_averaged %>%
dcast(perturbagen ~ treatment, value.var = "mean_similarity") %>%
filter(perturbagen != "Desmopressin") %>%
select_if(names(.) %in% c("IL1A", "IL1B", "IL1R1", "IL1R2", "IL1RN",
"IL1RAP", "IL1RL1", "IL1RL2", "IL6", "IL6R", "IL6ST", "TNF",
"AGT", "AGTR1", "perturbagen")) %>%
column_to_rownames("perturbagen") %>%
as.matrix()
all_averaged_cross_inf <- all_averaged_cross_inf[order,]
all_averaged_cross_imm <- all_averaged %>%
dcast(perturbagen ~ treatment, value.var = "mean_similarity") %>%
filter(perturbagen != "Desmopressin") %>%
select_if(names(.) %in% c("ARG1", "CD19", "TLR7", "TLR9", "CD40", "CD44", "CD46",
"AGT", "AGTR1", "CTLA4", "perturbagen")) %>%
column_to_rownames("perturbagen") %>%
as.matrix()
all_averaged_cross_imm <- all_averaged_cross_imm[order,]
colors <- colorRampPalette(rev(c("red", "black", "green")))(n=11)
png(filename = "figures/average-concordance-heatmap-inflammation.png", width = 1920, height = 1384)
heatmap.2(all_averaged_cross_inf, dendrogram = "none", col = colors, colsep = 1:5, rowsep = 1:15,
trace = "none", cexRow = 3, cexCol = 3, Rowv = FALSE, Colv = FALSE,
density.info = "none", keysize = 1, margins = c(15, 25), notecex=3.0,
main = "Average Concordance of the Perturbagens with Inflammation-driving genes",
key.title = NA, key.xlab = NA, key.par = list(cex = 1.3))
dev.off()
png(filename = "figures/average-concordance-heatmap-immune.png", width = 1920, height = 1384)
heatmap.2(all_averaged_cross_imm, dendrogram = "none", col = colors, colsep = 1:6, rowsep = 1:15,
trace = "none", cexRow = 3, cexCol = 3, Rowv = FALSE, Colv = FALSE,
density.info = "none", keysize = 1, margins = c(15, 25), notecex=3.0,
main = "Average Concordance of the Perturbagens with Immune genes",
key.title = NA, key.xlab = NA, key.par = list(cex = 1.3))
dev.off()
png(filename = "figures/average-concordance-heatmap-all.png", width = 1920, height = 1384)
heatmap.2(all_averaged_cross, dendrogram = "none", col = colors, colsep = 1:15, rowsep = 1:15,
trace = "none", cexRow = 3, cexCol = 3, Rowv = FALSE, Colv = FALSE,
density.info = "none", keysize = 1, margins = c(15, 25), notecex=1.5,
# main = "Average Concordance of the Perturbagens with all genes",
key.title = NA, key.xlab = NA, key.par = list(cex = 1.3))
dev.off()