-
Notifications
You must be signed in to change notification settings - Fork 2
/
plot_rss_RTMs.R
76 lines (70 loc) · 3.02 KB
/
plot_rss_RTMs.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
73
74
75
76
library(dplyr)
library(ggplot2)
library(ggrepel)
library(ggpubr)
# plot rss
# APOE+ macrophage
# Figure 1i
if(T){
# load regulon
regulon = read.table("./Myeloid.rss.txt", header = T, sep = "\t")
head(regulon)
tmp = data.frame(tf = rownames(regulon), rss = regulon$APOE..macrophage) %>% arrange(desc(rss))
tmp$rank = 1:nrow(tmp)
tmp$color = 'A'
tmp[1:10,]$color = 'B'
tmp2 = tmp %>% head(10)
ggplot(tmp, aes(x = rank, y = rss, color = color)) +
geom_point(size = 0.5) +
scale_color_manual(values = c("#EE9572","#1874CD") %>% rev)+
labs(x="Rank",y="Regulon specificity score",title="APOE+ RTM") +
geom_text_repel(data = tmp2, aes(x=rank, y = rss, label=tf), max.overlaps = 20)+
theme_classic2() +
theme(
legend.position = "none",
axis.text.x = element_text(family = "ArialMT", size = 16, color = "black"),
axis.text.y = element_text(family = "ArialMT", size = 16, color = 'black'),
axis.title.y = element_text(family = "ArialMT",size = 16, color = 'black'),
axis.title.x = element_text(family = "ArialMT",size = 16, color = 'black'),
legend.text = element_text(family = "ArialMT",size = 16, color ='black'),
legend.title = element_text(family = "ArialMT",size = 16, color ='black'),
strip.text = element_text(family = "ArialMT",face = "italic", size = 16, color ='black'),
strip.background = element_blank(),
plot.title = element_text(family = "ArialMT",size = 16, color ='black', hjust = 0.5)
)
# save plot
ggsave("APOE_regulon.pdf", width = 3, height = 4.5)
}
# plot rss
# AREG+ macrophage
# Figure 1m
if(T){
# load regulon
regulon = read.table("./Myeloid.rss.txt", header = T, sep = "\t")
head(regulon)
tmp = data.frame(tf = rownames(regulon), rss = regulon$AREG..macrophage) %>% arrange(desc(rss))
tmp$rank = 1:nrow(tmp)
tmp$color = 'A'
tmp[1:10,]$color = 'B'
tmp2 = tmp %>% head(10)
ggplot(tmp, aes(x = rank, y = rss, color = color)) +
geom_point(size = 0.5) +
scale_color_manual(values = c("#EE9572","#1874CD") %>% rev)+
labs(x="Rank",y="Regulon specificity score",title="APOE+ RTM") +
geom_text_repel(data = tmp2, aes(x=rank, y = rss, label=tf), max.overlaps = 20)+
theme_classic2() +
theme(
legend.position = "none",
axis.text.x = element_text(family = "ArialMT", size = 16, color = "black"),
axis.text.y = element_text(family = "ArialMT", size = 16, color = 'black'),
axis.title.y = element_text(family = "ArialMT",size = 16, color = 'black'),
axis.title.x = element_text(family = "ArialMT",size = 16, color = 'black'),
legend.text = element_text(family = "ArialMT",size = 16, color ='black'),
legend.title = element_text(family = "ArialMT",size = 16, color ='black'),
strip.text = element_text(family = "ArialMT",face = "italic", size = 16, color ='black'),
strip.background = element_blank(),
plot.title = element_text(family = "ArialMT",size = 16, color ='black', hjust = 0.5)
)
# save plot
ggsave("AREG_regulon.pdf", width = 3, height = 4.5)
}