-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
512 lines (512 loc) · 39.2 KB
/
.Rhistory
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
print(SuppEmerg)
dev.off()
View(SelectData_Condensed)
colnames(SelectData_Condensed)
######################################
Fig3_4_ComboInhibDatawZeros = Fig3_4_ComboInhibData
ExclLR_All = subset(Fig3_4_ComboInhibDatawZeros, Fig3_4_ComboInhibDatawZeros$Combo %notin% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
OnlyLR_All = subset(Fig3_4_ComboInhibDatawZeros, Fig3_4_ComboInhibDatawZeros$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
OnlyLR_All[c("CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")][is.na(OnlyLR_All[c("CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")])] <- 0
Fig3_4_ComboInhibDatawZeros = rbind(OnlyLR_All, ExclLR_All)
#
#
SuppControlEmergFigs = list()
Data_To_Plot = c("Prolif_2", "Prolif_4", "Prolif_6", "Apoptosis_2", "Apoptosis_4", "Apoptosis_6", "CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")
for(e in Data_To_Plot){
if(grepl("Apoptosis", e, fixed = TRUE) == T){
PlotTitle = "Apoptosis"
Control_Ylab = "% Annexin V+"
}
if(grepl("Prolif", e, fixed = TRUE)){
PlotTitle = "Proliferation"
Control_Ylab = "% BrdU +"
}
if(grepl("CellNoNorm", e, fixed = TRUE)){
PlotTitle = "Cell number"
Control_Ylab = "Fold change"
}
if(grepl("Morphology", e, fixed = TRUE)){
PlotTitle = "Morphology"
Control_Ylab = "Morphology score"
}
if(grepl("2", e, fixed = TRUE)){
DayFactor = " - Day 2"
}
if(grepl("4", e, fixed = TRUE)){
DayFactor = " - Day 4"
}
if(grepl("6", e, fixed = TRUE)){
DayFactor = " - Day 6"
}
SelectData = Fig3_4_ComboInhibDatawZeros[, c("Combo", e)]
colnames(SelectData) = c("Combo", "Value")
SelectData = na.omit(SelectData)
if(DayFactor %in% c(" - Day 4", " - Day 6")){
SelectData$Value = ifelse(SelectData$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData$Value)
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
SelectData_Condensed$n = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData_Condensed$n)
}else{
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
}
#if(DayFactor == " - Day 2"){
SelectData_Condensed$LRColour = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), "Blue", "Neutral")
###
SelectData_Condensed$ComboWn = paste(SelectData_Condensed$Combo, " (n = ", SelectData_Condensed$n, ")", sep="")
SelectData_merge = merge(SelectData_Condensed, SelectData, by = "Combo")
SelectData_Samples = subset(SelectData, SelectData$Combo %in% SelectData_Condensed$Combo)
PullNames = SelectData_Condensed[, c("Combo", "ComboWn")]
SelectData_Samples = merge(SelectData_Samples, PullNames, by = "Combo")
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = SelectData_Condensed$ComboWn)
ANOVARes = DunnettTest(x=SelectData_Samples$Value, g=SelectData_Samples$Combo, control = "DMSO")
ANOVAResOuts = as.data.frame(ANOVARes[[1]])
row.names(ANOVAResOuts) = gsub("-DMSO", "", row.names(ANOVAResOuts))
ANOVAResOuts$Combo = row.names(ANOVAResOuts)
SelectData_Condensed = merge(SelectData_Condensed, ANOVAResOuts, by = "Combo", all=T)
SelectData_Condensed$Sig = ifelse(SelectData_Condensed$pval < 0.05, "*", NA)
SelectData_Condensed$Sig =ifelse(SelectData_Condensed$LRColour == "Neutral" & DayFactor %in% c(" - Day 4", " - Day 6"), SelectData_Condensed$Sig, NA)
SelectData_Condensed$Combo = factor(SelectData_Condensed$Combo, levels = c("DMSO", "U", "S", "L", "R", "P", "U+S", "U+L", "U+R", "U+P", "S+L", "S+R", "S+P", "L+R", "L+P", "R+P", "U+S+L", "U+S+R","U+L+R", "U+R+P", "U+S+P","U+L+P","S+L+R", "S+L+P", "S+R+P", "L+R+P", "U+S+R+P", "U+S+L+R", "U+S+L+P", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$Combo),]
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = unique(SelectData_Condensed$ComboWn))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$ComboWn),]
if(e %in% c("Prolif_2", "Prolif_4", "Prolif_6")){Axis = c(0,100)}else{Axis = c(0, max(SelectData_Samples$Value)*1.2)}
SuppControlEmergFigs[[e]] = ggplot(SelectData_Condensed, aes(x=ComboWn, y=Mean,fill = LRColour)) + geom_bar(stat = "identity", color = "#000000") + scale_fill_manual(values = c("Neutral" = ColourNeutral, "Blue" = ColourTwoWay)) +theme_classic() + geom_hline(yintercept=0) + ylab(Control_Ylab) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2) + theme(legend.position="none", plot.title = element_text(size = 15, face = "bold"), axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(paste(PlotTitle, DayFactor, sep = "")) + geom_point(data=SelectData_merge, aes(x = ComboWn, y =Value), color = "#000000", fill = "#000000", size = 0.5)+ geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*6))), position = position_dodge(width = 0.9), size = 1, show.legend = F)+ scale_shape_manual(values=c(8)) + scale_y_continuous(limits = Axis, expand = c(0,0)) + geom_point(data=SelectData_Samples, aes(x = ComboWn, y =Value, fill = "#000000"), size=0.5)
}
SuppEmerg = ggarrange(plotlist = SuppControlEmergFigs, ncol = 1, nrow=3)
pdf(paste(FilePath, "FigureS3S4S5_EmergentPropertiesRaw.pdf", sep=""), width = 12, height = 3*2.8)
print(SuppEmerg)
dev.off()
######################################
Fig3_4_ComboInhibDatawZeros = Fig3_4_ComboInhibData
ExclLR_All = subset(Fig3_4_ComboInhibDatawZeros, Fig3_4_ComboInhibDatawZeros$Combo %notin% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
OnlyLR_All = subset(Fig3_4_ComboInhibDatawZeros, Fig3_4_ComboInhibDatawZeros$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
OnlyLR_All[c("CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")][is.na(OnlyLR_All[c("CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")])] <- 0
Fig3_4_ComboInhibDatawZeros = rbind(OnlyLR_All, ExclLR_All)
#
#
SuppControlEmergFigs = list()
Data_To_Plot = c("Prolif_2", "Prolif_4", "Prolif_6", "Apoptosis_2", "Apoptosis_4", "Apoptosis_6", "CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")
for(e in Data_To_Plot){
if(grepl("Apoptosis", e, fixed = TRUE) == T){
PlotTitle = "Apoptosis"
Control_Ylab = "% Annexin V+"
}
if(grepl("Prolif", e, fixed = TRUE)){
PlotTitle = "Proliferation"
Control_Ylab = "% BrdU +"
}
if(grepl("CellNoNorm", e, fixed = TRUE)){
PlotTitle = "Cell number"
Control_Ylab = "Fold change"
}
if(grepl("Morphology", e, fixed = TRUE)){
PlotTitle = "Morphology"
Control_Ylab = "Morphology score"
}
if(grepl("2", e, fixed = TRUE)){
DayFactor = " - Day 2"
}
if(grepl("4", e, fixed = TRUE)){
DayFactor = " - Day 4"
}
if(grepl("6", e, fixed = TRUE)){
DayFactor = " - Day 6"
}
SelectData = Fig3_4_ComboInhibDatawZeros[, c("Combo", e)]
colnames(SelectData) = c("Combo", "Value")
SelectData = na.omit(SelectData)
if(DayFactor %in% c(" - Day 4", " - Day 6")){
SelectData$Value = ifelse(SelectData$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData$Value)
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
SelectData_Condensed$n = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData_Condensed$n)
}else{
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
}
#if(DayFactor == " - Day 2"){
SelectData_Condensed$LRColour = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), "Blue", "Neutral")
###
SelectData_Condensed$ComboWn = paste(SelectData_Condensed$Combo, " (n = ", SelectData_Condensed$n, ")", sep="")
SelectData_merge = merge(SelectData_Condensed, SelectData, by = "Combo")
SelectData_Samples = subset(SelectData, SelectData$Combo %in% SelectData_Condensed$Combo)
PullNames = SelectData_Condensed[, c("Combo", "ComboWn")]
SelectData_Samples = merge(SelectData_Samples, PullNames, by = "Combo")
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = SelectData_Condensed$ComboWn)
ANOVARes = DunnettTest(x=SelectData_Samples$Value, g=SelectData_Samples$Combo, control = "DMSO")
ANOVAResOuts = as.data.frame(ANOVARes[[1]])
row.names(ANOVAResOuts) = gsub("-DMSO", "", row.names(ANOVAResOuts))
ANOVAResOuts$Combo = row.names(ANOVAResOuts)
SelectData_Condensed = merge(SelectData_Condensed, ANOVAResOuts, by = "Combo", all=T)
SelectData_Condensed$Sig = ifelse(SelectData_Condensed$pval < 0.05, "*", NA)
if(DayFactor %in% c(" - Day 4", " - Day 6")){
SelectData_Condensed$Sig =ifelse(SelectData_Condensed$LRColour == "Neutral", SelectData_Condensed$Sig, NA)
}
SelectData_Condensed$Combo = factor(SelectData_Condensed$Combo, levels = c("DMSO", "U", "S", "L", "R", "P", "U+S", "U+L", "U+R", "U+P", "S+L", "S+R", "S+P", "L+R", "L+P", "R+P", "U+S+L", "U+S+R","U+L+R", "U+R+P", "U+S+P","U+L+P","S+L+R", "S+L+P", "S+R+P", "L+R+P", "U+S+R+P", "U+S+L+R", "U+S+L+P", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$Combo),]
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = unique(SelectData_Condensed$ComboWn))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$ComboWn),]
if(e %in% c("Prolif_2", "Prolif_4", "Prolif_6")){Axis = c(0,100)}else{Axis = c(0, max(SelectData_Samples$Value)*1.2)}
SuppControlEmergFigs[[e]] = ggplot(SelectData_Condensed, aes(x=ComboWn, y=Mean,fill = LRColour)) + geom_bar(stat = "identity", color = "#000000") + scale_fill_manual(values = c("Neutral" = ColourNeutral, "Blue" = ColourTwoWay)) +theme_classic() + geom_hline(yintercept=0) + ylab(Control_Ylab) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2) + theme(legend.position="none", plot.title = element_text(size = 15, face = "bold"), axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(paste(PlotTitle, DayFactor, sep = "")) + geom_point(data=SelectData_merge, aes(x = ComboWn, y =Value), color = "#000000", fill = "#000000", size = 0.5)+ geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*6))), position = position_dodge(width = 0.9), size = 1, show.legend = F)+ scale_shape_manual(values=c(8)) + scale_y_continuous(limits = Axis, expand = c(0,0)) + geom_point(data=SelectData_Samples, aes(x = ComboWn, y =Value, fill = "#000000"), size=0.5)
}
SuppEmerg = ggarrange(plotlist = SuppControlEmergFigs, ncol = 1, nrow=3)
pdf(paste(FilePath, "FigureS3S4S5_EmergentPropertiesRaw.pdf", sep=""), width = 12, height = 3*2.8)
print(SuppEmerg)
dev.off()
DayFactor
DayFactor %in% c(" - Day 4", " - Day 6")
SelectData$Value = ifelse(SelectData$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData$Value)
View(SelectData)
151/3
CHECK = subset(SelectData, SelectData$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P") )
CHECK = subset(c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), ! c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P") %in% SelectData$Combo)
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
View(SelectData_Condensed)
SelectData_Condensed$n = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData_Condensed$n)
View(SelectData_Condensed)
#if(DayFactor == " - Day 2"){
SelectData_Condensed$LRColour = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), "Blue", "Neutral")
###
SelectData_Condensed$ComboWn = paste(SelectData_Condensed$Combo, " (n = ", SelectData_Condensed$n, ")", sep="")
SelectData_merge = merge(SelectData_Condensed, SelectData, by = "Combo")
PullNames = SelectData_Condensed[, c("Combo", "ComboWn")]
SelectData_Samples = merge(SelectData_Samples, PullNames, by = "Combo")
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = SelectData_Condensed$ComboWn)
ANOVARes = DunnettTest(x=SelectData_Samples$Value, g=SelectData_Samples$Combo, control = "DMSO")
ANOVAResOuts = as.data.frame(ANOVARes[[1]])
row.names(ANOVAResOuts) = gsub("-DMSO", "", row.names(ANOVAResOuts))
ANOVAResOuts$Combo = row.names(ANOVAResOuts)
SelectData_Condensed = merge(SelectData_Condensed, ANOVAResOuts, by = "Combo", all=T)
SelectData_Condensed$Sig = ifelse(SelectData_Condensed$pval < 0.05, "*", NA)
if(DayFactor %in% c(" - Day 4", " - Day 6")){
SelectData_Condensed$Sig =ifelse(SelectData_Condensed$LRColour == "Neutral", SelectData_Condensed$Sig, NA)
}
View(SelectData_Condensed)
DayFactor
dim(SelectData_Condensed)
SelectData_Condensed$Combo = factor(SelectData_Condensed$Combo, levels = c("DMSO", "U", "S", "L", "R", "P", "U+S", "U+L", "U+R", "U+P", "S+L", "S+R", "S+P", "L+R", "L+P", "R+P", "U+S+L", "U+S+R","U+L+R", "U+R+P", "U+S+P","U+L+P","S+L+R", "S+L+P", "S+R+P", "L+R+P", "U+S+R+P", "U+S+L+R", "U+S+L+P", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$Combo),]
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = unique(SelectData_Condensed$ComboWn))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$ComboWn),]
if(e %in% c("Prolif_2", "Prolif_4", "Prolif_6")){Axis = c(0,100)}else{Axis = c(0, max(SelectData_Samples$Value)*1.2)}
ggplot(SelectData_Condensed, aes(x=ComboWn, y=Mean,fill = LRColour)) + geom_bar(stat = "identity", color = "#000000") + scale_fill_manual(values = c("Neutral" = ColourNeutral, "Blue" = ColourTwoWay)) +theme_classic() + geom_hline(yintercept=0) + ylab(Control_Ylab) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2) + theme(legend.position="none", plot.title = element_text(size = 15, face = "bold"), axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(paste(PlotTitle, DayFactor, sep = "")) + geom_point(data=SelectData_merge, aes(x = ComboWn, y =Value), color = "#000000", fill = "#000000", size = 0.5)+ geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*6))), position = position_dodge(width = 0.9), size = 1, show.legend = F)+ scale_shape_manual(values=c(8)) + scale_y_continuous(limits = Axis, expand = c(0,0)) + geom_point(data=SelectData_Samples, aes(x = ComboWn, y =Value, fill = "#000000"), size=0.5)
rlang::last_trace()
ggplot(SelectData_Condensed, aes(x=ComboWn, y=Mean,fill = LRColour)) + geom_bar(stat = "identity", color = "#000000") + scale_fill_manual(values = c("Neutral" = ColourNeutral, "Blue" = ColourTwoWay)) +theme_classic() + geom_hline(yintercept=0) + ylab(Control_Ylab) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2) + theme(legend.position="none", plot.title = element_text(size = 15, face = "bold"), axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(paste(PlotTitle, DayFactor, sep = "")) + geom_point(data=SelectData_merge, aes(x = ComboWn, y =Value), color = "#000000", fill = "#000000", size = 0.5)+ geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*6))), position = position_dodge(width = 0.9), size = 1, show.legend = F)+ scale_shape_manual(values=c(8)) + scale_y_continuous(limits = Axis, expand = c(0,0)) + geom_point(data=SelectData_Samples, aes(x = ComboWn, y =Value, fill = "#000000"), size=0.5)
if(DayFactor %in% c(" - Day 4", " - Day 6")){
SelectData$Value = ifelse(SelectData$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData$Value)
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
SelectData_Condensed$n = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData_Condensed$n)
}else{
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
}
#if(DayFactor == " - Day 2"){
SelectData_Condensed$LRColour = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), "Blue", "Neutral")
###
SelectData_Condensed$ComboWn = paste(SelectData_Condensed$Combo, " (n = ", SelectData_Condensed$n, ")", sep="")
SelectData_merge = merge(SelectData_Condensed, SelectData, by = "Combo")
SelectData_Samples = subset(SelectData, SelectData$Combo %in% SelectData_Condensed$Combo)
PullNames = SelectData_Condensed[, c("Combo", "ComboWn")]
SelectData_Samples = merge(SelectData_Samples, PullNames, by = "Combo")
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = SelectData_Condensed$ComboWn)
ANOVARes = DunnettTest(x=SelectData_Samples$Value, g=SelectData_Samples$Combo, control = "DMSO")
ANOVAResOuts = as.data.frame(ANOVARes[[1]])
row.names(ANOVAResOuts) = gsub("-DMSO", "", row.names(ANOVAResOuts))
ANOVAResOuts$Combo = row.names(ANOVAResOuts)
SelectData_Condensed = merge(SelectData_Condensed, ANOVAResOuts, by = "Combo", all=T)
SelectData_Condensed$Sig = ifelse(SelectData_Condensed$pval < 0.05, "*", NA)
if(DayFactor %in% c(" - Day 4", " - Day 6")){
SelectData_Condensed$Sig =ifelse(SelectData_Condensed$LRColour == "Neutral", SelectData_Condensed$Sig, NA)
}
SelectData_Condensed$Combo = factor(SelectData_Condensed$Combo, levels = c("DMSO", "U", "S", "L", "R", "P", "U+S", "U+L", "U+R", "U+P", "S+L", "S+R", "S+P", "L+R", "L+P", "R+P", "U+S+L", "U+S+R","U+L+R", "U+R+P", "U+S+P","U+L+P","S+L+R", "S+L+P", "S+R+P", "L+R+P", "U+S+R+P", "U+S+L+R", "U+S+L+P", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$Combo),]
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = unique(SelectData_Condensed$ComboWn))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$ComboWn),]
if(e %in% c("Prolif_2", "Prolif_4", "Prolif_6")){Axis = c(0,100)}else{Axis = c(0, max(SelectData_Samples$Value)*1.2)}
e = "Apoptosis_6"
if(grepl("Apoptosis", e, fixed = TRUE) == T){
PlotTitle = "Apoptosis"
Control_Ylab = "% Annexin V+"
}
if(grepl("Prolif", e, fixed = TRUE)){
PlotTitle = "Proliferation"
Control_Ylab = "% BrdU +"
}
if(grepl("CellNoNorm", e, fixed = TRUE)){
PlotTitle = "Cell number"
Control_Ylab = "Fold change"
}
if(grepl("Morphology", e, fixed = TRUE)){
PlotTitle = "Morphology"
Control_Ylab = "Morphology score"
}
if(grepl("2", e, fixed = TRUE)){
DayFactor = " - Day 2"
}
if(grepl("4", e, fixed = TRUE)){
DayFactor = " - Day 4"
}
if(grepl("6", e, fixed = TRUE)){
DayFactor = " - Day 6"
}
SelectData = Fig3_4_ComboInhibDatawZeros[, c("Combo", e)]
colnames(SelectData) = c("Combo", "Value")
SelectData = na.omit(SelectData)
SelectData$Value = ifelse(SelectData$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData$Value)
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
d = "S+L+R+P"
! d %in% SelectData_Condensed$Combo
dim(SelectData_Condensed)
dim(SelectData_Condensed)[1] < 32
ExtraData = as.data.frame(ncol = 5, nrow = 32-dim(SelectData_Condensed)[1])
ExtraData = as.data.frame(matrix(ncol = 5, nrow = 32-dim(SelectData_Condensed)[1]))
ExtraData = 0
ExtraData = as.data.frame(matrix(ncol = 5, nrow = 32-dim(SelectData_Condensed)[1]))
View(ExtraData)
ExtraData[is.na(ExtraData)] = 0
colnames(ExtraData) = colnames(SelectData_Condensed)
View(ExtraData)
ExtraData$Combo = subset(c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), ! c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), %in% SelectData_Condensed$Combo)
ExtraData$Combo = subset(c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), ! c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P") %in% SelectData_Condensed$Combo)
SelectData_Condensed = rbind(SelectData_Condensed, ExtraData)
SelectData_Condensed$n = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData_Condensed$n)
#if(DayFactor == " - Day 2"){
SelectData_Condensed$LRColour = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), "Blue", "Neutral")
###
SelectData_Condensed$ComboWn = paste(SelectData_Condensed$Combo, " (n = ", SelectData_Condensed$n, ")", sep="")
SelectData_merge = merge(SelectData_Condensed, SelectData, by = "Combo")
View(SelectData_merge)
SelectData_merge = merge(SelectData_Condensed, SelectData, by = "Combo", all=T)
SelectData_merge = merge(SelectData_Condensed, SelectData, by = "Combo", all=T)
View(SelectData_merge)
######################################
Fig3_4_ComboInhibDatawZeros = Fig3_4_ComboInhibData
ExclLR_All = subset(Fig3_4_ComboInhibDatawZeros, Fig3_4_ComboInhibDatawZeros$Combo %notin% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
OnlyLR_All = subset(Fig3_4_ComboInhibDatawZeros, Fig3_4_ComboInhibDatawZeros$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
OnlyLR_All[c("CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")][is.na(OnlyLR_All[c("CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")])] <- 0
Fig3_4_ComboInhibDatawZeros = rbind(OnlyLR_All, ExclLR_All)
#
#
SuppControlEmergFigs = list()
Data_To_Plot = c("Prolif_2", "Prolif_4", "Prolif_6", "Apoptosis_2", "Apoptosis_4", "Apoptosis_6", "CellNoNorm_2", "CellNoNorm_4", "CellNoNorm_6")
for(e in Data_To_Plot){
if(grepl("Apoptosis", e, fixed = TRUE) == T){
PlotTitle = "Apoptosis"
Control_Ylab = "% Annexin V+"
}
if(grepl("Prolif", e, fixed = TRUE)){
PlotTitle = "Proliferation"
Control_Ylab = "% BrdU +"
}
if(grepl("CellNoNorm", e, fixed = TRUE)){
PlotTitle = "Cell number"
Control_Ylab = "Fold change"
}
if(grepl("Morphology", e, fixed = TRUE)){
PlotTitle = "Morphology"
Control_Ylab = "Morphology score"
}
if(grepl("2", e, fixed = TRUE)){
DayFactor = " - Day 2"
}
if(grepl("4", e, fixed = TRUE)){
DayFactor = " - Day 4"
}
if(grepl("6", e, fixed = TRUE)){
DayFactor = " - Day 6"
}
SelectData = Fig3_4_ComboInhibDatawZeros[, c("Combo", e)]
colnames(SelectData) = c("Combo", "Value")
SelectData = na.omit(SelectData)
if(DayFactor %in% c(" - Day 4", " - Day 6")){
SelectData$Value = ifelse(SelectData$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData$Value)
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
if(dim(SelectData_Condensed)[1] < 32){
ExtraData = as.data.frame(matrix(ncol = 5, nrow = 32-dim(SelectData_Condensed)[1]))
ExtraData[is.na(ExtraData)] = 0
colnames(ExtraData) = colnames(SelectData_Condensed)
ExtraData$Combo = subset(c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), ! c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P") %in% SelectData_Condensed$Combo)
SelectData_Condensed = rbind(SelectData_Condensed, ExtraData)
}
SelectData_Condensed$n = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), 0, SelectData_Condensed$n)
}else{
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
}
#if(DayFactor == " - Day 2"){
SelectData_Condensed$LRColour = ifelse(SelectData_Condensed$Combo %in% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"), "Blue", "Neutral")
###
SelectData_Condensed$ComboWn = paste(SelectData_Condensed$Combo, " (n = ", SelectData_Condensed$n, ")", sep="")
SelectData_merge = merge(SelectData_Condensed, SelectData, by = "Combo", all=T)
SelectData_Samples = subset(SelectData, SelectData$Combo %in% SelectData_Condensed$Combo)
PullNames = SelectData_Condensed[, c("Combo", "ComboWn")]
SelectData_Samples = merge(SelectData_Samples, PullNames, by = "Combo")
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = SelectData_Condensed$ComboWn)
ANOVARes = DunnettTest(x=SelectData_Samples$Value, g=SelectData_Samples$Combo, control = "DMSO")
ANOVAResOuts = as.data.frame(ANOVARes[[1]])
row.names(ANOVAResOuts) = gsub("-DMSO", "", row.names(ANOVAResOuts))
ANOVAResOuts$Combo = row.names(ANOVAResOuts)
SelectData_Condensed = merge(SelectData_Condensed, ANOVAResOuts, by = "Combo", all=T)
SelectData_Condensed$Sig = ifelse(SelectData_Condensed$pval < 0.05, "*", NA)
if(DayFactor %in% c(" - Day 4", " - Day 6")){
SelectData_Condensed$Sig =ifelse(SelectData_Condensed$LRColour == "Neutral", SelectData_Condensed$Sig, NA)
}
SelectData_Condensed$Combo = factor(SelectData_Condensed$Combo, levels = c("DMSO", "U", "S", "L", "R", "P", "U+S", "U+L", "U+R", "U+P", "S+L", "S+R", "S+P", "L+R", "L+P", "R+P", "U+S+L", "U+S+R","U+L+R", "U+R+P", "U+S+P","U+L+P","S+L+R", "S+L+P", "S+R+P", "L+R+P", "U+S+R+P", "U+S+L+R", "U+S+L+P", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$Combo),]
SelectData_Condensed$ComboWn = factor(SelectData_Condensed$ComboWn, levels = unique(SelectData_Condensed$ComboWn))
SelectData_Condensed <- SelectData_Condensed[order(SelectData_Condensed$ComboWn),]
if(e %in% c("Prolif_2", "Prolif_4", "Prolif_6")){Axis = c(0,100)}else{Axis = c(0, max(SelectData_Samples$Value)*1.2)}
SuppControlEmergFigs[[e]] = ggplot(SelectData_Condensed, aes(x=ComboWn, y=Mean,fill = LRColour)) + geom_bar(stat = "identity", color = "#000000") + scale_fill_manual(values = c("Neutral" = ColourNeutral, "Blue" = ColourTwoWay)) +theme_classic() + geom_hline(yintercept=0) + ylab(Control_Ylab) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2) + theme(legend.position="none", plot.title = element_text(size = 15, face = "bold"), axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(paste(PlotTitle, DayFactor, sep = "")) + geom_point(data=SelectData_merge, aes(x = ComboWn, y =Value), color = "#000000", fill = "#000000", size = 0.5)+ geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*6))), position = position_dodge(width = 0.9), size = 1, show.legend = F)+ scale_shape_manual(values=c(8)) + scale_y_continuous(limits = Axis, expand = c(0,0)) + geom_point(data=SelectData_Samples, aes(x = ComboWn, y =Value, fill = "#000000"), size=0.5)
}
SuppEmerg = ggarrange(plotlist = SuppControlEmergFigs, ncol = 1, nrow=3)
pdf(paste(FilePath, "FigureS3S4S5_EmergentPropertiesRaw.pdf", sep=""), width = 12, height = 3*2.8)
print(SuppEmerg)
dev.off()
dim(ExclLR)
range(ExclLR$Mean)
MinAxis = min(ExclLR$Mean)
MaxAxis = max(ExclLR$Mean)
min(ExclLR$Mean)
-5*1.2
SuppControlPCRFigs = list()
Data_To_Plot = c("Rex1", "Oct4", "Dnmt3b", "Fgf5", "Mixl1", "Lefty2", "Otx2", "Morphology")
NRows = length(Data_To_Plot)
for(e in Data_To_Plot){
if(e == "Morphology"){
Ytitle = "Morphology Score"
TitleStyle = "bold"}else{
Ytitle =expression(Log[2]~Fold~Change)
TitleStyle = "bold.italic"}
SelectData = Fig3_4_ComboInhibData[, c("Combo", e)]
colnames(SelectData) = c("Combo", "Value")
SelectData = na.omit(SelectData)
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
SelectData_Condensed_n3 = subset(SelectData_Condensed, SelectData_Condensed$n > 1)
SelectData_Condensed$Combo = factor(SelectData_Condensed$Combo, levels = c("DMSO", "U", "S", "L", "R", "P", "U+S", "U+L", "U+R", "U+P", "S+L", "S+R", "S+P", "L+R", "L+P", "R+P", "U+S+L", "U+S+R", "U+R+P", "U+S+P","U+L+P","S+L+R", "S+L+P", "S+R+P", "L+R+P", "U+S+R+P", "U+S+L+P", "U+S+L+R+P"))
ExclLR = subset(SelectData_Condensed, SelectData_Condensed$Combo %notin% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
SelectData_ExclLR = subset(SelectData, SelectData$Combo %notin% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
ExclLR$ComboWn = paste(ExclLR$Combo, " (n = ", ExclLR$n, ")", sep="")
SelectData_ExclLRmerge = merge(ExclLR, SelectData_ExclLR, by = "Combo")
ExclLR <- ExclLR[order(ExclLR$Combo),]
ExclLR$ComboWn = factor(ExclLR$ComboWn, levels = ExclLR$ComboWn)
SelectData_Rm = subset(SelectData, SelectData$Combo %in% ExclLR$Combo )
ANOVARes = DunnettTest(x=SelectData_Rm$Value, g=SelectData_Rm$Combo, control = "DMSO")
ANOVAResOuts = as.data.frame(ANOVARes[[1]])
ANOVAResOuts$Combo = gsub("-DMSO", "", row.names(ANOVAResOuts))
ExclLR = merge(ExclLR, ANOVAResOuts, by = "Combo", all = T)
ExclLR$Sig = ifelse(ExclLR$pval < 0.05, "*", NA)
SuppControlPCRFigs[[e]] = ggplot(ExclLR, aes(x=ComboWn, y=Mean)) + geom_col(fill = ColourNeutral, color = "#000000") + geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*5))), position = position_dodge(width = 0.9), size = 1, show.legend = F) +theme_classic() + geom_hline(yintercept=0) + ylab(Ytitle) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2)+ scale_shape_manual(values=c(8)) + theme(legend.position="none", plot.title = element_text(size = 15, face = TitleStyle), axis.text.x = element_text( angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(e) + geom_point(data=SelectData_ExclLRmerge, aes(x = ComboWn, y =Value), size=0.5) + scale_y_continuous(expand = c(0,0))
}
pdf(paste(FilePath, "FigureS2_MorphologyRaw.pdf", sep=""), width = 12, height = 2.8)
print(SuppControlPCRFigs[["Morphology"]])
dev.off()
SuppControlPCRFigs[["Morphology"]] = NULL
NRows = length(SuppControlPCRFigs)
SuppPCR = ggarrange(plotlist = SuppControlPCRFigs, ncol = 1, nrow=NRows)
pdf(paste(FilePath, "FigureS9_GeneExpressionRaw.pdf", sep=""), width = 12, height = NRows*2.8)
print(SuppPCR)
dev.off()
ggplot(ExclLR, aes(x=ComboWn, y=Mean)) + geom_col(fill = ColourNeutral, color = "#000000") + geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*5))), position = position_dodge(width = 0.9), size = 1, show.legend = F) +theme_classic() + geom_hline(yintercept=0) + ylab(Ytitle) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2)+ scale_shape_manual(values=c(8)) + theme(legend.position="none", plot.title = element_text(size = 15, face = TitleStyle), axis.text.x = element_text( angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(e) + geom_point(data=SelectData_ExclLRmerge, aes(x = ComboWn, y =Value), size=0.5) + scale_y_continuous(expand = c(0,0))
SuppControlPCRFigs = list()
Data_To_Plot = c("Rex1", "Oct4", "Dnmt3b", "Fgf5", "Mixl1", "Lefty2", "Otx2", "Morphology")
NRows = length(Data_To_Plot)
for(e in Data_To_Plot){
if(e == "Morphology"){
Ytitle = "Morphology Score"
TitleStyle = "bold"}else{
Ytitle =expression(Log[2]~Fold~Change)
TitleStyle = "bold.italic"}
SelectData = Fig3_4_ComboInhibData[, c("Combo", e)]
colnames(SelectData) = c("Combo", "Value")
SelectData = na.omit(SelectData)
SelectData_Condensed = SelectData %>% group_by(Combo) %>% summarise(n = n(), Mean = mean(Value), stdev = sd(Value), se=sd(Value)/sqrt(n()))
SelectData_Condensed_n3 = subset(SelectData_Condensed, SelectData_Condensed$n > 1)
SelectData_Condensed$Combo = factor(SelectData_Condensed$Combo, levels = c("DMSO", "U", "S", "L", "R", "P", "U+S", "U+L", "U+R", "U+P", "S+L", "S+R", "S+P", "L+R", "L+P", "R+P", "U+S+L", "U+S+R", "U+R+P", "U+S+P","U+L+P","S+L+R", "S+L+P", "S+R+P", "L+R+P", "U+S+R+P", "U+S+L+P", "U+S+L+R+P"))
ExclLR = subset(SelectData_Condensed, SelectData_Condensed$Combo %notin% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
SelectData_ExclLR = subset(SelectData, SelectData$Combo %notin% c("L+R", "U+L+R", "S+L+R", "L+R+P", "U+S+L+R", "U+L+R+P", "S+L+R+P", "U+S+L+R+P"))
ExclLR$ComboWn = paste(ExclLR$Combo, " (n = ", ExclLR$n, ")", sep="")
SelectData_ExclLRmerge = merge(ExclLR, SelectData_ExclLR, by = "Combo")
ExclLR <- ExclLR[order(ExclLR$Combo),]
ExclLR$ComboWn = factor(ExclLR$ComboWn, levels = ExclLR$ComboWn)
SelectData_Rm = subset(SelectData, SelectData$Combo %in% ExclLR$Combo )
ANOVARes = DunnettTest(x=SelectData_Rm$Value, g=SelectData_Rm$Combo, control = "DMSO")
ANOVAResOuts = as.data.frame(ANOVARes[[1]])
ANOVAResOuts$Combo = gsub("-DMSO", "", row.names(ANOVAResOuts))
ExclLR = merge(ExclLR, ANOVAResOuts, by = "Combo", all = T)
ExclLR$Sig = ifelse(ExclLR$pval < 0.05, "*", NA)
SuppControlPCRFigs[[e]] = ggplot(ExclLR, aes(x=ComboWn, y=Mean)) + geom_col(fill = ColourNeutral, color = "#000000") + geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*5))), position = position_dodge(width = 0.9), size = 1, show.legend = F) +theme_classic() + geom_hline(yintercept=0) + ylab(Ytitle) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2)+ scale_shape_manual(values=c(8)) + theme(legend.position="none", plot.title = element_text(size = 15, face = TitleStyle), axis.text.x = element_text( angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(e) + geom_point(data=SelectData_ExclLRmerge, aes(x = ComboWn, y =Value), size=0.5) + scale_y_continuous(expand = c(0,0))
}
pdf(paste(FilePath, "FigureS2_MorphologyRaw.pdf", sep=""), width = 12, height = 2.8)
print(SuppControlPCRFigs[["Morphology"]])
dev.off()
SuppControlPCRFigs[["Morphology"]] = NULL
NRows = length(SuppControlPCRFigs)
SuppPCR = ggarrange(plotlist = SuppControlPCRFigs, ncol = 1, nrow=NRows)
pdf(paste(FilePath, "FigureS9_GeneExpressionRaw.pdf", sep=""), width = 12, height = NRows*2.8)
print(SuppPCR)
dev.off()
ggplot(ExclLR, aes(x=ComboWn, y=Mean)) + geom_col(fill = ColourNeutral, color = "#000000") + geom_point(aes(color = ColourTwoWay, shape = Sig, y = Mean + sign(Mean) * (se + (se*5))), position = position_dodge(width = 0.9), size = 1, show.legend = F) +theme_classic() + geom_hline(yintercept=0) + ylab(Ytitle) + xlab("") + geom_errorbar(aes(ymin = Mean-se, ymax = Mean+se), position = position_dodge(width = 0.9), width = 0.2)+ scale_shape_manual(values=c(8)) + theme(legend.position="none", plot.title = element_text(size = 15, face = TitleStyle), axis.text.x = element_text( angle = 90, vjust = 0.5, hjust=1, face = "bold")) + ggtitle(e) + geom_point(data=SelectData_ExclLRmerge, aes(x = ComboWn, y =Value), size=0.5) + scale_y_continuous(expand = c(0,0))
SuppControlPCRFigs[["Otx2"]]
library(tidyverse)
library(igraph)
library(monocle3)
library(Seurat)
HypoMapHUMAN = readRDS("~/Hypothalamus_HumanMouseInt.rds")
[email protected]$Species = ifelse([email protected]$Dataset %in% c("Herb", "Siletti", "Zhou"), "Human", "Mouse")
[email protected]$Human = ifelse([email protected]$Dataset %in% c("Herb", "Zhou"), "HumanDevelopment", "None")
[email protected]$Human = ifelse([email protected]$Dataset %in% c("Siletti"), "HumanAdult", [email protected]$Human)
[email protected]$SpeciesStage = ifelse([email protected]$Human %in% c("None") & [email protected]$Dataset %in% c("RomanovDev", "KimDev"), "MouseDevelopment", [email protected]$Human)
[email protected]$SpeciesStage = ifelse([email protected]$SpeciesStage %in% c("None"), "MouseAdult", [email protected]$SpeciesStage)
Idents(HypoMapHUMAN) = "SpeciesStage"
MouseAdultSeu = subset(HypoMapHUMAN, idents = "MouseAdult")
MN_TopHits = readRDS("~/Downloads/Figure 3/MN_July_2023_top_hits_NV_humanK116_mouseC185.rds")
View(MN_TopHits)
DatasetClust = [email protected] %>% group_by(C185_named) %>% summarise("Count" = n(DatasetClean))
DatasetClust = [email protected] %>% group_by(C185_named) %>% dplyr::summarise("Count" = n(DatasetClean))
DatasetClust = [email protected] %>% group_by(C185_named, DatasetClean) %>% dplyr::summarise("Count" = n())
View(DatasetClust)
DatasetOrig = as.data.frame(table([email protected]$DatasetClean))
ClustOrig = as.data.frame(table([email protected]$C185_named))
View(ClustOrig)
DatasetClustMerge = merge(DatasetClust, DatasetOrig, by = "Var1")
View(DatasetClust)
DatasetClustMerge = merge(DatasetClust, DatasetOrig, by.x = "C185_named", by.y = "Var1")
Var1
DatasetClustMerge = merge(DatasetClust, DatasetOrig, by.x = "C185_named", by.y = "Var1")
colnames(DatasetClust)
DatasetClustMerge = merge(DatasetClust, DatasetOrig, by.x = "DatasetClean", by.y = "Var1")
DatasetClustMerge = merge(DatasetClustMerge, ClustOrig, by.x = "C185_named", by.y = "Var1")
View(DatasetClustMerge)
DatasetClustMerge$PctDataset = DatasetClustMerge$Count/DatasetClustMerge$Freq.x
x = sort(unique([email protected]))[1]
x = sort(unique([email protected]$C185_named))[1]
PullCluster = subset([email protected], [email protected]$$C185_named == x)
PullCluster = subset([email protected], [email protected]$C185_named == x)
View(PullCluster)
PullCluster = as.data.frame(table(subset([email protected], [email protected]$C185_named == x)$C185_named)
}
PullCluster = subset([email protected], [email protected]$C185_named == x)
PullClusterTab = as.data.frame(PullCluster$C185_named)
View(PullClusterTab)
PullClusterTab = as.data.frame(table(PullCluster$C185_named))
View(PullClusterTab)
PullClusterTab = as.data.frame(table(PullCluster$DatasetClean))
View(PullClusterTab)
PullClusterTab = merge(PullClusterTab, DatasetOrig, by = "Var1")
PullClusterTab$Pct = PullClusterTab$Freq.x/PullClusterTab$Freq.y
PullClusterTab$PctNorm = PullClusterTab$Pct/sum(PullClusterTab$Pct)*100
paste(PullClusterTab$Var1, " [", round(PullClusterTab$Pct/sum(PullClusterTab$Pct)*100, digits = 2), "%]", sep=""), collapse = "; ")
paste(paste(PullClusterTab$Var1, " [", round(PullClusterTab$Pct/sum(PullClusterTab$Pct)*100, digits = 2), "%]", sep=""), collapse = "; ")
as.data.frame(c(x, paste(paste(PullClusterTab$Var1, " [", round(PullClusterTab$Pct/sum(PullClusterTab$Pct)*100, digits = 2), "%]", sep=""), collapse = "; ")))
DATA = as.data.frame(t(c(x, paste(paste(PullClusterTab$Var1, " [", round(PullClusterTab$Pct/sum(PullClusterTab$Pct)*100, digits = 2), "%]", sep=""), collapse = "; "))))
View(DATA)
HypoMapDatasetCompile = as.data.frame(matrix(ncol=2,nrow=0))
View(DATA)
HypoMapDatasetCompile = as.data.frame(matrix(ncol=2,nrow=0))
for(x in sort(unique([email protected]$C185_named))){
PullCluster = subset([email protected], [email protected]$C185_named == x)
PullClusterTab = as.data.frame(table(PullCluster$DatasetClean))
PullClusterTab = merge(PullClusterTab, DatasetOrig, by = "Var1")
PullClusterTab$Pct = PullClusterTab$Freq.x/PullClusterTab$Freq.y
PullClusterTab$PctNorm = PullClusterTab$Pct/sum(PullClusterTab$Pct)*100
PullClusterTab = PullClusterTab[order(-PullClusterTab$PctNorm), ]
DATA = as.data.frame(t(c(x, paste(paste(PullClusterTab$Var1, " [", round(PullClusterTab$Pct/sum(PullClusterTab$Pct)*100, digits = 2), "%]", sep=""), collapse = "; "))))
HypoMapDatasetCompile = rbind(HypoMapDatasetCompile, DATA)
}
View(HypoMapDatasetCompile)
View(MN_TopHits)