-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01b_plot_LR_per_disease.R
129 lines (123 loc) · 6.42 KB
/
01b_plot_LR_per_disease.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
library("EWCE")
library("biomaRt")
library("ggplot2")
library("grid")
library("dplyr")
set.seed(1234)
setwd("/Users/melis/Documents/GitHub/LR_project/")
data = read.csv("processed_data/01-clustering_genes_and_diseases/01a_LR_occurrance_across_diseases/LR_occurance_0.1.csv")
data$padj = p.adjust(data$pval, method="fdr")
data %>%
mutate(Disease = factor(Disease,rev(c("AD","ALS","EssentialTremor","FrontotemporalDementia","LBD","PD","ProgressiveSupranuclearPalsy","AnorexiaNervosa","BipolarDisorder","MajorDepressiveDisorder","NeuroticDisorder","OCD","Schizophrenia","TouretteSyndrome","UnipolarDepression","BrainAneurysm","IntracranialHemorrhage","MigraineDisorder","MigraineWithAura","MS","NarcolepsyCataplexy","Narcolepsy","PartialEpilepsy","RestlessLeg")))) %>%
ggplot() +
geom_point(aes(x = -log10(padj), y = Disease,color = Disease, size = perc.LR, alpha = padj<0.05), show.legend = TRUE)+
scale_alpha_discrete(range=c(0.4,1))+
facet_grid(rows = vars(LR))+
theme(text = element_text(size = 12))+ theme(plot.margin=grid::unit(c(0.5,0.5,0.5,0.5), "in"))+
geom_vline(xintercept=1.3010, linetype="dashed", color = "darkgray") +
xlab("-log10(p)") +
ylab("Disease") +
coord_flip() + # this is to make the graph landscape
theme_light() +
viridis::scale_fill_viridis() + ## to make the colour scheme color-blind safe, the parameter option="A" or option="B",etc will change palette
#guides(fill = guide_legend(title = "Disease")) +
theme(axis.line = element_line(colour = "black"),
axis.text = element_text(colour = "black", size = "10"),
axis.text.x = element_text(colour = "black", size = "10", angle=90, hjust=1),
axis.title = element_text(colour = "black", size = "10"),
strip.text = element_text(colour = "black", size = "10"),
legend.text = element_text(colour = "black", size = "10"),
plot.caption = element_text(colour = "black", size = "10"),
plot.title = element_text(colour = "black", size = "10"),
legend.title = element_text(colour = "black", size = "10"),
legend.position = "top",
## This is to plot the two legends in two rows
legend.box="vertical")
ggsave(
filename="plots/LR_occurance_per_disease_01.png",
plot = last_plot(),
device ="png",
scale = 1,
width = 7,
height = 8,
units = c("in"),
dpi = 300
)
#####################################
data = read.csv("processed_data/01-clustering_genes_and_diseases/01a_LR_occurrance_across_diseases/LR_occurance_0.4.csv")
data$padj = p.adjust(data$pval, method="fdr")
data %>%
mutate(Disease = factor(Disease,rev(c("AD","ALS","EssentialTremor","FrontotemporalDementia","LBD","PD","ProgressiveSupranuclearPalsy","AnorexiaNervosa","BipolarDisorder","MajorDepressiveDisorder","NeuroticDisorder","OCD","Schizophrenia","TouretteSyndrome","UnipolarDepression","BrainAneurysm","IntracranialHemorrhage","MigraineDisorder","MigraineWithAura","MS","NarcolepsyCataplexy","Narcolepsy","PartialEpilepsy","RestlessLeg")))) %>%
ggplot() +
geom_point(aes(x = -log10(padj), y = Disease,color = Disease, size = perc.LR, alpha = padj<0.05), show.legend = TRUE)+
scale_alpha_discrete(range=c(0.4,1))+
facet_grid(rows = vars(LR))+
theme(text = element_text(size = 12))+ theme(plot.margin=grid::unit(c(0.5,0.5,0.5,0.5), "in"))+
geom_vline(xintercept=1.3010, linetype="dashed", color = "darkgray") +
xlab("-log10(p)") +
ylab("Disease") +
coord_flip() + # this is to make the graph landscape
theme_light() +
viridis::scale_fill_viridis() + ## to make the colour scheme color-blind safe, the parameter option="A" or option="B",etc will change palette
#guides(fill = guide_legend(title = "Disease")) +
theme(axis.line = element_line(colour = "black"),
axis.text = element_text(colour = "black", size = "10"),
axis.text.x = element_text(colour = "black", size = "10", angle=90, hjust=1),
axis.title = element_text(colour = "black", size = "10"),
strip.text = element_text(colour = "black", size = "10"),
legend.text = element_text(colour = "black", size = "10"),
plot.caption = element_text(colour = "black", size = "10"),
plot.title = element_text(colour = "black", size = "10"),
legend.title = element_text(colour = "black", size = "10"),
legend.position = "top",
## This is to plot the two legends in two rows
legend.box="vertical")
ggsave(
filename="plots/LR_occurance_per_disease_04.png",
plot = last_plot(),
device ="png",
scale = 1,
width = 6,
height = 8,
units = c("in"),
dpi = 300
)
####################################################
data = read.csv("processed_data/01-clustering_genes_and_diseases/01a_LR_occurrance_across_diseases/LR_occurance_0.7.csv")
data$padj = p.adjust(data$pval, method="fdr")
data %>%
mutate(Disease = factor(Disease,rev(c("AD","ALS","PD","BipolarDisorder","Schizophrenia","UnipolarDepression","MigraineDisorder","PartialEpilepsy")))) %>%
ggplot() +
geom_point(aes(x = -log10(padj), y = Disease,color = Disease, size = perc.LR, alpha = padj<0.05), show.legend = TRUE)+
scale_alpha_discrete(range=c(0.4,1))+
facet_grid(rows = vars(LR))+
theme(text = element_text(size = 12))+ theme(plot.margin=grid::unit(c(0.5,0.5,0.5,0.5), "in"))+
geom_vline(xintercept=1.3010, linetype="dashed", color = "darkgray") +
xlab("-log10(p)") +
ylab("Disease") +
coord_flip() + # this is to make the graph landscape
theme_light() +
viridis::scale_fill_viridis() + ## to make the colour scheme color-blind safe, the parameter option="A" or option="B",etc will change palette
#guides(fill = guide_legend(title = "Disease")) +
theme(axis.line = element_line(colour = "black"),
axis.text = element_text(colour = "black", size = "10"),
axis.text.x = element_text(colour = "black", size = "10", angle=90, hjust=1),
axis.title = element_text(colour = "black", size = "10"),
strip.text = element_text(colour = "black", size = "10"),
legend.text = element_text(colour = "black", size = "10"),
plot.caption = element_text(colour = "black", size = "10"),
plot.title = element_text(colour = "black", size = "10"),
legend.title = element_text(colour = "black", size = "10"),
legend.position = "top",
## This is to plot the two legends in two rows
legend.box="vertical")
ggsave(
filename="plots/LR_occurance_per_disease_07.png",
plot = last_plot(),
device ="png",
scale = 1,
width = 7,
height = 6,
units = c("in"),
dpi = 300
)