-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSupp_figures_paper_CB.R
795 lines (642 loc) · 31.7 KB
/
Supp_figures_paper_CB.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
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
#You may need to install the following packages
rm(list=ls())
library(dplyr)
library(ggplot2)
library(tidyr)
library(data.table)
library(magrittr)
library(stringr)
library(UpSetR)
library(readr)
library(readxl)
library(cowplot)
library(magrittr)
library(tidyverse)
library(readxl)
library(gridExtra)
library(growthcurver)
library(Cairo)
library(Hmisc)
library(nlme)
library(Matrix)
library(lme4)
library(ggpubr)
library(gtable)
library(grid.raster)
library(drc)
library(EDcomp)
library(reshape2)
library(broom)
library(modelr)
library(egg)
library(ggpubr)
library(rstatix)
library(aomisc)
library(HDPenReg)
#Put the path to the folder where all the .csv are:
setwd("")
################Figure S2################
#Number of generations
Generations <- read.csv("Fig_S2.csv")
#Generations Figure
toexpr<-function(x) {
getfun <- function(x) {
ifelse(x=="Hybrid", "plain", "italic")
}
as.expression(unname(Map(function(f,v) substitute(f(v), list(f=as.name(f), v=as.character(v))), getfun(x), x)))
}
stat.test <- aov(Generations ~ Specie, data = Generations) %>%
tukey_hsd()
stat_pvalue_manual(
stat.test, label = "p.adj",
y.position = c(0.7, 0.72, 0.74),
size=2.5
)
#in cm
FigS2 <- Generations %>% ggplot(., aes(x=as.factor(Specie), y=Generations, col=Specie)) +
geom_boxplot(outlier.shape = NA) + ylim(4.5,5.5) +
theme_minimal()+
xlab("Genotype") + ylab("Generations")+
theme(axis.title.x = element_text(size=12), axis.text.x = element_text(size = 8),
axis.title.y = element_text(size=12), axis.text.y = element_text(size = 10)) +
theme(legend.position="none",panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"), axis.ticks = element_line(colour="black"))+
stat_compare_means(method = "anova", label.y = 5.3, aes(label = ..p.format..), size=2.5) +
stat_pvalue_manual(
stat.test, label = "p.adj",
y.position = c(5.13, 5.17, 5.21),
size=2.5
) +
scale_color_manual(values=c("green4", "dodgerblue1", "#FF9999"),
labels = toexpr(c("S. cerevisiae", "S. paradoxus", "Hybrid"))) +
theme(legend.text.align = 0) + guides(color = guide_legend(title = "Genotype"))+
geom_jitter(position=position_jitter(0.2), size=0.6) +
theme(legend.text=element_text(size=12)) +
scale_x_discrete("Genotype", labels=expression(italic(S.cerevisiae), italic(S.paradoxus), Hybrid)) +
theme(legend.text=element_text(size=7), legend.title=element_text(size=8))
FigS2 <- FigS2 + guides(
color = guide_legend(
title = "Genotype",
override.aes = aes(label = "")
)
)
ggsave (plot = FigS2, filename = "FigS2.jpg", units = "cm", device = "jpg",width = 10, height = 10, dpi = 300)
ggsave (plot = FigS2, filename = "FigS2.pdf", units = "cm", device = "pdf",width = 10, height = 10, dpi = 300)
################Figure S3################
################Get Dataset################
fdata <- read.csv("Fig_S3A.csv")
fdata <- na.omit(fdata)
fdata$day <- as.numeric(fdata$day)
fdata$gen = (fdata$day)*5
fdata <- filter(fdata, day<22)
################Figure figuring out if variable OD at the end of each transfer################
fdata1 <- fdata %>%
dplyr::filter(strain!="White") %>%
group_by(day, strain, NQO, rep, plate, tecan, gen) %>%
dplyr::summarise(od = max(od),max_temp = max(time))
toexpr<-function(x) {
getfun <- function(x) {
ifelse(x=="Hybrid", "plain", "italic")
}
as.expression(unname(Map(function(f,v) substitute(f(v), list(f=as.name(f), v=as.character(v))), getfun(x), x)))
}
fdata1 <- filter(fdata1, NQO=="Yes")
A <- ggplot(fdata1, aes(interaction(as.numeric(gen)), od, colour=strain)) +
geom_boxplot() +
geom_point(position=position_jitterdodge(), size=0.7) +
scale_shape_manual(values=c(16, 1)) + theme_bw() +
theme(legend.position = "top", axis.title.x = element_text(size=12), axis.text.x = element_text(size = 10),
axis.title.y = element_text(size=12), axis.text.y = element_text(size = 10)) + theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")) +
theme(panel.border = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))+
xlab("Time (generations)") + ylab("OD (595 nm)") + scale_color_manual(values=c("green4", "dodgerblue1", "#FF9999"),
labels = toexpr(c("S. cerevisiae", "S. paradoxus", "Hybrid"))) +
theme(legend.text.align = 0) + guides(color = guide_legend(title = "Genotype", linetype = guide_legend(title = "UV mimetic (μM)"), override.aes=list(fill=NA)),
shape = guide_legend(title = "UV mimetic"), override.aes=list(fill=NA)) +
theme(legend.text=element_text(size=6), legend.title=element_text(size=7),
legend.direction = "horizontal", legend.box = "vertical") +
theme(legend.spacing.y = unit(-0.2, "cm"),
legend.margin=margin(0,0,0,0),
legend.box.margin=margin(0,0,-10,-10))
################Panel FigureS3B################
data <- read.csv("Fig_S3B.csv")
#Need to filter these data to choose the days:
#24 H CONTROL
control24 <- filter(data, Timing==24)
control24 <- filter(control24 , NQO_c==0)
#Graphic 4nqo 16 uM
nqo48 <- filter(data, Timing==48)
nqo48 <- filter(nqo48 , NQO_c==16)
nqo96 <- filter(data, Timing==96)
nqo96 <- filter(nqo96 , NQO_c==16)
fdata <- rbind(nqo96, nqo48)
fdata$Time <- as.numeric(fdata$Time)
fdata$hour = (fdata$Time)/3600
fdata <- filter(fdata, Strain!="White")
fdata <- fdata %>% mutate(strain = ifelse(Strain=="Parent", "2Spar", ifelse(Strain=="Diploid", "1Scer", ifelse(Strain=="Hybrid", "3Hybrid", FALSE))))
toexpr<-function(x) {
getfun <- function(x) {
ifelse(x=="Hybrid", "plain", "italic")
}
as.expression(unname(Map(function(f,v) substitute(f(v), list(f=as.name(f), v=as.character(v))), getfun(x), x)))
}
#Fig S3B in cm
D <- ggplot(fdata, aes(x=hour, y=DO, colour=strain, group=interaction(Replica,strain,Timing))) +
geom_line(aes(linetype = as.factor(Timing))) +
xlab("Time (h)") + ylab("OD (595 nm)") +theme_minimal()+
theme(axis.text.x = element_text(hjust = 1)) +
xlim(0,30)+
facet_grid(. ~ strain) +
theme_bw() + theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), legend.position = "top",
axis.line = element_line(colour = "black"),
strip.background = element_rect(fill = "white", color="white"),
strip.text.x = element_blank()) + scale_color_manual(values=c("green4", "dodgerblue1", "#FF9999"),
labels = toexpr(c("S. cerevisiae", "S. paradoxus", "Hybrid"))) +
scale_linetype_manual(values = c(1, 96), labels = c("1","2"))+
theme(axis.title.x = element_text(size=12), axis.text.x = element_text(size = 10),
axis.title.y = element_text(size=12), axis.text.y = element_text(size = 10))+
theme(legend.text.align = 0) + guides(color = guide_legend(title = "Genotype"),
linetype = guide_legend(title = "Round of dilution")) +
theme(legend.text=element_text(size=6), legend.title=element_text(size=7),
legend.direction = "horizontal", legend.box = "vertical") +
theme(legend.spacing.y = unit(-0.2, "cm"),
legend.margin=margin(0,0,0,0),
legend.box.margin=margin(0,0,-4,-4))
################Save Figure S3################
FIGS3 <- plot_grid(A,D, labels = c("A","B"), nrow = 2)
ggsave (plot = FIGS3, filename = "FigS3.jpg", units = "cm", device = "jpg",width = 20, height = 15, dpi = 300)
ggsave (plot = FIGS3, filename = "FigS3.pdf", units = "cm", device = "pdf",width = 20, height = 15, dpi = 300)
################Figure S4################
con <- read.csv("Fig_S4.csv")
table(con$note_fit, con$check)
con <- con %>% mutate(Final_perc_check=ifelse(check==TRUE, 0, Final_perc))
con <- con %>% mutate(Final_perc_check=ifelse(note_fit=="ERROR", 0, Final_perc_check))
################Figure S4A################
#FIGURE PANEL A
#Scer in cm
scer <- filter(con, strain== "1Scer")%>%
group_by(rep,strain) %>%
ggplot(aes(x=as.numeric(NQO_c), y=Final_perc_check, group=interaction(rep, strain)))+
geom_line(color="green4") +
geom_point(color="green4") +
theme(plot.title = element_text(size=22))+
ylim(0,100)+
labs(title="S. cerevisiae",x="UV mimetic (μM)", y = "Relative growth (%)")+
theme_classic() + theme(plot.title=element_text(face = "italic")) +
theme(axis.title.x = element_text(size=10), axis.text.x = element_text(size = 8),
axis.title.y = element_text(size=10), axis.text.y = element_text(size = 8))+
theme (plot.title = element_text(size = 8))
#Spar in cm
spar <- filter(con, strain== "2Spar")%>%
group_by(rep,strain) %>%
ggplot(aes(x=as.numeric(NQO_c), y=Final_perc_check, group=interaction(rep, strain)))+
geom_line(color="dodgerblue1") +
geom_point(color="dodgerblue1") +
ylim(0,100)+
labs(title="S. paradoxus",x="UV mimetic (μM)", y = "Relative growth (%)")+
theme_classic() + theme(plot.title=element_text(face = "italic")) +
theme(axis.title.x = element_text(size=10), axis.text.x = element_text(size = 8),
axis.title.y = element_text(size=10), axis.text.y = element_text(size = 8))+
theme (plot.title = element_text(size = 8))
#Hy in cm
hy <- filter(con, strain== "3Hybrid")%>%
group_by(rep,strain) %>%
ggplot(aes(x=as.numeric(NQO_c), y=Final_perc_check, group=interaction(rep, strain)))+
geom_line(color="#FF9999") +
geom_point(color="#FF9999") +
ylim(0,100)+
labs(title="Hybrid",x="UV mimetic (μM)", y = "Relative growth (%)")+
theme_classic() + theme(axis.title.x = element_text(size=10), axis.text.x = element_text(size = 8),
axis.title.y = element_text(size=10), axis.text.y = element_text(size = 8))+
theme (plot.title = element_text(size = 8))
figA <- grid.arrange(scer, spar, hy, nrow=3 )
################Figure S4B################
con <- filter(con, strain!="White")
#Remove the first p-value
toexpr<-function(x) {
getfun <- function(x) {
ifelse(x=="Hybrid", "plain", "italic")
}
as.expression(unname(Map(function(f,v) substitute(f(v), list(f=as.name(f), v=as.character(v))), getfun(x), x)))
}
box <- con %>%
ggplot(aes(interaction(as.numeric(NQO_c)), Final_perc_check, col=strain)) +
geom_boxplot(outlier.shape = NA)+
geom_point(position=position_jitterdodge(), size = 0.3) +
theme_classic() +
xlab("UV mimetic (μM)") + ylab("Relative growth (%)") +
theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
legend.position = "top", legend.text.align = 0,
strip.background = element_rect(fill = "white", color="white"),
strip.text.y = element_blank()) + scale_color_manual(values=c("green4", "dodgerblue1", "#FF9999"),
labels = toexpr(c("S. cerevisiae", "S. paradoxus", "Hybrid"))) +
guides(color = guide_legend(title = "Genotype")) +
theme(axis.title.x = element_text(size=10), axis.text.x = element_text(size = 8),
axis.title.y = element_text(size=10), axis.text.y = element_text(size = 8)) +
stat_compare_means(aes(label = ..p.format..), size=2, data = con %>% filter(NQO_c != 0)) + ylim(0,100) +
theme(legend.text=element_text(size=7), legend.title=element_text(size=8))
box1 <- box + guides(
color = guide_legend(
title = "Genotype",
override.aes = aes(label = "")
)
)
################Save Figure S4################
figA <- plot_grid(scer,spar,hy, labels = c("A","",""), nrow = 3)
box1 <- plot_grid(box1, labels = c("B"), nrow = 1)
figS4 <- plot_grid(figA, box1, ncol=2 )
ggsave (plot = figS4, filename = "FigS4.jpg", units = "cm", device = "jpg",width = 20, height = 15, dpi = 300)
ggsave (plot = figS4, filename = "FigS4.pdf", units = "cm", device = "pdf",width = 20, height = 15, dpi = 300)
################Figure S5################
################Figure S5################
fdata <- read.csv("Fig_2.csv")
fdata <- na.omit(fdata)
fdata$day <- as.numeric(fdata$day)
#remove days we do not have all time-points of the curves
fdata <- dplyr::filter(fdata, day!=1)
fdata <- dplyr::filter(fdata, day!=2)
fdata <- dplyr::filter(fdata, day!=11)
fdata <- dplyr::filter(fdata, day!=22)
fdata <- dplyr::filter(fdata, day!=23)
fdata$hour = (fdata$time)/3600
growth_rates <- fdata %>% group_by(strain, NQO, rep, day) %>%
dplyr::mutate(note_fit = SummarizeGrowth(hour, od)$vals$note,
rval = SummarizeGrowth(hour, od)$vals$r,
kval = SummarizeGrowth(hour, od)$vals$k,
tmid = SummarizeGrowth(hour, od)$vals$t_mid,
aucexp = SummarizeGrowth(hour, od)$vals$auc_l,
max_size = max(od)) %>%
mutate(note_fit = ifelse(note_fit=="", "OK", "ERROR")) %>%
slice(1) %>%
ungroup()
gr <- dplyr::filter(growth_rates, note_fit=="OK")
gr <- dplyr::filter(growth_rates, strain!="White")
fdataAREA <- gr
################Panel S5A################
#Figure in control conditions during exp evolution
fig0 <- filter(fdataAREA, day == "3")
fig0 <- filter(fig0, NQO == "No")
fig0a <- filter(fdataAREA, day == "21")
fig0a <- filter(fig0a, NQO == "No")
fig0 <- rbind(fig0, fig0a)
my_comparisons2 <- list( c("1Scer.3", "1Scer.21"),c("2Spar.3", "2Spar.21"),c("3Hybrid.3", "3Hybrid.21"))
fig0$strain_day <- paste(fig0$strain,".", fig0$day)
#Fig S5 in cm
fig0$strain_day <- paste(fig0$strain,".", fig0$day)
FigS5 <- fig0 %>% mutate(strain_day = as.character(interaction (fig0$strain, fig0$day))) %>%
mutate(strain_day=factor(strain_day, levels= c("1Scer.3", "1Scer.21", "2Spar.3", "2Spar.21", "3Hybrid.3", "3Hybrid.21"))) %>%
ggplot(., aes(x=as.factor(strain_day), y=rval, col=strain)) +
geom_boxplot(outlier.shape = NA) +
theme_minimal()+
xlab("Generation") + ylab("Growth rate (OD/hour)")+
ggtitle("Growth in YPD during experimental evolution")+
ylim(0,1.1) +
scale_x_discrete(breaks=c("1Scer.3","1Scer.21","2Spar.3","2Spar.21","3Hybrid.3","3Hybrid.21"), labels=c("T15","T100","T15","T100","T15","T100"))+
theme(legend.position = "top",axis.title.x = element_text(size=12), axis.text.x = element_text(size = 10),
axis.title.y = element_text(size=12), axis.text.y = element_text(size = 10)) +
theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"), axis.ticks = element_line(colour="black"))+
stat_compare_means(aes(group = strain_day), comparisons= my_comparisons2, method = "t.test", label.y = 0.85, paired = TRUE, label="p.format", size = 2.5) +
scale_color_manual(values=c("green4", "dodgerblue1", "#FF9999"),
labels = toexpr(c("S. cerevisiae", "S. paradoxus", "Hybrid"))) +
theme(legend.text.align = 0) + guides(color = guide_legend(title = "Genotype"))+
geom_jitter(position=position_jitter(0.2), size=0.4)+
theme(plot.title = element_text(size = 9, hjust = 0.5))+
theme(legend.text=element_text(size=7), legend.title=element_text(size=8))
################Fig S5B################
fdata <- read.csv("Fig_3.csv")
#Remove NA data
fdata <- na.omit(fdata)
fdata$hour = (fdata$time)/3600
growth_rates <- fdata %>% group_by(strain, NQO, rep, day, gen) %>%
dplyr::mutate(note_fit = SummarizeGrowth(hour, od)$vals$note,
rval = SummarizeGrowth(hour, od)$vals$r,
kval = SummarizeGrowth(hour, od)$vals$k,
tmid = SummarizeGrowth(hour, od)$vals$t_mid,
aucexp = SummarizeGrowth(hour, od)$vals$auc_l,
max_size = max(od)) %>%
mutate(note_fit = ifelse(note_fit=="", "OK", "ERROR")) %>%
slice(1) %>%
ungroup()
gr <- filter(growth_rates, note_fit=="OK")
#To know the replicates
Scer <- filter(gr, strain=="1Scer")
Scer <- filter(Scer, NQO=="No")
Scer <- filter(Scer, gen=="0")
Sp <- filter(gr, strain=="2Spar")
Sp <- filter(Sp, NQO=="No")
Sp <- filter(Sp, gen=="0")
H <- filter(gr, strain=="3Hybrid")
H <- filter(H, NQO=="No")
H <- filter(H, gen=="0")
################Panel S5B###############
gr_1 <- filter(gr, rep!="31")
gr_1 <- filter(gr_1, rep!="32")
my_comparisons1 <- list( c("0.2Spar", "200.2Spar"),
c("0.3Hybrid", "200.3Hybrid"),
c("0.1Scer", "200.1Scer"))
toexpr<-function(x) {
getfun <- function(x) {
ifelse(x=="Hybrid", "plain", "italic")
}
as.expression(unname(Map(function(f,v) substitute(f(v), list(f=as.name(f), v=as.character(v))), getfun(x), x)))
}
gr_1 <- filter(gr_1 , NQO=="No")
FigS5B <- gr_1 %>% ggplot(aes(interaction(gen, strain),rval, col=strain)) +
geom_boxplot(outlier.shape = NA) + theme_classic()+
ylim(0,1.1)+
scale_x_discrete(breaks=c("0.1Scer", "200.1Scer","0.2Spar", "200.2Spar","0.3Hybrid", "200.3Hybrid"),labels=c("Ancestor","T100","Ancestors","T100","Ancestors","T100"))+
ggtitle("Growth in YPD after experimental evolution in UV mimetic")+
stat_compare_means(comparisons = my_comparisons1, method="t.test", label.y = c(0.9,0.9,0.9), size=2.5, paired = TRUE) +
theme(legend.position = "top", panel.border = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))+
xlab("Generation") + ylab("Growth rate (OD/hour)") + scale_color_manual(values=c("green4", "dodgerblue1", "#FF9999"),
labels = toexpr(c("S. cerevisiae", "S. paradoxus", "Hybrid"))) +
theme(legend.text.align = 0) + guides(color = guide_legend(title = "Genotype")) +
theme(axis.title.x = element_text(size=12), axis.text.x = element_text(size = 10),
axis.title.y = element_text(size=12), axis.text.y = element_text(size = 10))+
geom_jitter(position=position_jitter(0.2), size=0.4) +
theme(legend.text=element_text(size=12))+
theme(plot.title = element_text(size = 9, hjust = 0.5))+
theme(legend.text=element_text(size=7), legend.title=element_text(size=8))
################Save Figure S5################
figS5 <- plot_grid(FigS5,FigS5B, labels = c("A","B"), nrow = 1)
figS5
ggsave (plot = figS5, filename = "FigS5.jpg", units = "cm", device = "jpg",width = 20, height = 10, dpi = 300)
ggsave (plot = figS5, filename = "FigS5.pdf", units = "cm", device = "pdf",width = 20, height = 10, dpi = 300)
################Figure S6################
con <- read.csv("Fig_S6.csv")
#Fig Scer in cm
scer <- filter(con, strain== "1Scer")%>%
group_by(rep,evol,strain,curve) %>%
ggplot(aes(x=as.numeric(NQO_c), y=Final_perc_check, shape=evol, group=interaction(rep, evol,strain,curve), linetype=evol)) +
geom_line(color="green4") +
geom_point(color="green4") +
ylim(0,100)+
scale_shape_manual(values=c(20, 1)) +
scale_linetype_manual(values=c("solid", "dashed")) +
labs(title="S. cerevisiae",x="UV mimetic (μM)", y = "Relative growth (%)")+
theme_classic() + theme(plot.title=element_text(face = "italic")) +
theme(axis.title.x = element_text(size=14), axis.text.x = element_text(size = 12),
axis.title.y = element_text(size=14), axis.text.y = element_text(size = 12)) +
guides(linetype = guide_legend(title = "Evolved in:"), shape = FALSE)
#Fig Spar in cm
spar <- filter(con, strain== "2Spar")%>%
group_by(rep,evol,strain,curve) %>%
ggplot(aes(x=as.numeric(NQO_c), y=Final_perc_check, shape=evol, group=interaction(rep, evol,strain,curve), linetype=evol))+
geom_line(color="dodgerblue1") +
geom_point(color="dodgerblue1") +
ylim(0,100)+
scale_shape_manual(values=c(20, 1)) +
scale_linetype_manual(values=c("solid", "dashed")) +
labs(title="S. paradoxus",x="UV mimetic (μM)", y = "Relative growth (%)")+
theme_classic() + theme(plot.title=element_text(face = "italic")) +
theme(axis.title.x = element_text(size=14), axis.text.x = element_text(size = 12),
axis.title.y = element_text(size=14), axis.text.y = element_text(size = 12)) +
guides(linetype = guide_legend(title = "Evolved in:"), shape = FALSE)
#Hybrid in cm
hy <- filter(con, strain== "3Hybrid")%>%
group_by(rep,evol,strain,curve) %>%
ggplot(aes(x=as.numeric(NQO_c), y=Final_perc_check, shape=evol, group=interaction(rep, evol,strain,curve), linetype=evol))+
geom_line(color="#FF9999") +
geom_point(color="#FF9999") +
ylim(0,100)+
scale_shape_manual(values=c(20, 1)) +
scale_linetype_manual(values=c("solid", "dashed")) +
labs(title="Hybrid",x="UV mimetic (μM)", y = "Relative growth (%)")+
theme_classic() +
theme(axis.title.x = element_text(size=14), axis.text.x = element_text(size = 12),
axis.title.y = element_text(size=14), axis.text.y = element_text(size = 12)) +
guides(linetype = guide_legend(title = "Evolved in:"), shape = FALSE)
################Save Figure S6##############
figS6 <- plot_grid(scer,spar,hy, labels = c("","",""), nrow = 3)
ggsave (plot = figS6, filename = "FigS6.jpg", units = "cm", device = "jpg",width = 15, height = 20, dpi = 300)
ggsave (plot = figS6, filename = "FigS6.pdf", units = "cm", device = "pdf",width = 15, height = 20, dpi = 300)
################Figure S7################
#Graph correlation coefficients through time by replicate
correlation_graph <- read.csv("Fig_S7.csv")
correlation_graph <- correlation_graph %>% mutate(gen= day*5)
toexpr<-function(x) {
getfun <- function(x) {
ifelse(x=="Hybrid", "plain", "italic")
}
as.expression(unname(Map(function(f,v) substitute(f(v), list(f=as.name(f), v=as.character(v))), getfun(x), x)))
}
#Fig S7 in cm
FigS7 <- correlation_graph %>%
ggplot(., aes(gen, corr, colour=strain, shape=NQO, linetype=NQO)) +
geom_point() +
scale_linetype_manual(values=c("solid","dotted")) +
scale_shape_manual(values=c(16, 1))+
theme_classic()+
theme(legend.position = "top",panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))+
ylim(-1, 1) +
scale_color_manual(values=c("green4", "dodgerblue1", "#FF9999"),
labels = toexpr(c("S. cerevisiae", "S. paradoxus", "Hybrid"))) +
theme(legend.text.align = 0) + guides(color = guide_legend(title = "Genotype"), shape = guide_legend(title = "UV mimetic"), linetype=FALSE) +
stat_smooth(method="lm", se=FALSE) + labs(y="r/K correlation", x = "Time (generations)") +
theme(axis.title.x = element_text(size=12), axis.text.x = element_text(size = 10),
axis.title.y = element_text(size=12), axis.text.y = element_text(size = 10)) +
guides(color = guide_legend(title = "Genotype",
override.aes=list(fill=NA)),
linetype = guide_legend(title = "UV mimetic",
override.aes=list(fill=NA)),
shape = guide_legend(title = "UV mimetic", override.aes=list(colour="black"))) +
theme(legend.text=element_text(size=5), legend.title=element_text(size=6),
legend.direction = "horizontal", legend.box = "vertical") +
theme(legend.spacing.y = unit(-0.2, "cm"),
legend.margin=margin(0,0,0,0),
legend.box.margin=margin(0,0,-4,-4))
FigS7 <- FigS7 + geom_hline(yintercept=0, linetype="dashed", color = "black")
FigS7
ggsave (plot = FigS7, filename = "FigS7.jpg", units = "cm", device = "jpg",width = 15, height = 10, dpi = 300)
ggsave (plot = FigS7, filename = "FigS7.pdf", units = "cm", device = "pdf",width = 15, height = 10, dpi = 300)
################FigureS8################
#Fitness_cost
################Get Dataset with growth rate################
fdata <- read.csv("Fig_3.csv")
fdata$hour = (fdata$time)/3600
growth_rates <- fdata %>% group_by(strain, NQO, rep, gen) %>%
dplyr::mutate(note_fit = SummarizeGrowth(hour, od)$vals$note,
rval = SummarizeGrowth(hour, od)$vals$r,
kval = SummarizeGrowth(hour, od)$vals$k,
tmid = SummarizeGrowth(hour, od)$vals$t_mid,
aucexp = SummarizeGrowth(hour, od)$vals$auc_l,
max_size = max(od)) %>%
mutate(note_fit = ifelse(note_fit=="", "OK", "ERROR")) %>%
slice(1) %>%
ungroup()
gr <- filter(growth_rates, note_fit=="OK")
################Need to figure S8################
#Filter gen 200 evolved in NQO
fig200 <- filter(gr, gen == "200")
fig0 <- filter(fig200, NQO == "Yes")
fig0 <- arrange(fig0, rep, strain,day, NQO, gen)
#Filter ancestors
fig0a <- filter(gr, gen == "0")
fig0a <- arrange(fig0a, rep, strain,day)
#Remove two replicas were not evolved
fig0a <- filter(fig0a, rep!=31)
fig0a <- filter(fig0a, rep!=32)
fig0a <- arrange(fig0a, rep, strain,day, NQO, gen)
#Change
fig0$subs = ((fig0$rval) - (fig0a$rval))
################Figure S8################
#cost: growth in ypd at t0 versus growth in ypd at t final)
#Adaptation:
#subtracting the growth in UV mimetic conditions at T0 from the growth in UV mimetic at T200
#T200 evolved in 4-NQO (in 4-NQO conditions) - T0 ancestors (in 4-NQO conditions)
#Cost values:
#subtracting the growth in control of strains evolved in UV mimetic (T200) from the growth in control at T0
#T200 evolved in 4-NQO (in control conditions) - T0 ancestors (in control conditions)
#Reload the dataset from EXPEVOL (Figure 2)
fdata <- read.csv("Fig_2.csv")
fdata <- na.omit(fdata)
fdata <- dplyr::filter(fdata, day!=1)
fdata <- dplyr::filter(fdata, day!=2)
fdata <- dplyr::filter(fdata, day!=11)
fdata <- dplyr::filter(fdata, day!=22)
fdata <- dplyr::filter(fdata, day!=23)
fdata$hour = (fdata$time)/3600
growth_rates_adap <- fdata %>% group_by(strain, NQO, rep, day) %>%
dplyr::mutate(note_fit = SummarizeGrowth(hour, od)$vals$note,
rval = SummarizeGrowth(hour, od)$vals$r,
kval = SummarizeGrowth(hour, od)$vals$k,
tmid = SummarizeGrowth(hour, od)$vals$t_mid,
aucexp = SummarizeGrowth(hour, od)$vals$auc_l,
max_size = max(od)) %>%
mutate(note_fit = ifelse(note_fit=="", "OK", "ERROR")) %>%
slice(1) #%>% ungroup()
gradap <- dplyr::filter(growth_rates_adap, note_fit=="OK")
gradap <- dplyr::filter(gradap, strain!="White")
fdataAREA <- gradap
#Calculated adap coefficients:
#Adaptation:
#subtracting the growth in UV mimetic conditions at T0 from the growth in UV mimetic at T200
#T200 evolved in 4-NQO (in 4-NQO conditions) - T0 ancestors (in 4-NQO conditions)
#%adap= rvalT200 - rvaT0
NQO <- filter(gradap, NQO=="Yes")
NQO$rep <- NQO$rep
NQO$rep <- as.numeric(NQO$rep)
NQO_3 <- filter(NQO, day=="3")
NQO_21 <- filter(NQO, day=="21")
NQO_3 <- NQO_3 %>% arrange(rep)
NQO_21 <- NQO_21 %>% arrange(rep)
NQO_21$adap = (NQO_21$rval - NQO_3$rval) / NQO_21$rval
#######(cost: growth in ypd at t0 versus growth in ypd at t final)
#Cost values:
#subtracting the growth in control of strains evolved in UV mimetic (T200) from the growth in control at T0
#T200 evolved in 4-NQO (in control conditions) - T0 ancestors (in control conditions)
gen0 <- filter(gr, gen=="0")
gen0 <- filter(gen0, rep!="31")
gen0 <- filter(gen0, rep!="32")
#growth in ypd after 200 gen in NQO
gen200 <- filter(gr, gen=="200")
gen200 <- filter(gen200, NQO=="Yes") ###!= negar algo
gen0$rep <- as.numeric(gen0$rep)
gen0 <- gen0 %>% arrange(rep)
gen200$rep <- as.numeric(gen200$rep)
gen200 <- gen200 %>% arrange(rep)
gen200$cost = (gen0$rval - gen200$rval) / gen0$rval
gen200 <- gen200 %>%
rename(repi = rep)
NQO_21 <- NQO_21 %>%
rename(repi = rep)
ALL <- inner_join(x=gen200, y=NQO_21, by=c("strain"="strain","NQO"="NQO","rep"="rep"))
toexpr<-function(x) {
getfun <- function(x) {
ifelse(x=="Hybrid", "plain", "italic")
}
as.expression(unname(Map(function(f,v) substitute(f(v), list(f=as.name(f), v=as.character(v))), getfun(x), x)))
}
#Fig S8 in cm
FigS8 <- ggscatter(ALL, x = "adap", y = "cost", group = "strain",color ="strain",
add = "reg.line", # Add regressin line,
add.params = list(color = "blue", fill = "lightgray"), # Customize reg. line
conf.int = FALSE) + stat_cor(method = "spearman", size=4, label.y = 0.34) + xlab("Cost (%)") + ylab("Adaptation (%)") +
theme(panel.border = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))+
xlab("Adaptation rates (OD/hour)") + ylab("Trade-off (OD/hour)") + scale_color_manual(values=c("green4", "dodgerblue1", "#FF9999"),
labels = toexpr(c("S. cerevisiae", "S. paradoxus", "Hybrid"))) +
theme(legend.text.align = 0) + guides(color = guide_legend(title = "Genotype")) +
theme(axis.title.x = element_text(size=14), axis.text.x = element_text(size = 12),
axis.title.y = element_text(size=14), axis.text.y = element_text(size = 12)) +
theme(legend.text=element_text(size=9), legend.title=element_text(size=10))+
theme(legend.spacing.y = unit(-0.2, "cm"),
legend.margin=margin(0,0,0,0),
legend.box.margin=margin(0,0,-4,-4))+
scale_x_continuous(breaks = scales::pretty_breaks(n = 5))
################Save Figure S8################
ggsave (plot = FigS8, filename = "FigS8.jpg", units = "cm", device = "jpg",width = 20, height = 15, dpi = 300)
ggsave (plot = FigS8, filename = "FigS8.pdf", units = "cm", device = "pdf",width = 20, height = 15, dpi = 300)
################Table S3################
#Data
fdata <- read.csv("Fig_2.csv")
fdata <- fdata %>%
dplyr::filter(strain!="White", day>2) %>%
group_by(day, strain, NQO, rep, plate, tecan, time) %>%
dplyr::summarise(od = max(od),max_temp = max(time))
fdata <- dplyr::filter(fdata, day!=1)
fdata <- dplyr::filter(fdata, day!=2)
fdata <- dplyr::filter(fdata, day!=11)
fdata <- dplyr::filter(fdata, day!=22)
fdata <- dplyr::filter(fdata, day!=23)
fdata$hour = (fdata$time)/3600
growth_rates <- fdata %>% group_by(strain, NQO, rep, day) %>%
dplyr::mutate(note_fit = SummarizeGrowth(hour, od)$vals$note,
rval = SummarizeGrowth(hour, od)$vals$r,
kval = SummarizeGrowth(hour, od)$vals$k,
tmid = SummarizeGrowth(hour, od)$vals$t_mid,
aucexp = SummarizeGrowth(hour, od)$vals$auc_l,
max_size = max(od)) %>%
mutate(note_fit = ifelse(note_fit=="", "OK", "ERROR")) %>%
slice(1) %>%
ungroup() #%>%
#select(strain, NQO, rep, day, time, note_fit,rval, kval,tmid,aucexp, max_size, od, plate)
gr <- dplyr::filter(growth_rates, note_fit=="OK")
gr <- dplyr::filter(gr, strain!="White")
fdataAREA <- gr
fdataAREA <- filter(fdataAREA, rval<5)
nitro1 <- filter(fdataAREA, NQO=="Yes")
nitro1 <- nitro1 %<>% mutate(strain=ifelse(strain=="1Scer", "Scer",
ifelse(strain=="2Spar", "Spar",
ifelse(strain=="3Hybrid", "Hybrid", NA))))
#Linear model
linear = lm(rval ~ day*strain,
data = nitro1)
summary(linear)
################Table S4################
#Logarithmic model
logarithmic <- drm(rval ~ day,strain, fct = DRC.logCurve(),
data = nitro1)
summary(logarithmic)
compParm(logarithmic, "b", "-")
################Table S5################
#Asymptotic model
asymptotic <- drm(rval ~ day, strain, fct = AR.3(), data = nitro1)
coef(asymptotic)
summary(asymptotic)
compParm(asymptotic, "c", "-")
compParm(asymptotic, "d", "-")
################Table S2################
#AIC
linear = lm(rval ~ day*strain, data = nitro1)
asymptotic <- drm(rval ~ day, strain, fct = AR.3(), data = nitro1)
logarithmic <- drm(rval ~ day,strain, fct = DRC.logCurve(), data = nitro1)
AICc_1 <- AIC(linear)
AICc_2 <- AIC(asymptotic)
AICc_8 <- AIC(logarithmic)
Results <- data.frame(Model = c("Linear",
"Asymptotic",
"Logarithmic"))
Results$AICc <- c(AICc_1, AICc_2, AICc_8)
Results$Delta_AICc <- Results$AICc-min(Results$AICc)
Results$ModelLik <- exp(-0.5*Results$Delta_AICc)
Results$AICcWt <- Results$ModelLik/sum(Results$ModelLik)
AICctable <- Results[rev(order(Results$AICcWt)), ]
AICctable