-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFig2C_github.R
539 lines (436 loc) · 23.1 KB
/
Fig2C_github.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
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
##This script makes the individual gene plots for Fig. 2C.
library(extrafont)
font_import()
loadfonts()
library("gridExtra")
library("ggplot2")
library(egg)
library(grid)
library("cowplot")
setwd("/Volumes/GoogleDrive/My Drive/Primates_Coculture/Primates/MyAnalysis_v02/Results_2019-01-30/SavedModels")
res_hc <- readRDS("res_hc.RDS")
res_cc <- readRDS("res_cc.RDS")
res_gc <- readRDS("res_gc.RDS")
res_oc <- readRDS("res_oc.RDS")
res_hc <- as.data.frame(res_hc)
res_cc <- as.data.frame(res_cc)
res_gc <- as.data.frame(res_gc)
res_oc <- as.data.frame(res_oc)
systempath <- "/Volumes/GoogleDrive/My\ Drive/Primates_Coculture/Primates/MyAnalysis_v02"
setwd(systempath)
dir.create(file.path(systempath, format(Sys.time(), "Fig2C_%F")))
rootpath <- paste0(file.path(systempath, format(Sys.time(), "Fig2C_%F")))
setwd(rootpath)
a <- "ENSG00000197641" #set which gene to plot
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("Upreg.pdf")
p1 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_text(size=27, face= "italic"),
axis.text=element_text(size=36, color= "black"),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_text(size=30, color = "black"),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + ylim(0,0.75) + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p1)
dev.off()
p
#theme(legend.position="none", axis.title.x = element_text( size=10), axis.text.x = element_text( size=10), axis.title.y = element_text(size=10), axis.text.y = element_text(size=10), plot.title = element_text(size=10)) +
# ylim(0,1.2) +
a <- "ENSG00000165264" #set which gene to plot
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("Downreg.pdf")
p2 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"), title = element_text(size=27, face = "italic"),
axis.text=element_text(size=6, color= "black"),
axis.title=element_blank(), axis.text.x=element_blank(),axis.text.y = element_text(size=30, color = "black"),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + ylim(-0.6,0) + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p2)
dev.off()
###No response
no_resp <- subset(res_all, padj > 0.1)
a <- "ENSG00000119509" #set which gene to plot
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("No_resp.pdf")
p3 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"), title = element_text(size=27, face = "italic"),
axis.text=element_text(size=30, color= "black"),
axis.title=element_blank(), axis.text.x=element_blank(),axis.text.y = element_text(size=30, color = "black"),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + ylim(-0.3,0.3) + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p3)
dev.off()
a <- "ENSG00000112309"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("B3GAT2.pdf")
p4 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"), title = element_text(size=27, face = "italic"),
axis.text=element_text(size=30, color= "black"),
axis.title=element_blank(), axis.text.x=element_blank(),axis.text.y = element_text(size=30, color = "black"),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p4)
dev.off()
a<- "ENSG00000117593"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("DARS2.pdf")
p5 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"), title = element_text(size=27, face = "italic"),
axis.text=element_text(size=30, color= "black"),
axis.title=element_blank(), axis.text.x=element_blank(),axis.text.y = element_text(size=30, color = "black"),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p5)
dev.off()
a<- "ENSG00000144048"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("DUSP11.pdf")
p6 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"), title = element_text(size=27, face = "italic"),
axis.text=element_text(size=30, color= "black"),
axis.title=element_blank(), axis.text.x=element_blank(),axis.text.y = element_text(size=30, color = "black"),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p6)
dev.off()
a<- "ENSG00000138771"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("SHROOM3.pdf")
p7 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"), title = element_text(size=27, face = "italic"),
axis.text=element_text(size=30, color= "black"),
axis.title=element_blank(), axis.text.x=element_blank(),axis.text.y = element_text(size=30, color = "black"),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p7)
dev.off()
###Responds to two of the species (Human and Chimp)
a<- "ENSG00000159228"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
##differenitally Expressed in human and chimp
pdf("CBR1.pdf")
p8 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"), title = element_text(size=27, face = "italic"),
axis.text=element_text(size=30, color= "black"),
axis.title=element_blank(), axis.text.x=element_blank(),axis.text.y = element_text(size=30, color = "black"),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p8)
dev.off()
pdf("Fig2C_1.pdf")
plot_grid(p1, p2,p3,p4, ncol = 2, align= "hv",rel_widths = c(1.3, 1.3), rel_heights = c(1.3,1.3), scale = 1)
dev.off()
pdf("Fig2C_2.pdf")
plot_grid(p5,p6,p7,p8, ncol = 2, align= "hv",rel_widths = c(1.3, 1.3), rel_heights = c(1.3,1.3), scale = 1)
dev.off()
pdf("Fig2C_all.pdf")
plot_grid(p1, p2,p3,p4,p5,p6,p7,p8, ncol = 4, align= "hv",rel_widths = c(1.3, 1.3), rel_heights = c(1.3,1.3), scale = 0.5)
dev.off()
plotall <- list(p1,p2, p3, p4, p5, p6, p7, p8)
pdf("Fig2C_two.pdf")
marrangeGrob(plotall, nrow = 2, ncol=2)
dev.off()
library(grid)
grid.newpage()
pdf("Fig2C_four.pdf")
grid.layout(nrow=2, ncol=2, widths=c(1,2), heights=c(2,1), respect=TRUE)
grid.draw(
cbind(
rbind(ggplotGrob(p3), ggplotGrob(p4), size = "first"),
rbind(ggplotGrob(p1), ggplotGrob(p2), size = "first"),
size = "first"))
dev.off()
pdf("Fig2C_eight.pdf")
grid.layout(nrow=2, ncol=2, widths=c(1,2), heights=c(2,1), respect=TRUE)
grid.draw(
cbind(
rbind(ggplotGrob(p7), ggplotGrob(p8), size = "first"),
rbind(ggplotGrob(p5), ggplotGrob(p6), size = "first"),
size = "first"))
dev.off()
#The order I want in the final plot is:
#Top:
##Shroom3, B3Gat2, DUSP11, DARS2
#Bottom:
#INVS(no response), NDUFB6 (down), SERPBIN13 (up), CBR1
###That ends up being: Page1: P7, P4, P3, P2
##Page2: P6, P5, P1, P8
pdf("Fig2C_right.pdf")
grid.layout(nrow=2, ncol=2, widths=c(1,2), heights=c(2,1), respect=TRUE)
grid.draw(
rbind(
cbind(ggplotGrob(p7), ggplotGrob(p4), size = "first"),
cbind(ggplotGrob(p3), ggplotGrob(p2), size = "first"),
size = "first"))
dev.off()
pdf("Fig2C_left.pdf")
grid.layout(nrow=2, ncol=2, widths=c(1,2), heights=c(2,1), respect=TRUE)
grid.draw(
rbind(
cbind(ggplotGrob(p6), ggplotGrob(p5), size = "first"),
cbind(ggplotGrob(p1), ggplotGrob(p8), size = "first"),
size = "first"))
dev.off()
pdf("Fig2C_all_label.pdf",paper='A4r')
plot_grid(p7, p4, p3, p2, p6, p5, p1, p8, ncol = 4, align= "hv",rel_widths = c(1, 1), rel_heights = c(1,1), scale=1)
dev.off()
######################################################
setwd(rootpath)
a <- "ENSG00000197641" #set which gene to plot
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("Upreg_nolabel.pdf")
p1 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_blank(),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + ylim(0,0.75) + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p1)
dev.off()
p
#theme(legend.position="none", axis.title.x = element_text( size=10), axis.text.x = element_text( size=10), axis.title.y = element_text(size=10), axis.text.y = element_text(size=10), plot.title = element_text(size=10)) +
# ylim(0,1.2) +
a <- "ENSG00000165264" #set which gene to plot
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("Downreg_nolabel.pdf")
p2 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_blank(),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + ylim(-0.6,0) + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p2)
dev.off()
###No response
no_resp <- subset(res_all, padj > 0.1)
a <- "ENSG00000119509" #set which gene to plot
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("No_resp_nolabel.pdf")
p3 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_blank(),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + ylim(-0.3,0.3) + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p3)
dev.off()
a <- "ENSG00000112309"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("B3GAT2_nolabel.pdf")
p4 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_blank(),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p4)
dev.off()
a<- "ENSG00000117593"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("DARS2_nolabel.pdf")
p5 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_blank(),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p5)
dev.off()
a<- "ENSG00000144048"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("DUSP11_nolabel.pdf")
p6 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_blank(),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p6)
dev.off()
a<- "ENSG00000138771"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
pdf("SHROOM3_nolabel.pdf")
p7 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_blank(),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p7)
dev.off()
###Responds to two of the species (Human and Chimp)
a<- "ENSG00000159228"
ac1 <- data.frame(c("Human", "Chimp", "Gorilla", "Orangutan"),
c(res_hc[a, "log2FoldChange"], res_cc[a, "log2FoldChange"], res_gc[a, "log2FoldChange"], res_oc[a, "log2FoldChange"]),
c(res_hc[a, "lfcSE"], res_cc[a, "lfcSE"], res_gc[a, "lfcSE"], res_oc[a, "lfcSE"]))
colnames(ac1) <- c("Species", "LFC", "SE")
ac1$Species <- factor(ac1$Species, levels = c("Human", "Chimp", "Gorilla", "Orangutan"))
##differenitally Expressed in human and chimp
pdf("CBR1_nolabel.pdf")
p8 <-ggplot(ac1, aes(x=Species, y=LFC, group = Species, color=Species)) +
geom_pointrange(aes(ymin=LFC-SE, ymax=LFC+SE), size=2)+labs(title=res_hc[a,"symbol"]) +
geom_errorbar(aes(ymin=LFC-SE, ymax=LFC+SE), width=.2, size=2) +
geom_point(shape = 1, size = 3) +
theme_bw() +
theme(text=element_text(family="Arial"),
title = element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
axis.text.x=element_blank(),
axis.text.y = element_blank(),
panel.border = element_rect(size=2, color="black")) +
theme(legend.position="none") + scale_color_manual(values=c( "#00BFC4","#F8766D", "#7CAE00", "#C77CFF"))
print(p8)
dev.off()
pdf("Fig2C_left_nolabel.pdf")
plot_grid(p7,p4,p3,p2, ncol = 2, align= "hv",rel_widths = c(1, 1), rel_heights = c(1,1), scale= 0.8)
dev.off()
pdf("Fig2C_right_nolabel.pdf")
plot_grid(p6, p5, p1, p8, ncol = 2, align= "hv",rel_widths = c(1, 1), rel_heights = c(1,1), scale= 0.8)
dev.off()
pdf("Fig2C_all_nolabels.pdf",paper='A4r')
plot_grid(p7,p4,p3,p2,p6, p5, p1, p8, ncol = 4, align= "hv",rel_widths = c(1, 1), rel_heights = c(1,1), scale=1)
dev.off()