Skip to content

Commit 02a6436

Browse files
committed
initial release of v2 (based on Rmd notebook)
1 parent b27fad6 commit 02a6436

File tree

106 files changed

+14999
-638
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+14999
-638
lines changed

README.md

+16-28
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,31 @@
22

33
## Overview
44

5-
These R scripts perform all analyses detailed in the following publication:
5+
This R code perform all analyses detailed in the following publication:
66

77
> From toxic waste to beneficial nutrient: acetate boosts *Escherichia coli* growth at low glycolytic flux.
88
>
9-
> P. Millard, S. Uttenweiler-Joseph, B. Enjalbert. bioRxiv, 2022, doi: [10.1101/2022.09.20.506926](https://doi.org/10.1101/2022.09.20.506926)
9+
> P. Millard, T. Gosselin-Monplaisir, S. Uttenweiler-Joseph, B. Enjalbert. bioRxiv, 2022, doi: [10.1101/2022.09.20.506926](https://doi.org/10.1101/2022.09.20.506926)
1010
1111
The model is available in COPASI format in the `./model/` directory, and in SBML format from the Biomodels database (http://www.ebi.ac.uk/biomodels/) under identifier MODEL2005050001. Details on the model can be found in the original publication (Millard et al., 2021, eLife, doi: [10.7554/eLife.63661](https://doi.org/10.7554/eLife.63661)) and at https://github.com/MetaSys-LISBP/acetate_regulation. Experimental data are provided in the `./data/` directory. Calculation results and figures are saved in the `./results/` directory.
1212

13-
Details on the calculations can be found in the [original publication](https://doi.org/10.1101/2022.09.20.506926) and in the R scripts.
13+
Details on the calculations can be found in the [original publication](https://doi.org/10.1101/2022.09.20.506926) and in the Rmd notebook.
14+
15+
We distribute an HTML file showing the [notebook’s output after execution](https://htmlpreview.github.io/?https://github.com/MetaSys-LISBP/glucose_acetate_interplay/blob/main/notebook.html)
1416

1517
The code is open-source and available under [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.txt).
1618

1719
## Dependencies
1820

19-
Some R packages are required.
21+
If not yet done, download and install [Rstudio](https://posit.co/downloads/).
22+
23+
Some R packages are also required.
2024

21-
`RColorBrewer`, `gplots`, `pso` and `optimx` can be installed
22-
by running the following command in an R console:
25+
`RColorBrewer`, `gplots`, `pso`, `colorspace` and `optimx` can be installed
26+
by running the following command in the Rstudio console:
2327

2428
```bash
25-
install.packages(c("RColorBrewer", "gplots", "pso", "optimx"))
29+
install.packages(c("RColorBrewer", "gplots", "pso", "optimx", "colorspace"))
2630
```
2731

2832
`CoRC` can be installed
@@ -40,38 +44,22 @@ Additional information on CoRC installation and usage are available from the CoR
4044

4145
## Usage
4246

43-
To run all analyses detailed in the publication and reproduce Figures 1-4, 6 and 7:
47+
To run all analyses detailed in the publication and reproduce Figures 1-4, 6-7 and EV1-2:
4448

4549
- download the [GitHub repository tarball](https://github.com/pierremillard/glucose_acetate_interplay/archive/refs/heads/master.zip) and unpack it somewhere on your disk
4650

47-
- open a terminal
48-
49-
- go to the code directory, e.g.:
50-
51-
```bash
52-
cd /home/usr/data/glucose_acetate_interplay/
53-
```
54-
55-
- open an R session:
51+
- start Rstudio
5652

57-
```bash
58-
R
59-
```
60-
61-
- run simulations, generate all figures and perform statistical analyses with:
62-
63-
```bash
64-
source("run_calculations.R")
65-
```
53+
- open the file `./notebook.Rmd`
6654

67-
All results will be saved in the `./results/` directory.
55+
The notebook will open in Rstudio, in each cell you can read/modify/execute a proposed code as well as read accompanying comments.
6856

6957
## Questions
7058
If you have any question, please open a new *issue*
7159
to [our GitHub issue tracker](https://github.com/MetaSys-LISBP/glucose_acetate_interplay/issues) so we could discuss together.
7260

7361
## How to cite
74-
Millard P., Uttenweiler-Joseph S., Enjalbert B. From toxic waste to beneficial nutrient: acetate boosts *Escherichia coli* growth at low glycolytic flux. bioRxiv, 2022, doi: [10.1101/2022.09.20.506926](https://doi.org/10.1101/2022.09.20.506926)
62+
Millard P., Gosselin-Monplaisir T. Uttenweiler-Joseph S., Enjalbert B. From toxic waste to beneficial nutrient: acetate boosts *Escherichia coli* growth at low glycolytic flux. bioRxiv, 2022, doi: [10.1101/2022.09.20.506926](https://doi.org/10.1101/2022.09.20.506926)
7563

7664
## Authors
7765
Pierre Millard

data/data_E_coli_K12_BW25113_Figure_6-7.txt

+12
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,15 @@ E_coli_K12_BW25113 delta_pta galactose 13 0 0 0.2643
7171
E_coli_K12_BW25113 delta_pta galactose 13 0 10 0.2369
7272
E_coli_K12_BW25113 delta_pta galactose 14 0 0 0.2556
7373
E_coli_K12_BW25113 delta_pta galactose 14 0 10 0.2389
74+
E_coli_K12_BW25113 delta_pgi glucose 19 0 0 0.2117
75+
E_coli_K12_BW25113 delta_pgi glucose 19 0 10 0.2925
76+
E_coli_K12_BW25113 delta_pfkA glucose 19 0 0 0.0739
77+
E_coli_K12_BW25113 delta_pfkA glucose 19 0 10 0.143
78+
E_coli_K12_BW25113 delta_pgi glucose 20 0 0 0.1793
79+
E_coli_K12_BW25113 delta_pgi glucose 20 0 10 0.2991
80+
E_coli_K12_BW25113 delta_pfkA glucose 20 0 0 0.0706
81+
E_coli_K12_BW25113 delta_pfkA glucose 20 0 10 0.1658
82+
E_coli_K12_BW25113 delta_pgi glucose 21 0 0 0.1816
83+
E_coli_K12_BW25113 delta_pgi glucose 21 0 10 0.3156
84+
E_coli_K12_BW25113 delta_pfkA glucose 21 0 0 0.0758
85+
E_coli_K12_BW25113 delta_pfkA glucose 21 0 10 0.1691
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
strain genotype carbon_source experiment_number aMG ACE delta_pH
2+
E_coli_K12_BW25113 wt glucose 1 0 0 -0.23
3+
E_coli_K12_BW25113 wt glucose 1 100 0 -0.31
4+
E_coli_K12_BW25113 wt glucose 1 100 10 -0.21
5+
E_coli_K12_BW25113 wt glucose 1 100 100 -0.14
6+
E_coli_K12_BW25113 wt glucose 2 0 0 -0.35
7+
E_coli_K12_BW25113 wt glucose 2 100 0 -0.25
8+
E_coli_K12_BW25113 wt glucose 2 100 10 -0.19
9+
E_coli_K12_BW25113 wt glucose 2 100 100 -0.14
10+
E_coli_K12_BW25113 wt glucose 3 0 0 -0.27
11+
E_coli_K12_BW25113 wt glucose 3 100 0 -0.24
12+
E_coli_K12_BW25113 wt glucose 3 100 10 -0.15
13+
E_coli_K12_BW25113 wt glucose 3 100 100 -0.12
14+
E_coli_K12_BW25113 wt glycerol 4 0 0 -0.3
15+
E_coli_K12_BW25113 wt glycerol 4 0 10 -0.22
16+
E_coli_K12_BW25113 wt galactose 5 0 0 -0.25
17+
E_coli_K12_BW25113 wt galactose 5 0 10 -0.17
18+
E_coli_K12_BW25113 wt glycerol 6 0 0 -0.21
19+
E_coli_K12_BW25113 wt glycerol 6 0 10 -0.15
20+
E_coli_K12_BW25113 wt galactose 7 0 0 -0.17
21+
E_coli_K12_BW25113 wt galactose 7 0 10 -0.14
22+
E_coli_K12_BW25113 wt glycerol 8 0 0 -0.16
23+
E_coli_K12_BW25113 wt glycerol 8 0 10 -0.14
24+
E_coli_K12_BW25113 wt galactose 9 0 0 -0.15
25+
E_coli_K12_BW25113 wt galactose 9 0 10 -0.12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
genotype carbon_source experiment_number aMG ACETIC_ACID mu delta_pH
2+
E_coli_K12_BW25113 glucose 1 0 0 0.6283 -0.25
3+
E_coli_K12_BW25113 glucose 1 100 0 0.3905 -0.22
4+
E_coli_K12_BW25113 glucose 1 100 10 0.439 -0.18
5+
E_coli_K12_BW25113 glycerol 1 0 0 0.3807 -0.21
6+
E_coli_K12_BW25113 glycerol 1 0 10 0.4168 -0.1
7+
E_coli_K12_BW25113 galactose 1 0 0 0.1509 -0.11
8+
E_coli_K12_BW25113 galactose 1 0 10 0.3063 0
9+
E_coli_K12_BW25113 glucose 2 0 0 0.59 -0.26
10+
E_coli_K12_BW25113 glucose 2 0 10 0.5678 -0.19
11+
E_coli_K12_BW25113 glucose 3 0 0 0.6029 -0.27
12+
E_coli_K12_BW25113 glucose 3 0 10 0.5793 -0.15
13+
E_coli_K12_BW25113 glucose 4 0 0 0.6038 -0.29
14+
E_coli_K12_BW25113 glucose 4 0 10 0.5786 -0.18
15+
E_coli_K12_BW25113 glucose 5 0 0 0.6234 -0.31
16+
E_coli_K12_BW25113 glucose 5 100 0 0.4272 -0.38
17+
E_coli_K12_BW25113 glucose 5 100 10 0.4555 -0.23
18+
E_coli_K12_BW25113 glucose 6 0 0 0.6238 -0.27
19+
E_coli_K12_BW25113 glucose 6 100 0 0.3949 -0.21
20+
E_coli_K12_BW25113 glucose 6 100 10 0.4264 -0.16
21+
E_coli_K12_BW25113 glycerol 7 0 0 0.3856 -0.19
22+
E_coli_K12_BW25113 glycerol 7 0 10 0.4065 -0.15
23+
E_coli_K12_BW25113 galactose 8 0 0 0.1897 -0.08
24+
E_coli_K12_BW25113 galactose 8 0 10 0.3186 -0.04
25+
E_coli_K12_BW25113 glucose 9 0 0 0.632250927 -0.33
26+
E_coli_K12_BW25113 glucose 9 100 0 0.423267115 -0.23
27+
E_coli_K12_BW25113 glycerol 10 0 0 0.389361548 -0.29
28+
E_coli_K12_BW25113 glycerol 10 0 10 0.402106384 -0.23
29+
E_coli_K12_BW25113 galactose 11 0 0 0.183135751 -0.16
30+
E_coli_K12_BW25113 galactose 11 0 10 0.318044338 0.03

misc.R

+58-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# load dependencies
44

55
library(RColorBrewer)
6-
library(gplots)
76
library(CoRC)
87
library(pso)
98
library(optimx)
9+
library(colorspace)
1010

1111

1212
# polynomial fit
@@ -28,7 +28,7 @@ cost <- function(par, x, ace, func){
2828
if (anyNA(xpred)){
2929
xpred <- rep(1e10, length(x))
3030
}
31-
res <- (xpred - x)**2
31+
res <- ((xpred - x)/0.1)**2
3232
return(sum(res))
3333
}
3434

@@ -39,13 +39,17 @@ sim_sigmoid <- function(par, ace){
3939
return(xpred)
4040
}
4141

42-
fit_sigmoid <- function(x_val, y_val, par_ini_weibull, lower_sigmoid, upper_sigmoid){
42+
fit_sigmoid <- function(x_val, y_val, par_ini_sigmoid, lower_sigmoid, upper_sigmoid){
4343
ord <- order(x_val)
4444
x <- y_val[ord]
4545
ace <- x_val[ord]
4646
ace <- ace[!is.na(x)]
4747
x <- x[!is.na(x)]
48-
res_fit <- psoptim(par=par_ini_sigmoid, fn=cost, x=x, ace=ace, func=sim_sigmoid, lower=lower_sigmoid, upper=upper_sigmoid, control = list(maxit=100000, abstol=1e-6, trace.stats=TRUE))
48+
res_fit <- psoptim(par=par_ini_sigmoid, fn=cost, x=x, ace=ace, func=sim_sigmoid, lower=lower_sigmoid, upper=upper_sigmoid, control = list(maxit=20000, abstol=1e-6, trace.stats=TRUE))
49+
50+
res_stats <- optim(par=res_fit$par, fn=cost, x=x, ace=ace, func=sim_sigmoid, method="L-BFGS-B", hessian = TRUE, lower=lower_sigmoid, upper=upper_sigmoid, control = list(maxit=100))
51+
res_stats$sd <- sqrt(diag(solve(res_stats$hessian)))
52+
res_fit$res_stats <- res_stats
4953
return(res_fit)
5054
}
5155

@@ -199,13 +203,56 @@ plot_with_ci_2 <- function(x1, y1, y2, x2, y3, sd_y3, col, h=NULL, ...){
199203
plot_points(x2, y3, sd_y3, offset=0.002, col=col)
200204
}
201205

202-
plot_with_ci_3 <- function(sim_results, x, specie, col, ...){
203-
plot(sim_results[1,,x], apply(sim_results[,,specie], 2, mean), col=col, type="l", ...)
206+
plot_with_ci_3 <- function(sim_results, x, specie, col, add_to_plot=FALSE, ...){
207+
if (add_to_plot){
208+
lines(sim_results[1,,x], apply(sim_results[,,specie], 2, mean), col=col, ...)
209+
}else{
210+
plot(sim_results[1,,x], apply(sim_results[,,specie], 2, mean), col=col, type="l", ...)
211+
}
204212
polygon(x=c(sim_results[1,,x], rev(sim_results[1,,x])),
205213
y=c(apply(sim_results[,,specie], 2, max), rev(apply(sim_results[,,specie], 2, min))),
206214
col=paste(col, "55", sep=""), border=NA)
207215
}
208216

217+
plot_with_ci_4 <- function(sim_results, x, specie, col, add_to_plot=FALSE, ...){
218+
if (add_to_plot){
219+
lines(sim_results[1,,x], apply(sim_results[,,specie], 2, mean), col=col, ...)
220+
}else{
221+
plot(sim_results[1,,x], apply(sim_results[,,specie], 2, mean), col=col, type="l", ...)
222+
}
223+
polygon(x=c(sim_results[1,,x], rev(sim_results[1,,x])),
224+
y=c(apply(sim_results[,,specie], 2, mean)+apply(sim_results[,,specie], 2, sd), rev(apply(sim_results[,,specie], 2, mean)-apply(sim_results[,,specie], 2, sd))),
225+
col=paste(col, "55", sep=""), border=NA)
226+
}
227+
228+
plot_with_ci_5 <- function(simulation_results, n, x, specie, col, add_to_plot=FALSE, ...){
229+
if (add_to_plot){
230+
lines(x, rev(apply(simulation_results[,,n,specie], 2, mean)), col=col, ...)
231+
}else{
232+
plot(x, rev(apply(simulation_results[,,n,specie], 2, mean)), col=col, type="l", axes=FALSE, ...)
233+
axis(1, at = seq(20,100,by=20), labels = paste(seq(100,20, by=-20)), tick = TRUE)
234+
axis(2, tick = TRUE, las=1)
235+
box()
236+
}
237+
polygon(x=c(x, rev(x)),
238+
y=c(rev(apply(simulation_results[,,n,specie], 2, mean))+rev(apply(simulation_results[,,n,specie], 2, sd)), rev(rev(apply(simulation_results[,,n,specie], 2, mean))-rev(apply(simulation_results[,,n,specie], 2, sd)))),
239+
col=paste(col, "55", sep=""), border=NA)
240+
}
241+
242+
#plot_with_ci_5 <- function(simulation_results, n, x, specie, col, add_to_plot=FALSE, ...){
243+
# if (add_to_plot){
244+
# lines(x, rev(apply(simulation_results[,,n,specie], 2, mean)), col=col, ...)
245+
# }else{
246+
# plot(x, rev(apply(simulation_results[,,n,specie], 2, mean)), col=col, type="l", axes=FALSE, ...)
247+
# axis(1, at = seq(20,100,by=20), labels = paste(seq(100,20, by=-20)), tick = TRUE)
248+
# axis(2, tick = TRUE, las=1)
249+
# box()
250+
# }
251+
# polygon(x=c(x, rev(x)),
252+
# y=c(rev(apply(simulation_results[,,n,specie], 2, min)), rev(rev(apply(simulation_results[,,n,specie], 2, max)))),
253+
# col=paste(col, "55", sep=""), border=NA)
254+
#}
255+
209256
plot_no_ci <- function(fit_results, cond, specie, col, ...){
210257
if (specie %in% dimnames(fit_results[[cond]]$simulations)$specie){
211258
specie_id <- specie
@@ -231,3 +278,8 @@ error.bar <- function(x, y, upper, lower=upper, length=0.05,...){
231278
arrows(x,y+upper, x, y-lower, angle=90, code=3, length=length, ...)
232279
}
233280

281+
get_ace_threshold <- function(ace_flux, ace_conc){
282+
idx <- which.min(abs(ace_flux))
283+
return(ace_conc[idx])
284+
}
285+

0 commit comments

Comments
 (0)