This project is the replication of ''Biodiversity of plankton by species oscillations and chaos'' by Jeff Huisman and Franz J. Weissing.
Full reference to the original article :
Huisman, J., Weissing, F. Biodiversity of plankton by species oscillations and chaos. Nature 402, 407–410 (1999). https://doi.org/10.1038/46540
The goal of this project was to reproduce the results and figures from Huisman & Weissing (1999) and to test the robustness of those results to perturbations of parameters (these additional tests are hereafter called 'numerical experiments').
The replication of the original article was successful and was submitted to Rescience C. The additional numerical experiments show, however, that the results are not robust to small perturbations of parameter values.
The Article/ subfolder contains the files needed to produce the pdf version of the article.
The code needed to reproduce the article is in the Code/ subfolder.
The Code/Matrix_C and Code/Matrix_K subfolders contain parameter files used by the article that were too large to be conveniently included in the code (respectively the contents of each resource in each species and the half-saturation constant for each resource of each species).
The Code/DataHW1999 subfolder contains the data files generated by the article reproduction code and used to plot the different figures to reproduce.
The Code/DataExp subfolder contains the data files generated by the code for the additional numerical experiments.
The Code/Figures subfolder contains the figures and .tex files generated by the code.
The Code/Fcript_Functions.R file contains functions that are used in the other scripts.
The Code/Script_DataHW1999.R file generates all of the data needed to plot the different Figures of the original article.
The Code/Script_Experiment.R file generates all of the data needed to conduct our numerical experiments and generates the tables used in our article.
The various Code/Script_Fig_% use the data generated earlier to draw and save the various Figures used either in the reproduction part or in the additional numerical experiments part.
As mentioned before, all of the needed files to generate the .pdf article are in the Article/ subfolder. Instructions are in the subfolder .README.
All of the code has been run with R 4.3.1 All scripts should be launched from the Code/ directory.
Numerical integration uses the ode() function from the ''DeSolve'' package in its 1.35 version.
The Figures are plotted using the plotly package for its ability to easily integrate 3D plots into subplots in its 4.10-2 version, and the ggplot2 package for the rather points-heavy Figures, in its 3.4.2 version. We also use the patchwork package to create ggplot2 subplots, in its 1.1.2 version. For the experiments, we simulate a truncated normal distribution using a function from the EnvStats packages that we used in it 2.7.0 version.
You can install required packages in R through
install.packages("deSolve")
install.packages("plotly")
install.packages("ggplot2")
install.packages("patchwork")
install.packages("EnvStats")
Finally, saving the plotly plots into .pdf of .png files requires the save_image() function, which is not available directly in plotly.
You can install it by typing in the R console (Note that this installation requires an installation of python/miniconda, used here in its 23.3.1 version for Conda and in its 3.10.10 version for Python, as well as the reticulate package, the version we used was the 1.30):
install.packages('reticulate')
reticulate::install_miniconda()
reticulate::conda_install('r-reticulate', 'python-kaleido')
reticulate::conda_install('r-reticulate', 'plotly', channel = 'plotly')
reticulate::use_miniconda('r-reticulate')
Sometimes, while trying to save the images with this function, the following error can occur:
NameError: name 'sys' is not defined
It is a common bug that should be fixed with the following commands:
library(reticulate)
reticulate::py_run_string("import sys")
Note that some computations require more time than others, such as those required for the third Figure (bifurcation plots) and the two additional numerical experiments, that run the differential equations for long periods of time and numerous parameter sets. Some calculations during experiments generate errors and warnings that are handled by our code and do not impact the calculation, even if they are displayed.
The following are indicative calculation times for the various parts of the code:
- Calculating data for Figure 1 of the reproduction: 90 seconds
- Calculating data for Figure 2 of the reproduction: 16 seconds
- Calculating data for Figure 3 of the reproduction: 2 hours
- Calculating data for Figure 4 of the reproduction: 2 minutes
- Calculating data for Experience 1: 5 hours
- Calculating data for Experience 2: 5 hours
- Plotting Figure 1 of the reproduction: 11 seconds
- Plotting Figure 2 of the reproduction: 4 seconds
- Plotting Figure 3 of the reproduction: 18 seconds
- Plotting Figure 4 of the reproduction: 6 seconds
- Plotting Figure 1 of the first experience: 5 seconds
- Plotting Figure 2 of the first experience: 50 seconds
- Plotting Figure 1 of the second experience: 4 seconds
- Plotting Figure 2 of the second experience: 45 seconds
- Plotting Figures of the Appendix: 5 minutes
These calculation times are purely indicative and should not be taken literally. Please note as well that in most of the cases, the longer part is the writing of the computation data in the .txt files. Below, however, is the hardware configuration that enabled these calculation times:
Operating system: Fedora Linux 38 Workstation 64 bits Softwares: RStudio 2023.06.0 & R 4.3.1 CPU: Intel® Core™ i7-4510U × 4 Graphics card: NVIDIA GeForce GTX 850M / Intel® HD Graphics 4400 (HSW GT2) RAM: 12,0 Gio