-
Notifications
You must be signed in to change notification settings - Fork 1
/
.Rhistory
512 lines (512 loc) · 34.4 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
points(exp_data$aMG[!filter], exp_data$qACE[!filter], pch=22, bg="#A9D18E", col="black", cex=1.4, lwd=1.0)
data_to_save <- exp_data[,c("strain", "carbon_source", "aMG", "ACE", "qACE", "source")]
write.csv(data_to_save, "results/SourceData/Figure 2/2F/data_2F.csv", quote=FALSE)
x <- seq(20, 100, by=2)
plot_with_ci_5(simulation_results, 1, x, "Values[v_growth_rate]", col = "#B63A2D", las = 1, lwd = 1.2, ylim = c(0, 0.7), xlab = "Glycolytic activity (%)", ylab = "Growth rate (h-1)", yaxs="i")
plot_with_ci_5( simulation_results, 2, x, "Values[v_growth_rate]", col = "#E49890", add_to_plot = TRUE, lwd = 1.2)
data_to_save <- cbind(apply(simulation_results[,,1,"Values[v_growth_rate]"], 2, mean),
apply(simulation_results[,,1,"Values[v_growth_rate]"], 2, sd),
apply(simulation_results[,,2,"Values[v_growth_rate]"], 2, mean),
apply(simulation_results[,,2,"Values[v_growth_rate]"], 2, sd))
colnames(data_to_save) <- c("mean_ace_0", "sd_ace_0", "mean_ace_30", "sd_ace_30")
rownames(data_to_save) <- glc_vmax/max(glc_vmax)*100
write.csv(data_to_save, "results/SourceData/Figure 2/2C/data_2C.csv", quote=FALSE)
# fit polynomial model
polyfit_no_ace <- polynomial_model(exp_data[filter,], "aMG", "mu", 2, lpred=seq(0,100,by=0.1))
polyfit_ace <- polynomial_model(exp_data[!filter,], "aMG", "mu", 2, lpred=seq(0,100,by=0.1))
# plot fit and confidence intervals
plot(polyfit_no_ace$fited_curve_x, polyfit_no_ace$fited_curve_y, ylim=c(0,0.7), las=1, yaxs="i", ylab="growth rate (h-1)", xlab="[aMG] (mM)", col="#B63A2D", lwd=1.5, type="l")
lines(polyfit_ace$fited_curve_x, polyfit_ace$fited_curve_y, col="#E49890", lwd=1.5)
#polygon(c(polyfit_no_ace$fited_curve_x, rev(polyfit_no_ace$fited_curve_x)), c(polyfit_no_ace$confidence_intervals[,1], rev(polyfit_no_ace$confidence_intervals[,2])), col=adjustcolor("#B63A2D", alpha.f=0.4), border = NA)
#polygon(c(polyfit_ace$fited_curve_x, rev(polyfit_ace$fited_curve_x)), c(polyfit_ace$confidence_intervals[,1], rev(polyfit_ace$confidence_intervals[,2])), col=adjustcolor("#E49890", alpha.f=0.4), border = NA)
# plot experimental data
points(exp_data$aMG[filter], exp_data$mu[filter], lwd=1.0, pch=21, bg="#B63A2D", col="black", cex=1.4)
points(exp_data$aMG[!filter], exp_data$mu[!filter], pch=22, bg="#E49890", col="black", cex=1.4, lwd=1.0)
data_to_save <- exp_data[,c("strain", "carbon_source", "aMG", "ACE", "mu", "source")]
write.csv(data_to_save, "results/SourceData/Figure 2/2G/data_2G.csv", quote=FALSE)
x <- seq(20, 100, by=2)
plot_with_ci_5(simulation_results, 1, x, "Total_C_uptake", col="#451E5D", las=1, lwd=1.2, ylim=c(0,60), xlab="Glycolytic activity (%)", ylab="Total C uptake (mmol/gDW/h)", yaxs="i")
plot_with_ci_5(simulation_results, 2, x, "Total_C_uptake", col="#C89CE4", add_to_plot = TRUE, lwd=1.2)
data_to_save <- cbind(apply(simulation_results[,,1,"Total_C_uptake"], 2, mean),
apply(simulation_results[,,1,"Total_C_uptake"], 2, sd),
apply(simulation_results[,,2,"Total_C_uptake"], 2, mean),
apply(simulation_results[,,2,"Total_C_uptake"], 2, sd))
colnames(data_to_save) <- c("mean_ace_0", "sd_ace_0", "mean_ace_30", "sd_ace_30")
rownames(data_to_save) <- glc_vmax/max(glc_vmax)*100
write.csv(data_to_save, "results/SourceData/Figure 2/2D/data_2D.csv", quote=FALSE)
# fit polynomial model
polyfit_no_ace <- polynomial_model(exp_data[filter,], "aMG", "Ctotal", 2, lpred=seq(0,100,by=0.1))
polyfit_ace <- polynomial_model(exp_data[!filter,], "aMG", "Ctotal", 2, lpred=seq(0,100,by=0.1))
# plot fit and confidence intervals
plot(polyfit_no_ace$fited_curve_x, polyfit_no_ace$fited_curve_y, ylim=c(0, 60), las=1, yaxs="i", ylab="total carbon uptake (mmol/gDW/h)", xlab="[aMG] (mM)", col="#451E5D", lwd=1.5, type="l")
lines(polyfit_ace$fited_curve_x, polyfit_ace$fited_curve_y, col="#C89CE4", lwd=1.5)
#polygon(c(polyfit_no_ace$fited_curve_x, rev(polyfit_no_ace$fited_curve_x)), c(polyfit_no_ace$confidence_intervals[,1], rev(polyfit_no_ace$confidence_intervals[,2])), col=adjustcolor("#451E5D", alpha.f=0.4), border = NA)
#polygon(c(polyfit_ace$fited_curve_x, rev(polyfit_ace$fited_curve_x)), c(polyfit_ace$confidence_intervals[,1], rev(polyfit_ace$confidence_intervals[,2])), col=adjustcolor("#C89CE4", alpha.f=0.4), border = NA)
# plot experimental data
points(exp_data$aMG[filter], exp_data$Ctotal[filter], lwd=1.0, pch=21, bg="#451E5D", col="black", cex=1.4)
points(exp_data$aMG[!filter], exp_data$Ctotal[!filter], pch=22, bg="#C89CE4", col="black", cex=1.4, lwd=1.0)
data_to_save <- exp_data[,c("strain", "carbon_source", "aMG", "ACE", "Ctotal", "source")]
write.csv(data_to_save, "results/SourceData/Figure 2/2H/data_2H.csv", quote=FALSE)
# fit polynomial model
polyfit <- polynomial_model(exp_data[filter,], "qGLC", "Ctotal", 1, lpred=seq(0,12,by=0.01))
# plot fit
plot(polyfit$fited_curve_x, polyfit$fited_curve_y, ylim=c(0, 60), xlim=c(0,12), las=1, yaxs="i", ylab="total carbon uptake (mmol/gDW/h)", xlab="Glucose uptake (mmol/gDW/h)", col="#C45818", lwd=1.5, type="l")
# plot experimental data
points(exp_data$qGLC[filter], exp_data$Ctotal[filter], lwd=1.0, pch=21, bg="#C45818", col="black", cex=1.4)
polyfit <- polynomial_model(exp_data[!filter,], "qGLC", "Ctotal", 1, lpred=seq(0,15,by=0.01))
lines(polyfit$fited_curve_x, polyfit$fited_curve_y, col="#FEA500", lwd=1.5)
points(exp_data$qGLC[!filter], exp_data$Ctotal[!filter], lwd=1.0, pch=22, bg="#FEA500", col="black", cex=1.4)
data_to_save <- exp_data[,c("strain", "carbon_source", "aMG", "ACE", "Ctotal", "qGLC", "source")]
write.csv(data_to_save, "results/SourceData/Figure 2/2K/data_2K.csv", quote=FALSE)
# fit polynomial model
polyfit <- polynomial_model(exp_data[filter,], "qGLC", "mu", 1, lpred=seq(0,12,by=0.01))
# plot fit
plot(polyfit$fited_curve_x, polyfit$fited_curve_y, ylim=c(0, 0.7), xlim=c(0,12), las=1, yaxs="i", ylab="mu (h-1)", xlab="Glucose uptake (mmol/gDW/h)", col="#C45818", lwd=1.5, type="l")
# plot experimental data
points(exp_data$qGLC[filter], exp_data$mu[filter], lwd=1.0, pch=21, bg="#C45818", col="black", cex=1.4)
polyfit <- polynomial_model(exp_data[!filter,], "qGLC", "mu", 1, lpred=seq(0,15,by=0.01))
lines(polyfit$fited_curve_x, polyfit$fited_curve_y, col="#FEA500", lwd=1.5)
points(exp_data$qGLC[!filter], exp_data$mu[!filter], lwd=1.0, pch=22, bg="#FEA500", col="black", cex=1.4)
data_to_save <- exp_data[,c("strain", "carbon_source", "aMG", "ACE", "mu", "qGLC", "source")]
write.csv(data_to_save, "results/SourceData/Figure 2/2L/data_2L.csv", quote=FALSE)
# fit polynomial model
polyfit <- polynomial_model(exp_data, "qGLC", "qACE", 2, lpred=seq(0,10,by=0.01))
# note: to avoid a bug on windows platforms when the plotted polygon is bigger than the plot, see https://bugs.r-project.org/show_bug.cgi?id=18219
#polyfit$confidence_intervals[polyfit$confidence_intervals > 3] <- 3
#polyfit$confidence_intervals[polyfit$confidence_intervals < -11] <- -11
# plot fit and confidence intervals
plot(polyfit$fited_curve_x, polyfit$fited_curve_y, ylim=c(-11, 4), las=1, yaxs="i", ylab="qACE (mmol/gDW/h)", xlab="qGLC (mmol/gDW/h)", col="#BF9000", lwd=1.5, type="l", yaxs="i")
abline(h=0)
#polygon(c(polyfit$fited_curve_x, rev(polyfit$fited_curve_x)), c(polyfit$confidence_intervals[,1], rev(polyfit$confidence_intervals[,2])), col=adjustcolor("#BF9000", alpha.f=0.4), border = NA)
# plot experimental data
points(exp_data$qGLC[filter], exp_data$qACE[filter], lwd=1.0, pch=22, bg="#FFE699", col="black", cex=1.4)
points(exp_data$qGLC[!filter], exp_data$qACE[!filter], lwd=1.0, pch=21, bg="#BF9000", col="black", cex=1.4)
data_to_save <- exp_data[,c("strain", "carbon_source", "qACE", "Ctotal", "source")]
write.csv(data_to_save, "results/SourceData/Figure 2/2I/data_2I.csv", quote=FALSE)
# fit polynomial model
polyfit <- polynomial_model(exp_data, "qGLC", "contribution_acetate", 2, lpred=seq(0,10,by=0.01))
# note: to avoid a bug on windows platforms when the plotted polygon is bigger than the plot, see https://bugs.r-project.org/show_bug.cgi?id=18219
#polyfit$confidence_intervals[polyfit$confidence_intervals > 60] <- 60
#polyfit$confidence_intervals[polyfit$confidence_intervals < -20] <- -20
# plot fit and confidence intervals
plot(polyfit$fited_curve_x, polyfit$fited_curve_y, ylim=c(-20, 60), las=1, yaxs="i", ylab="acetate contribution to C uptake (%)", xlab="qGLC (mmol/gDW/h)", col="#BF9000", lwd=1.5, type="l")
abline(h=0)
#polygon(c(polyfit$fited_curve_x, rev(polyfit$fited_curve_x)), c(polyfit$confidence_intervals[,1], rev(polyfit$confidence_intervals[,2])), col=adjustcolor("#BF9000", alpha.f=0.4), border = NA)
# plot experimental data
points(exp_data$qGLC[filter], exp_data$contribution_acetate[filter], lwd=1.0, pch=22, bg="#FFE699", col="black", cex=1.4)
points(exp_data$qGLC[!filter], exp_data$contribution_acetate[!filter], lwd=1.0, pch=21, bg="#BF9000", col="black", cex=1.4)
data_to_save <- exp_data[,c("strain", "carbon_source", "aMG", "qGLC", "contribution_acetate", "source")]
write.csv(data_to_save, "results/SourceData/Figure 2/2J/data_2J.csv", quote=FALSE)
loadModel("model/Millard2020_Ecoli_glc_ace_kinetic_model_sensitivity_analysis.cps")
# remove events and fix concentrations of actate, glucose and biomass
deleteEvent(getEvents()$key)
setSpecies(key="Ace_out", type="fixed")
setSpecies(key="Glc", type="fixed")
setSpecies(key="X", type="fixed")
load("results/MonteCarloSimulations/mc_sim_2_500.RData")
xlab_main <- c(0.1, 1, 10, 100)
xlab_sec <- c(seq(0.2, 0.9, by=0.1), seq(2, 9, by=1), seq(20, 90, by=10))
cols <- sequential_hcl(6, "blues3")
plot_with_ci_4(res_e2[,1,,], "ace_concentration", "Values[v_ace_net]", col=cols[1], xaxt='n', las=1, lwd=1.5, xlim=c(0.1,100), ylim=c(-5,5), log="x", xlab="[acetate] (mM)", ylab="growth rate (h-1)")
abline(h=0)
for (i in seq(1, 5)){
plot_with_ci_4(res_e2[,i,,], "ace_concentration", "Values[v_ace_net]", col=cols[i], add_to_plot=TRUE, lwd=1.5)
}
axis(side = 1, at = xlab_main, labels = TRUE)
axis(side = 1, at = xlab_sec, labels = FALSE, tcl=-0.3)
data_to_save <- apply(res_e2[,1,,"ace_concentration"], 2, mean)
for (i in seq(5)){
data_to_save <- cbind(data_to_save,
apply(res_e2[,i,,"Values[v_ace_net]"], 2, mean),
apply(res_e2[,i,,"Values[v_ace_net]"], 2, sd))
}
colnames(data_to_save) <- c("ace_concentration",
"qACE_mean_glc=20%", "qACE_sd_glc=20%",
"qACE_mean_glc=40%", "qACE_sd_glc=40%",
"qACE_mean_glc=60%", "qACE_sd_glc=60%",
"qACE_mean_glc=80%", "qACE_sd_glc=80%",
"qACE_mean_glc=100%", "qACE_sd_glc=100%")
write.csv(data_to_save, "results/SourceData/Figure 3/3A/data_3A.csv", quote=FALSE)
n_glc_steps <- 5
x <- seq(1, n_glc_steps)/n_glc_steps*100
plot(x, rev(apply(res_e2[,,1,"ace_threshold"], 2, mean)), type="l", axes=FALSE, col="#548235", las=1, lwd=1.2, ylim=c(0,16), xlab="Glycolytic activity (%)", ylab="[Ace]reversal (mM)")
axis(1, at = seq(20,100,by=20), labels = paste(seq(100,20, by=-20)), tick = TRUE)
axis(2, tick = TRUE, las=1)
box()
polygon(x=c(x, rev(x)),
y=c(rev(apply(res_e2[,,1,"ace_threshold"], 2, mean))+rev(apply(res_e2[,,1,"ace_threshold"], 2, sd)), rev(rev(apply(res_e2[,,1,"ace_threshold"], 2, mean))-rev(apply(res_e2[,,1,"ace_threshold"], 2, sd)))),
col=paste("#548235", "55", sep=""), border=NA)
data_to_save <- apply(res_e2[,,1,"ace_threshold"], 2, mean)
for (i in seq(5)){
data_to_save <- cbind(data_to_save,
apply(res_e2[,,i,"ace_threshold"], 2, mean),
apply(res_e2[,,i,"ace_threshold"], 2, sd))
}
colnames(data_to_save) <- c("glycolytic flux",
"conc_mean_glc=20%", "conc_sd_glc=20%",
"conc_mean_glc=40%", "conc_sd_glc=40%",
"conc_mean_glc=60%", "conc_sd_glc=60%",
"conc_mean_glc=80%", "conc_sd_glc=80%",
"conc_mean_glc=100%", "conc_sd_glc=100%")
write.csv(data_to_save, "results/SourceData/Figure 3/3B/data_3B.csv", quote=FALSE)
# load experimental data
exp_data <- read.table("data/data_E_coli_K12_MG1655_Figure_3-4.txt", header=TRUE, sep="\t")
# plot acetate flux as function of acetate concentration, at different glycolytic flux (aMG=0, 20, 40 or 100 mM)
cols <- rev(colorRampPalette(c("#2E75B6", "#D5E3F0"))(4))
cols <- hcl.colors(6, "Oslo")
# empty plot
plot(NA, NA, type="p", log="x", xaxt='n', pch=20, las=1, xlim=c(0.1,100), ylim=c(-11,3), xlab="[acetate] (mM)", ylab="acetate flux (mmol/gDW/h)")
abline(h=0)
# aMG = 0 mM
filter <- (exp_data[,"aMG"]==0)
col <- cols[2]
x <- exp_data[filter,"ACE"]
y <- exp_data[filter,"qACE"]
points(x, y, bg=col, col="black", pch=21, lwd=1)
# uncomment the following lines to run the fits, here we just plot the fitted curves
# note: fitting is not stable, so it might have to be run several times to obtain a correct fit
#res_fit <- fit_sigmoid(x, y, par_ini_sigmoid, lower_sigmoid, upper_sigmoid)
#lines(seq(0.1,130,length.out=1000), sim_sigmoid(res_fit$par, seq(0.1,130,length.out=1000)), col=col, lwd=2)
lines(seq(0.1,130,length.out=1000), sim_sigmoid(c(-0.2460494, -1.5989450, -0.9279984, 6.9209620), seq(0.1,130,length.out=1000)), col=col, lwd=2)
# aMG = 20 mM
filter <- (exp_data[,"aMG"]==20)
col <- cols[3]
x <- exp_data[filter,"ACE"]
y <- exp_data[filter,"qACE"]
points(x, y, bg=col, col="black", pch=22, lwd=1)
#res_fit <- fit_sigmoid(x, y, par_ini_sigmoid, lower_sigmoid, upper_sigmoid)
#lines(seq(0.1,130,length.out=1000), sim_sigmoid(res_fit$par, seq(0.1,130,length.out=1000)), col=col, lwd=2)
lines(seq(0.1,130,length.out=1000), sim_sigmoid(c(-2.454911e-01, -2.840827e+00, 5.006536e+01, 1.000000e+06), seq(0.1,130,length.out=1000)), col=col, lwd=2)
# aMG = 40 mM
filter <- (exp_data[,"aMG"]==40)
col <- cols[4]
x <- exp_data[filter,"ACE"]
y <- exp_data[filter,"qACE"]
points(x, y, bg=col, col="black", pch=23, lwd=1)
#res_fit <- fit_sigmoid(x, y, par_ini_sigmoid, lower_sigmoid, upper_sigmoid)
#lines(seq(0.1,130,length.out=1000), sim_sigmoid(res_fit$par, seq(0.1,130,length.out=1000)), col=col, lwd=2)
lines(seq(0.1,130,length.out=1000), sim_sigmoid(c(-0.1506843, -7.0591207, 3.5268378, 18.6152155), seq(0.1,130,length.out=1000)), col=col, lwd=2)
# aMG = 100 mM
filter <- (exp_data[,"aMG"]==100)
col <- cols[5]
x <- exp_data[filter,"ACE"]
y <- exp_data[filter,"qACE"]
points(x, y, bg=col, col="black", pch=24, lwd=1)
#res_fit <- fit_sigmoid(x, y, par_ini_sigmoid, lower_sigmoid, upper_sigmoid)
#lines(seq(0.1,130,length.out=1000), sim_sigmoid(res_fit$par, seq(0.1,130,length.out=1000)), col=col, lwd=2)
lines(seq(0.1,130,length.out=1000), sim_sigmoid(c(-0.2395667, -9.8451042, 36.7387431, 64514.4364655), seq(0.1,130,length.out=1000)), col=col, lwd=2)
# add axes
xlab_main <- c(0.1, 1, 10, 100)
xlab_sec <- c(seq(0.2, 0.9, by=0.1), seq(2, 9, by=1), seq(20, 90, by=10))
axis(side = 1, at = xlab_main, labels = TRUE)
axis(side = 1, at = xlab_sec, labels = FALSE, tcl=-0.3)
write.csv(exp_data, "results/SourceData/Figure 3/3C/data_3C.csv", quote=FALSE)
v0 <- get_ace_threshold(sim_sigmoid(c(-0.2460494, -1.5989450, -0.9279984, 6.9209620), seq(0.1,130,length.out=1000)),
seq(0.1,130,length.out=1000))
v20 <- get_ace_threshold(sim_sigmoid(c(-2.454911e-01, -2.840827e+00, 5.006536e+01, 1.000000e+06), seq(0.1,130,length.out=1000)),
seq(0.1,130,length.out=1000))
v40 <- get_ace_threshold(sim_sigmoid(c(-0.1506843, -7.0591207, 3.5268378, 18.6152155), seq(0.1,130,length.out=1000)),
seq(0.1,130,length.out=1000))
v100 <- get_ace_threshold(sim_sigmoid(c(-0.2395667, -9.8451042, 36.7387431, 64514.4364655), seq(0.1,130,length.out=1000)),
seq(0.1,130,length.out=1000))
plot(c(0, 20, 40, 100), c(v0, v20, v40, v100), type="l", col="#548235", las=1, lwd=1.2, ylim=c(0,10), xlab="aMG (mM)", ylab="[Ace] reversal (mM)")
points(c(0, 20, 40, 100), c(v0,v20,v40,v100), col="#548235", lwd=1.2, pch=20)
data_to_save <- rbind(c(0, 20, 40, 100), c(v0, v20, v40, v100))
rownames(data_to_save) <- c("aMG", "ace_conc_threshold")
write.csv(exp_data, "results/SourceData/Figure 3/3D/data_3D.csv", quote=FALSE)
xlab_main <- c(0.1, 1, 10, 100)
xlab_sec <- c(seq(0.2, 0.9, by=0.1), seq(2, 9, by=1), seq(20, 90, by=10))
# growth rate as function of acetate concentration
cols <- sequential_hcl(6, "blues3")
plot_with_ci_4(res_e2[,1,,], "ace_concentration", "Values[v_growth_rate]", col=cols[1], xaxt='n', las=1, lwd=2, xlim=c(0.1,100), ylim=c(0,0.8), log="x", xlab="[acetate] (mM)", ylab="growth rate (h-1)")
plot_with_ci_4(res_e2[,5,,], "ace_concentration", "Values[v_growth_rate]", col=cols[4], add_to_plot=TRUE, lwd=2)
axis(side = 1, at = xlab_main, labels = TRUE)
axis(side = 1, at = xlab_sec, labels = FALSE, tcl=-0.3)
data_to_save <- apply(res_e2[,1,,"ace_concentration"], 2, mean)
for (i in c(1,5)){
data_to_save <- cbind(data_to_save,
apply(res_e2[,i,,"Values[v_growth_rate]"], 2, mean),
apply(res_e2[,i,,"Values[v_growth_rate]"], 2, sd))
}
colnames(data_to_save) <- c("ace_concentration",
"mu_mean_glc=20%", "mu_sd_glc=20%",
"mu_mean_glc=100%", "mu_sd_glc=100%")
write.csv(data_to_save, "results/SourceData/Figure 4/4A/data_4A.csv", quote=FALSE)
# load experimental data
exp_data <- read.table("data/data_E_coli_K12_MG1655_Figure_3-4.txt", header=TRUE, sep="\t")
# plot growth rate as function of acetate concentration, at high (aMG=0mM) and low (aMG=100mM) glycolytic flux
cols <- rev(colorRampPalette(c("#2E75B6", "#D5E3F0"))(4))
cols <- hcl.colors(6, "Oslo")
# empty plot
plot(NA, NA, type="p", log="x", col=col, xaxt='n', pch=20, las=1, xlim=c(0.1,100), ylim=c(0, 0.7), xlab="[acetate] (mM)", ylab="growth rate (h-1)")
# aMG = 0 mM
filter <- (exp_data[,"aMG"]==0)
col <- cols[2]
x <- exp_data[filter,"ACE"]
y <- exp_data[filter,"mu"]
points(x, y, bg=cols[2], col="black", pch=21, lwd=1)
df <- data.frame(x=log10(x), y=y)
df <- df[order(df$x),]
model <- lm(y~poly(x,3), data = df)
#summary(model)
range_ace <- seq(min(df$x), max(df$x), len=100)
predy <- predict(model, data.frame(x=range_ace))
lines(10**range_ace, predy, type="l", col=col, lwd=2)
# aMG = 100 mM
filter <- (exp_data[,"aMG"]==100)
col <- cols[5]
x <- exp_data[filter,"ACE"]
y <- exp_data[filter,"mu"]
points(x, y, bg=col, col="black", pch=24, lwd=1)
df=data.frame(x=log10(x), y=y)
df <- df[order(df$x),]
model = lm(y~poly(x,3), data = df)
#summary(model)
i = seq(min(df$x), max(df$x), len=100) # x-values for line
predy = predict(model, data.frame(x=i))
lines(10**i, predy, type="l", col=col, lwd=2)
# add axes
xlab_main <- c(0.1, 1, 10, 100)
xlab_sec <- c(seq(0.2, 0.9, by=0.1), seq(2, 9, by=1), seq(20, 90, by=10))
axis(side = 1, at = xlab_main, labels = TRUE)
axis(side = 1, at = xlab_sec, labels = FALSE, tcl=-0.3)
write.csv(sim_data, "results/SourceData/Figure 4/4B/data_4B.csv", quote=FALSE)
exp_data <- read.table("data/data_E_coli_K12_BW25113_Figure_6-7.txt", header=TRUE, sep="\t")
statistical_results <- array(NA, dim=c(30, 11), dimnames=list(NULL, c("carbon source", "strain", "aMG", "ace", "mu_mean", "mu_sd", "n_replicates", "p-val (vs wt, same ace)", "p-val (vs 0 mM ace, same strain)", "relative growth change", "rgc_sd")))
k <- 0
# for each carbon source
for (c_source in unique(exp_data$carbon_source)){
# for each strain
for (strain in unique(exp_data$genotype)){
# for each aMG concentration
for (aMG in rev(unique(exp_data[((exp_data$genotype == strain) & (exp_data$carbon_source == c_source)), "aMG"]))){
# for each acetate concentration
for (ace in unique(exp_data$ACE)){
# perform all statistical tests (Student t-tests with two-tailed distributions)
# to compare the different strains/conditions, as detailed below
k <- k+1
mu_strain <- exp_data[((exp_data$genotype == strain) & (exp_data$ACE == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "mu"]
mu_mean <- mean(mu_strain)
mu_sd <- sd(mu_strain)
#cat("**********************************************\n")
#cat("Statistical analysis for the following condition:\n")
#cat("\nstrain: ", strain, ", carbon source: ", c_source , ", [ace]=", ace, "mM, [aMG]=", aMG, "mM\n", sep="")
#cat("**********************************************\n")
t_test_factor_strain <- list(p.value=NA)
if (strain != "wt"){
n_rep_com <- Reduce(intersect, list(exp_data[((exp_data$genotype == "wt") & (exp_data$ACE == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "experiment_number"],
exp_data[((exp_data$genotype == strain) & (exp_data$ACE == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "experiment_number"]))
mu_wt <- exp_data[((exp_data$genotype == "wt") & (exp_data$ACE == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG) & (exp_data$experiment_number %in% n_rep_com)), "mu"]
mu_strain <- exp_data[((exp_data$genotype == strain) & (exp_data$ACE == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG) & (exp_data$experiment_number %in% n_rep_com)), "mu"]
if ((length(mu_wt) > 1) & (length(mu_strain) > 1)){
t_test_factor_strain <- t.test(mu_wt, mu_strain)
}
#cat("\n\nStatistical test:", paste("\n wt vs ", strain, ", carbon source: ", c_source , ", [ace]=", ace, "mM\n", sep=""), sep="\n")
#cat("\nwt: ", paste(mu_wt, collapse=", "), "\n", sep="")
#cat(strain, ": ", paste(mu_strain, collapse=", "), "\n", sep="")
#print(t_test_factor_strain)
}
t_test_factor_ace <- list(p.value=NA)
relative_growth_change <- NA
relative_growth_change_sd <- NA
if (ace == 10){
mu_no_ace <- exp_data[((exp_data$genotype == strain) & (exp_data$ACE == 0) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "mu"]
mu_ace <- exp_data[((exp_data$genotype == strain) & (exp_data$ACE == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "mu"]
relative_growth_change <- mean(mu_ace/mu_no_ace)-1
relative_growth_change_sd <- sd(mu_ace/mu_no_ace)
# here we compared directly the relative change of growth rate induced by 10 mM acetate
t_test_factor_ace <- t.test(mu_ace/mu_no_ace, mu=1)
# to compare directly the growth rates in presence and absence of acetate (with paired tests, because for
# each strain/carbon source cultivations were carried out in parallel with and without acetate), just
# uncomment the following line (results are similar)
# t_test_factor_ace <- t.test(mu_ace, mu_no_ace, paired=TRUE)
#cat("\n\nStatistical test:", paste("\n strain: ", strain, ", carbon source: ", c_source , ", [ace]=0 mM vs [ace]=10 mM\n", sep=""), sep="\n")
#cat("relative change of growth rates: ", paste(mu_ace/mu_no_ace-1, collapse=", "), "\n", sep="")
#print(t_test_factor_ace)
}
statistical_results[k, ] <- c(c_source, strain, aMG, ace, mu_mean, mu_sd, length(mu_strain), t_test_factor_strain$p.value, t_test_factor_ace$p.value, relative_growth_change, relative_growth_change_sd)
}
}
}
}
write.table(statistical_results,"results/StatisticalResults/Statistical_results_glc_gly_gal.tsv", quote=FALSE, sep="\t", row.names=FALSE)
mask <- (is.element(statistical_results[,"carbon source"], c("glucose"))) & (statistical_results[,"ace"] == "10") & (is.element(statistical_results[,"strain"], c("wt")))
data_to_plot <- as.numeric(statistical_results[mask, "relative growth change"])
names(data_to_plot) <- statistical_results[mask, "strain"]
data_sd_to_plot <- as.numeric(statistical_results[mask, "rgc_sd"])
ze_barplot <- barplot(data_to_plot*100, ylim=c(-10,15), beside=TRUE, legend.text=FALSE, las=1, ylab="relative growth change (%)", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot*100, data_sd_to_plot*100)
axis(side=1,line=0,at=ze_barplot,labels=c("aMG_0", "aMG_100"),mgp=c(0,0.5,0),tck=-0.02)
box()
data_to_save <- statistical_results[(statistical_results[,"carbon source"] == "glucose"),]
write.table(data_to_save,"results/SourceData/Figure 4/4C/data_4C.tsv", quote=FALSE, sep="\t", row.names=FALSE)
mask <- (is.element(statistical_results[,"carbon source"], c("glucose"))) & (statistical_results[,"ace"] == "10") & (is.element(statistical_results[,"strain"], c("delta_pgi", "delta_pfkA")))
data_to_plot <- as.numeric(statistical_results[mask, "relative growth change"])
names(data_to_plot) <- statistical_results[mask, "strain"]
data_sd_to_plot <- as.numeric(statistical_results[mask, "rgc_sd"])
ze_barplot <- barplot(data_to_plot*100, ylim=c(0,150), beside=TRUE, legend.text=FALSE, las=1, ylab="relative growth change (%)", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot*100, data_sd_to_plot*100)
axis(side=1,line=0,at=ze_barplot,labels=c("pfkA", "pgi"),mgp=c(0,0.5,0),tck=-0.02)
box()
write.table(data_to_plot,"results/SourceData/Figure 4/4D/data_4D.tsv", quote=FALSE, sep="\t", row.names=FALSE)
mask <- ((is.element(statistical_results[,"carbon source"], c("glucose"))) & (statistical_results[,"ace"] == "10")) & (statistical_results[,"aMG"] == "100") & (is.element(statistical_results[,"strain"], c("wt", "delta_pta", "delta_acs")))
data_to_plot <- as.numeric(statistical_results[mask, "relative growth change"])
names(data_to_plot) <- statistical_results[mask, "strain"]
data_sd_to_plot <- as.numeric(statistical_results[mask, "rgc_sd"])
ze_barplot <- barplot(data_to_plot*100, ylim=c(-10,15), beside=TRUE, legend.text=FALSE, las=1, ylab="relative growth change (%)", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot*100, data_sd_to_plot*100)
axis(side=1,line=0,at=ze_barplot,labels=c("aMG_100_wt","aMG_100_pta","aMG_100_acs"),mgp=c(0,0.5,0),tck=-0.02)
box()
mask <- (is.element(statistical_results[,"carbon source"], c("glycerol"))) & (statistical_results[,"ace"] == "10")
data_to_plot <- as.numeric(statistical_results[mask, "relative growth change"])
names(data_to_plot) <- statistical_results[mask, "strain"]
data_sd_to_plot <- as.numeric(statistical_results[mask, "rgc_sd"])
ze_barplot <- barplot(data_to_plot*100, ylim=c(-10,15), beside=TRUE, legend.text=FALSE, las=1, ylab="relative growth change (%)", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot*100, data_sd_to_plot*100)
axis(side=1,line=0,at=ze_barplot,labels=c("wt", "pta","acs"),mgp=c(0,0.5,0),tck=-0.02)
box()
mask <- (is.element(statistical_results[,"carbon source"], c("galactose"))) & (statistical_results[,"ace"] == "10")
data_to_plot <- as.numeric(statistical_results[mask, "relative growth change"])
names(data_to_plot) <- statistical_results[mask, "strain"]
data_sd_to_plot <- as.numeric(statistical_results[mask, "rgc_sd"])
ze_barplot <- barplot(data_to_plot*100, ylim=c(-20,60), beside=TRUE, legend.text=FALSE, las=1, ylab="relative growth change (%)", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot*100, data_sd_to_plot*100)
axis(side=1,line=0,at=ze_barplot,labels=c("wt", "pta","acs"),mgp=c(0,0.5,0),tck=-0.02)
box()
exp_data <- read.table("data/data_E_coli_K12_BW25113_Figure_EV1.txt", header=TRUE, sep="\t")
statistical_results <- array(NA, dim=c(8, 6), dimnames=list(NULL, c("carbon source", "strain", "aMG", "ace", "delta_pH_mean", "delta_pH_sd")))
k <- 0
# for each carbon source
for (c_source in unique(exp_data$carbon_source)){
# for each strain
for (strain in unique(exp_data$genotype)){
# for each aMG concentration
for (aMG in rev(unique(exp_data[((exp_data$genotype == strain) & (exp_data$carbon_source == c_source)), "aMG"]))){
# for each acetate concentration
for (ace in unique(exp_data$ACE)){
# perform all statistical tests (Student t-tests with two-tailed distributions)
# to compare the different strains/conditions, as detailed below
delta_pH <- exp_data[((exp_data$genotype == strain) & (exp_data$ACE == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "delta_pH"]
if (length(delta_pH) > 2){
k <- k+1
delta_pH_mean <- mean(delta_pH)
delta_pH_sd <- sd(delta_pH)
statistical_results[k, ] <- c(c_source, strain, aMG, ace, delta_pH_mean, delta_pH_sd)
}
}
}
}
}
write.table(statistical_results,"results/StatisticalResults/Statistical_results_glc_gly_gal_EV1.tsv", quote=FALSE, sep="\t", row.names=FALSE)
data_to_plot <- as.numeric(statistical_results[, "delta_pH_mean"])
names(data_to_plot) <- paste(statistical_results[, "strain"], statistical_results[, "carbon source"], statistical_results[, "ace"], sep="_")
data_sd_to_plot <- as.numeric(statistical_results[, "delta_pH_sd"])
ze_barplot <- barplot(data_to_plot, ylim=c(-0.4,0.1), beside=TRUE, legend.text=FALSE, las=1, ylab="change in pH", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot, data_sd_to_plot)
axis(side=1,line=0,at=ze_barplot,labels=c("glc_aMG", "glc_aMG_ace10", "glc_aMG_ace100", "glc", "gly", "gly_ace", "gal", "gal_ace"),mgp=c(0,0.5,0),tck=-0.02, las=2)
box()
exp_data <- read.table("data/data_E_coli_K12_BW25113_Figure_EV2.txt", header=TRUE, sep="\t")
statistical_results <- array(NA, dim=c(8, 13), dimnames=list(NULL, c("carbon source", "strain", "aMG", "ace", "mu_mean", "mu_sd", "n_replicates", "p-val (vs wt, same ace)", "p-val (vs 0 mM ace, same strain)", "relative growth change", "rgc_sd", "delta_pH_mean", "delta_pH_sd")))
k <- 0
# for each carbon source
for (c_source in unique(exp_data$carbon_source)){
# for each strain
for (strain in unique(exp_data$genotype)){
# for each aMG concentration
for (aMG in rev(unique(exp_data[((exp_data$genotype == strain) & (exp_data$carbon_source == c_source)), "aMG"]))){
# for each acetate concentration
for (ace in unique(exp_data$ACETIC_ACID)){
# perform all statistical tests (Student t-tests with two-tailed distributions)
# to compare the different strains/conditions, as detailed below
k <- k+1
mu_strain <- exp_data[((exp_data$genotype == strain) & (exp_data$ACETIC_ACID == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "mu"]
mu_mean <- mean(mu_strain)
mu_sd <- sd(mu_strain)
delta_pH <- exp_data[((exp_data$genotype == strain) & (exp_data$ACETIC_ACID == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "delta_pH"]
delta_pH_mean <- mean(delta_pH)
delta_pH_sd <- sd(delta_pH)
#cat("**********************************************\n")
#cat("Statistical analysis for the following condition:\n")
#cat("\nstrain: ", strain, ", carbon source: ", c_source , ", [ace]=", ace, "mM, [aMG]=", aMG, "mM\n", sep="")
#cat("**********************************************\n")
t_test_factor_strain <- list(p.value=NA)
if (strain != "wt"){
n_rep_com <- Reduce(intersect, list(exp_data[((exp_data$genotype == "wt") & (exp_data$ACETIC_ACID == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "experiment_number"],
exp_data[((exp_data$genotype == strain) & (exp_data$ACETIC_ACID == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "experiment_number"]))
mu_wt <- exp_data[((exp_data$genotype == "wt") & (exp_data$ACETIC_ACID == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG) & (exp_data$experiment_number %in% n_rep_com)), "mu"]
mu_strain <- exp_data[((exp_data$genotype == strain) & (exp_data$ACETIC_ACID == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG) & (exp_data$experiment_number %in% n_rep_com)), "mu"]
if ((length(mu_wt) > 1) & (length(mu_strain) > 1)){
t_test_factor_strain <- t.test(mu_wt, mu_strain)
}
#cat("\n\nStatistical test:", paste("\n wt vs ", strain, ", carbon source: ", c_source , ", [ace]=", ace, "mM\n", sep=""), sep="\n")
#cat("\nwt: ", paste(mu_wt, collapse=", "), "\n", sep="")
#cat(strain, ": ", paste(mu_strain, collapse=", "), "\n", sep="")
#print(t_test_factor_strain)
}
t_test_factor_ace <- list(p.value=NA)
relative_growth_change <- NA
relative_growth_change_sd <- NA
if (ace == 10){
n_rep_com <- Reduce(intersect, list(exp_data[((exp_data$genotype == strain) & (exp_data$ACETIC_ACID == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "experiment_number"],
exp_data[((exp_data$genotype == strain) & (exp_data$ACETIC_ACID == 0) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG)), "experiment_number"]))
mu_no_ace <- exp_data[((exp_data$genotype == strain) & (exp_data$ACETIC_ACID == 0) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG) & (exp_data$experiment_number %in% n_rep_com)), "mu"]
mu_ace <- exp_data[((exp_data$genotype == strain) & (exp_data$ACETIC_ACID == ace) & (exp_data$carbon_source == c_source) & (exp_data$aMG == aMG) & (exp_data$experiment_number %in% n_rep_com)), "mu"]
relative_growth_change <- mean(mu_ace/mu_no_ace)-1
relative_growth_change_sd <- sd(mu_ace/mu_no_ace)
# here we compared directly the relative change of growth rate induced by 10 mM acetate
t_test_factor_ace <- t.test(mu_ace/mu_no_ace, mu=1)
# to compare directly the growth rates in presence and absence of acetate (with paired tests, because for
# each strain/carbon source cultivations were carried out in parallel with and without acetate), just
# uncomment the following line (results are similar)
# t_test_factor_ace <- t.test(mu_ace, mu_no_ace, paired=TRUE)
#cat("\n\nStatistical test:", paste("\n strain: ", strain, ", carbon source: ", c_source , ", [ace]=0 mM vs [ace]=10 mM\n", sep=""), sep="\n")
#cat("relative change of growth rates: ", paste(mu_ace/mu_no_ace-1, collapse=", "), "\n", sep="")
#print(t_test_factor_ace)
}
statistical_results[k, ] <- c(c_source, strain, aMG, ace, mu_mean, mu_sd, length(mu_strain), t_test_factor_strain$p.value, t_test_factor_ace$p.value, relative_growth_change, relative_growth_change_sd, delta_pH_mean, delta_pH_sd)
}
}
}
}
write.table(statistical_results,"results/StatisticalResults/Statistical_results_glc_gly_gal_EV2.tsv", quote=FALSE, sep="\t", row.names=FALSE)
mask <- (statistical_results[,"ace"] == "10") & (statistical_results[,"carbon source"] == "glucose")
data_to_plot <- as.numeric(statistical_results[mask, "relative growth change"])
names(data_to_plot) <- statistical_results[mask, "strain"]
data_sd_to_plot <- as.numeric(statistical_results[mask, "rgc_sd"])
ze_barplot <- barplot(data_to_plot*100, ylim=c(-5,15), beside=TRUE, legend.text=FALSE, las=1, ylab="relative growth change (%)", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot*100, data_sd_to_plot*100)
axis(side=1,line=0,at=ze_barplot,labels=c("glc_aMG", "glc"),mgp=c(0,0.5,0),tck=-0.02)
box()
mask <- (statistical_results[,"ace"] == "10") & (statistical_results[,"carbon source"] == "glycerol")
data_to_plot <- as.numeric(statistical_results[mask, "relative growth change"])
names(data_to_plot) <- statistical_results[mask, "strain"]
data_sd_to_plot <- as.numeric(statistical_results[mask, "rgc_sd"])
ze_barplot <- barplot(data_to_plot*100, ylim=c(0,10), beside=TRUE, legend.text=FALSE, las=1, ylab="relative growth change (%)", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot*100, data_sd_to_plot*100)
axis(side=1,line=0,at=ze_barplot,labels=c("gly"),mgp=c(0,0.5,0),tck=-0.02)
box()
mask <- (statistical_results[,"ace"] == "10") & (statistical_results[,"carbon source"] == "galactose")
data_to_plot <- as.numeric(statistical_results[mask, "relative growth change"])
names(data_to_plot) <- statistical_results[mask, "strain"]
data_sd_to_plot <- as.numeric(statistical_results[mask, "rgc_sd"])
ze_barplot <- barplot(data_to_plot*100, ylim=c(0,120), beside=TRUE, legend.text=FALSE, las=1, ylab="relative growth change (%)", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot*100, data_sd_to_plot*100)
axis(side=1,line=0,at=ze_barplot,labels=c("gal"),mgp=c(0,0.5,0),tck=-0.02)
box()
data_to_plot <- as.numeric(statistical_results[, "delta_pH_mean"])
names(data_to_plot) <- paste(statistical_results[, "strain"], statistical_results[, "carbon source"])
data_sd_to_plot <- as.numeric(statistical_results[, "delta_pH_sd"])
ze_barplot <- barplot(data_to_plot, ylim=c(-0.4,0.1), beside=TRUE, legend.text=FALSE, las=1, ylab="change in pH", xaxt='n')
abline(h=0)
error.bar(ze_barplot, data_to_plot, data_sd_to_plot)
axis(side=1,line=0,at=ze_barplot,labels=c("glc_aMG", "glc_aMG_ace", "glc", "glc_ace", "gly", "gly_ace", "gal", "gal_ace"),mgp=c(0,0.5,0),tck=-0.02, las=2)
box()