-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimRatio_PLOTS.R
More file actions
498 lines (411 loc) · 17.1 KB
/
SimRatio_PLOTS.R
File metadata and controls
498 lines (411 loc) · 17.1 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
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
# Comment: we add the negligible constant of 0.00001 to the denominator as a pre-caution to #ensure that the denominator is non-zero.
install.packages("corrplot")
library(corrplot)
## To calculate the topological overlap for all genes within each module for human and chimp: # Magenta
distTOMHumanmagenta <- TOMdist1(AdjMatHumanrestmagenta)
simTOMHumanmagenta = 1-distTOMHumanmagenta
diag(simTOMHumanmagenta)=0
distTOMChimpmagenta <- TOMdist1(AdjMatChimprestmagenta)
simTOMChimpmagenta = 1-distTOMChimpmagenta
diag(simTOMChimpmagenta)=0
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# Magenta
simRatiomagenta=simTOMHumanmagenta/mean(simTOMHumanmagenta)/(simTOMHumanmagenta/mean(simTOMHumanmagenta)+
simTOMChimpmagenta/mean(simTOMChimpmagenta)+0.00001)
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# Brown
distTOMHumanbrown <- TOMdist1(AdjMatHumanrestbrown)
simTOMHumanbrown = 1-distTOMHumanbrown
diag(simTOMHumanbrown)=0
distTOMChimpbrown <- TOMdist1(AdjMatChimprestbrown)
simTOMChimpbrown = 1-distTOMChimpbrown
diag(simTOMChimpbrown)=0
simRatiobrown=simTOMHumanbrown/mean(simTOMHumanbrown)/(simTOMHumanbrown/mean(simTOMHumanbrown)+
simTOMChimpbrown/mean(simTOMChimpbrown)+0.00001)
###### BROWN ######################
corrplot(simRatiobrown, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_brown <- simRatiobrown > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_brown <- bigratio_brown
dat_brown <- 1*dat_brown
head(dat_brown)
corrplot(dat_brown, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_brown <- simRatiobrown < 0.35
low_brown <- lowratio_brown
low_brown <- 1*low_brown
head(low_brown)
corrplot(low_brown, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## To calculate the topological overlap for all genes within each module for human and chimp: # Black
distTOMHumanblack <- TOMdist1(AdjMatHumanrestblack)
simTOMHumanblack = 1-distTOMHumanblack
diag(simTOMHumanblack)=0
distTOMChimpblack <- TOMdist1(AdjMatChimprestblack)
simTOMChimpblack = 1-distTOMChimpblack
diag(simTOMChimpblack)=0
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# Black
simRatioblack=simTOMHumanblack/mean(simTOMHumanblack)/(simTOMHumanblack/mean(simTOMHumanblack)+
simTOMChimpblack/mean(simTOMChimpblack)+0.00001)
###### BLACK ######################
corrplot(simRatioblack, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_black <- simRatioblack > 0.65
write.csv(simRatioblack, file = "simRatioblack.csv")
write.csv(bigratio_black, file = "bigRatioblack.csv")
bigratio_black
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat <- bigratio_black
dat <- 1*dat
head(dat)
corrplot(dat, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_black <- simRatioblack < 0.35
low_black <- lowratio_black
low_black <- 1*low_black
head(low_black)
corrplot(low_black, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## To calculate the topological overlap for all genes within each module for human and chimp: # Yellow
distTOMHumanyellow <- TOMdist1(AdjMatHumanrestyellow)
simTOMHumanyellow = 1-distTOMHumanyellow
diag(simTOMHumanyellow)=0
distTOMChimpyellow <- TOMdist1(AdjMatChimprestyellow)
simTOMChimpyellow = 1-distTOMChimpyellow
diag(simTOMChimpyellow)=0
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# Yellow
simRatioyellow=simTOMHumanyellow/mean(simTOMHumanyellow)/(simTOMHumanyellow/mean(simTOMHumanyellow)+
simTOMChimpyellow/mean(simTOMChimpyellow)+0.00001)
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# BLUE
distTOMHumanblue <- TOMdist1(AdjMatHumanrestblue)
simTOMHumanblue = 1-distTOMHumanblue
diag(simTOMHumanblue)=0
distTOMChimpblue <- TOMdist1(AdjMatChimprestblue)
simTOMChimpblue = 1-distTOMChimpblue
diag(simTOMChimpblue)=0
simRatioblue=simTOMHumanblue/mean(simTOMHumanblue)/(simTOMHumanblue/mean(simTOMHumanblue)+
simTOMChimpblue/mean(simTOMChimpblue)+0.00001)
###### BLUE ######################
corrplot(simRatioblue, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_blue <- simRatioblue > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_blue <- bigratio_blue
dat_blue <- 1*dat_blue
head(dat_blue)
corrplot(dat_blue, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_blue <- simRatioblue < 0.35
low_blue <- lowratio_blue
low_blue <- 1*low_blue
head(low_blue)
corrplot(low_blue, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# GREEN
distTOMHumangreen <- TOMdist1(AdjMatHumanrestgreen)
simTOMHumangreen = 1-distTOMHumangreen
diag(simTOMHumangreen)=0
distTOMChimpgreen <- TOMdist1(AdjMatChimprestgreen)
simTOMChimpgreen = 1-distTOMChimpgreen
diag(simTOMChimpgreen)=0
simRatiogreen=simTOMHumangreen/mean(simTOMHumangreen)/(simTOMHumangreen/mean(simTOMHumangreen)+
simTOMChimpgreen/mean(simTOMChimpgreen)+0.00001)
###### GREEN ######################
corrplot(simRatiogreen, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_green <- simRatiogreen > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_green <- bigratio_green
dat_green <- 1*dat_green
head(dat_green)
corrplot(dat_green, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_green <- simRatiogreen < 0.35
low_green <- lowratio_green
low_green <- 1*low_green
head(low_green)
corrplot(low_green, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# PINK
distTOMHumanpink <- TOMdist1(AdjMatHumanrestpink)
simTOMHumanpink = 1-distTOMHumanpink
diag(simTOMHumanpink)=0
distTOMChimppink <- TOMdist1(AdjMatChimprestpink)
simTOMChimppink = 1-distTOMChimppink
diag(simTOMChimppink)=0
simRatiopink=simTOMHumanpink/mean(simTOMHumanpink)/(simTOMHumanpink/mean(simTOMHumanpink)+
simTOMChimppink/mean(simTOMChimppink)+0.00001)
###### PINK ######################
corrplot(simRatiopink, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_pink <- simRatiopink > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_pink <- bigratio_pink
dat_pink <- 1*dat_pink
head(dat_pink)
corrplot(dat_pink, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_pink <- simRatiopink < 0.35
low_pink <- lowratio_pink
low_pink <- 1*low_pink
head(low_pink)
corrplot(low_pink, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## To calculate the topological overlap for all genes within each module for human and chimp: # Turquoise
############ TURQOUISE ################
distTOMHumanturquoise <- TOMdist1(AdjMatHumanrestturquoise)
simTOMHumanturquoise = 1-distTOMHumanturquoise
diag(simTOMHumanturquoise)=0
distTOMChimpturquoise <- TOMdist1(AdjMatChimprestturquoise)
simTOMChimpturquoise = 1-distTOMChimpturquoise
diag(simTOMChimpturquoise)=0
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# Black
simRatioturquoise=simTOMHumanturquoise/mean(simTOMHumanturquoise)/(simTOMHumanturquoise/mean(simTOMHumanturquoise)+
simTOMChimpturquoise/mean(simTOMChimpturquoise)+0.00001)
# Comment: we add the negligible constant of 0.00001 to the denominator as a pre-caution to #ensure that the denominator is non-zero.
corrplot(simRatioturquoise, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_turquoise <- simRatioturquoise > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_turquoise <- bigratio_turquoise
dat_turquoise <- 1*dat_turquoise
head(dat_turquoise)
corrplot(dat_turquoise, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_turquoise <- simRatioturquoise < 0.35
low_turquoise <- lowratio_turquoise
low_turquoise <- 1*low_turquoise
head(low_turquoise)
corrplot(low_turquoise, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.2,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# GREENYELLOW
distTOMHumangreenyellow <- TOMdist1(AdjMatHumanrestgreenyellow)
simTOMHumangreenyellow = 1-distTOMHumangreenyellow
diag(simTOMHumangreenyellow)=0
distTOMChimpgreenyellow <- TOMdist1(AdjMatChimprestgreenyellow)
simTOMChimpgreenyellow = 1-distTOMChimpgreenyellow
diag(simTOMChimpgreenyellow)=0
simRatiogreenyellow=simTOMHumangreenyellow/mean(simTOMHumangreenyellow)/(simTOMHumangreenyellow/mean(simTOMHumangreenyellow)+
simTOMChimpgreenyellow/mean(simTOMChimpgreenyellow)+0.00001)
###### GREENYELLOW ######################
corrplot(simRatiogreenyellow, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_greenyellow <- simRatiogreenyellow > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_greenyellow <- bigratio_greenyellow
dat_greenyellow <- 1*dat_greenyellow
head(dat_greenyellow)
corrplot(dat_greenyellow, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_greenyellow <- simRatiogreenyellow < 0.35
low_greenyellow <- lowratio_greenyellow
low_greenyellow <- 1*low_greenyellow
head(low_greenyellow)
corrplot(low_greenyellow, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# RED
distTOMHumanred <- TOMdist1(AdjMatHumanrestred)
simTOMHumanred = 1-distTOMHumanred
diag(simTOMHumanred)=0
distTOMChimpred <- TOMdist1(AdjMatChimprestred)
simTOMChimpred = 1-distTOMChimpred
diag(simTOMChimpred)=0
simRatiored=simTOMHumanred/mean(simTOMHumanred)/(simTOMHumanred/mean(simTOMHumanred)+
simTOMChimpred/mean(simTOMChimpred)+0.00001)
###### red ######################
corrplot(simRatiored, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_red <- simRatiored > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_red <- bigratio_red
dat_red <- 1*dat_red
head(dat_red)
corrplot(dat_red, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_red <- simRatiored < 0.35
low_red <- lowratio_red
low_red <- 1*low_red
head(low_red)
corrplot(low_red, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# PINK
distTOMHumanpink <- TOMdist1(AdjMatHumanrestpink)
simTOMHumanpink = 1-distTOMHumanpink
diag(simTOMHumanpink)=0
distTOMChimppink <- TOMdist1(AdjMatChimprestpink)
simTOMChimppink = 1-distTOMChimppink
diag(simTOMChimppink)=0
simRatiopink=simTOMHumanpink/mean(simTOMHumanpink)/(simTOMHumanpink/mean(simTOMHumanpink)+
simTOMChimppink/mean(simTOMChimppink)+0.00001)
###### PINK ######################
corrplot(simRatiopink, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_pink <- simRatiopink > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_pink <- bigratio_pink
dat_pink <- 1*dat_pink
head(dat_pink)
corrplot(dat_pink, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_pink <- simRatiopink < 0.35
low_pink <- lowratio_pink
low_pink <- 1*low_pink
head(low_pink)
corrplot(low_pink, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.4,
col=colorRampPalette(c("white", "dark grey","blue"))(200))
## Creating a matrix for each module to describe the relative topological overlap for all #connections between human and chimp:
# PURPLE
distTOMHumanpurple <- TOMdist1(AdjMatHumanrestpurple)
simTOMHumanpurple = 1-distTOMHumanpurple
diag(simTOMHumanpurple)=0
distTOMChimppurple <- TOMdist1(AdjMatChimprestpurple)
simTOMChimppurple = 1-distTOMChimppurple
diag(simTOMChimppurple)=0
simRatiopurple=simTOMHumanpurple/mean(simTOMHumanpurple)/(simTOMHumanpurple/mean(simTOMHumanpurple)+
simTOMChimppurple/mean(simTOMChimppurple)+0.00001)
###### PURPLE ######################
corrplot(simRatiopurple, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "blue", "yellow"))(200))
bigratio_purple <- simRatiopurple > 0.65
### we only take the ratios bigger than 0.65 and plot them as "1" and "0"
dat_purple <- bigratio_purple
dat_purple <- 1*dat_purple
head(dat_purple)
corrplot(dat_purple, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "dark grey","yellow"))(200))
lowratio_purple <- simRatiopurple < 0.35
low_purple <- lowratio_purple
low_purple <- 1*low_purple
head(low_purple)
corrplot(low_purple, method = "color",
col.lim = c(0,1),
diag = FALSE,
order = "FPC",
tl.cex = 0.6,
col=colorRampPalette(c("white", "dark grey","blue"))(200))