-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviolin_plot.R
More file actions
268 lines (231 loc) · 15.9 KB
/
violin_plot.R
File metadata and controls
268 lines (231 loc) · 15.9 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#Import data
sim_1 = read.table("simulation_set_one.txt", sep='\t', header=TRUE)
sim_1_point = read.table("simulation_set_one_o.txt", sep='\t', header=TRUE)
sim_2 = read.table("simulation_set_two.txt", sep='\t', header=TRUE)
sim_2_point = read.table("simulation_set_two_o.txt", sep='\t', header=TRUE)
#sim_1$sample = as.factor(sim_1$sample)
head(sim_1)
#violin plot
library(ggplot2)
#rateAC
p <- ggplot(sim_1, aes(x=sample, y=rateAC)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_1_point$rateAC[sim_1_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_1_point$rateAC[sim_1_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_1_point$rateAC[sim_1_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_one_rateAC.pdf", plot = p, device = "pdf")
p2 <- ggplot(sim_2, aes(x=sample, y=rateAC)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_2_point$rateAC[sim_2_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_2_point$rateAC[sim_2_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_2_point$rateAC[sim_2_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_two_rateAC.pdf", plot = p2, device = "pdf")
#rateAG
p <- ggplot(sim_1, aes(x=sample, y=rateAG)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_1_point$rateAG[sim_1_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_1_point$rateAG[sim_1_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_1_point$rateAG[sim_1_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_one_rateAG.pdf", plot = p, device = "pdf")
p2 <- ggplot(sim_2, aes(x=sample, y=rateAG)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_2_point$rateAG[sim_2_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_2_point$rateAG[sim_2_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_2_point$rateAG[sim_2_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_two_rateAG.pdf", plot = p2, device = "pdf")
#rateAT
p <- ggplot(sim_1, aes(x=sample, y=rateAT)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_1_point$rateAT[sim_1_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_1_point$rateAT[sim_1_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_1_point$rateAT[sim_1_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_one_rateAT.pdf", plot = p, device = "pdf")
p2 <- ggplot(sim_2, aes(x=sample, y=rateAT)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_2_point$rateAT[sim_2_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_2_point$rateAT[sim_2_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_2_point$rateAT[sim_2_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_two_rateAT.pdf", plot = p2, device = "pdf")
#RATECG
p <- ggplot(sim_1, aes(x=sample, y=rateCG)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_1_point$rateCG[sim_1_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_1_point$rateCG[sim_1_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_1_point$rateCG[sim_1_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_one_rateCG.pdf", plot = p, device = "pdf")
p2 <- ggplot(sim_2, aes(x=sample, y=rateCG)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_2_point$rateCG[sim_2_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_2_point$rateCG[sim_2_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_2_point$rateCG[sim_2_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_two_rateCG.pdf", plot = p2, device = "pdf")
#rateGT
p <- ggplot(sim_1, aes(x=sample, y=rateGT)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_1_point$rateGT[sim_1_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_1_point$rateGT[sim_1_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_1_point$rateGT[sim_1_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_one_rateGT.pdf", plot = p, device = "pdf")
p2 <- ggplot(sim_2, aes(x=sample, y=rateGT)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_2_point$rateGT[sim_2_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_2_point$rateGT[sim_2_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_2_point$rateGT[sim_2_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_two_rateGT.pdf", plot = p2, device = "pdf")
#GAMMASHAPE
p <- ggplot(sim_1, aes(x=sample, y=gammaShape)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_1_point$gammaShape[sim_1_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_1_point$gammaShape[sim_1_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_1_point$gammaShape[sim_1_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_one_gamma.pdf", plot = p, device = "pdf")
p2 <- ggplot(sim_2, aes(x=sample, y=gammaShape)) +
geom_violin(trim=FALSE) +
geom_point(aes(x='parallel', y=sim_2_point$gammaShape[sim_2_point$sample == 'sequential'], color='sequential'), size = 2, show.legend = TRUE) +
geom_point(aes(x='parallel', y=sim_2_point$gammaShape[sim_2_point$sample == 'combined'], color = 'Combined'), size = 2, show.legend = TRUE) +
geom_hline(aes(yintercept = sim_2_point$gammaShape[sim_2_point$sample == "standard"], color = 'Standard'), linetype=2, show.legend = TRUE) +
scale_color_manual(name='sample group',
labels=c('Sequential', 'Combined', 'Standard'),
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential'='red', 'Combined'='blue', 'Standard'='black')) +
scale_linetype_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 0, 'Combined' = 0, 'Standard'=2)) +
scale_shape_manual('sample group',
breaks=c('sequential', 'Combined', 'Standard'),
values=c('sequential' = 16, 'Combined' = 16, 'Standard'= NA)) +
guides(color = guide_legend(override.aes = list(shape = c(16,16,NA)))) +
theme_bw()
ggsave("simulation_two_gamma.pdf", plot = p2, device = "pdf")