Code and simulated data from: Overexploitation can counteract top-down control and the paradox of enrichment in simple food chains
Data files
Dec 16, 2025 version files 11.63 MB
-
README.md
5.44 KB
-
Resource-Plant-Herbivore.zip
11.62 MB
Abstract
Because of its high abundance or its high feeding intensity, a consumer can overexploit its resource by consuming it on a shorter timescale than resource regeneration. While this short-term overexploitation is widespread in nature, its general implications for biotic control patterns and ecosystem stability are not clear. Here we use a resource-plant-herbivore food chain model allowing for short-term overexploitation (i.e., the plant can overexploit the resource and/or the herbivore can overexploit the plant). We uncover the conditions under which either type of overexploitation occurs and show that they qualitatively change ecological patterns, mainly by suppressing top-down control when interaction strength is high. When plant productivity increases, top-down control patterns are suppressed above the level at which plants start to overexploit resources. Similarly, when herbivory intensity increases, top-down control patterns disappear when plants become overexploited. Overexploitation also prevents enrichment-driven destabilization by capping the energy fluxes in the ecosystem. These findings connect top-down and bottom-up controls in a single framework, and highlight the role overexploitation can play in structuring and stabilizing food chains via the modulation of interaction strengths.
Archived content in Resource-Plant-Herbivore.zip
./datacontains simulated data (see details below)./outputcontains notebooks with figures and supporting information- this directory wraps environments to manage R and Julia installations
notebooks/report_figures.Rmdcontains R code to generate figures from data filesnotebooks/supplement.qmdis used to build the Supporting information pdf. This includes analytical results computed in a Julia notebook.packages/LocalRPHModel.jlcontains the Julia code for simulations- we provide a
Dockerfilefor easier management of software dependencies
data directory
The content of this subdirectory can be re-generated by running the Julia scripts scripts/generate_data_local.jl and scripts/generate_data_si.jl (see below for installation steps). As in Methods and Table 1 in the main manuscript, a denotes herbivory intensity, r denotes plant productivity and nu denotes recycling efficiency.
Data files for the main manuscript figures include:
numerical_stabilities.csv: output of the numerical evaluation of the jacobian matrix around each fixed point for every parameter combination. comma-separated values withequilibrium(fixed point name as in Fig. 2 and equations S1 to S7),a,r,nu,stab(boolean: is the attractor stable),attractor(string: attractor type).stabandattractorare set to "fail" when the (system, parameters) combination yields negative biomass valueseq_validities.csv: validity of each fixed point for each parameter combination, i.e. are the biomass values at each equilibrium meeting the overexploitation conditions for the corresponding system. comma-separated values withequilibrium(fixed point name as in Fig. 2 and equations S1 to S7),a,r,nuandvalid(boolean: is the fixed point valid)transects1.csv: equilibrium biomass values for varying plant productivity. comma-separated values withgrid(string: R, P, H,eqoreq_guess),a,r,ex. Whengridis R, P or H,exis the averaged biomass value at the end of simulations (see Methods) for Resource, Plant and Herbivore biomass, respectively. Whengridiseqoreq_guess,exis the inferred fixed point name. Inference is based on parameter values alone (foreq) or based on the proximity of R,P,H values to fixed point values from Eqs. S1 to S7 (foreq_guess).eq_guessis used in main manuscript figures (seenotebooks/report_figures.Rmd).transects2.csv: equilibrium biomass values for varying herbivory intensity. comma-separated values with same column variables astransects1.csv.
Data files for supplementary figures include:
timeseries.csv: Example timeseries of simulating system (1). comma-separated values witha,r,eq(string: fixed point name),t(timepoint),grid(string: R, P or H for Resource, Plant or Herbivore biomass, respectively),Z(number: biomass value)si_discretized_lv.csv: Timeseries of the simplified Plant-Herbivore system used in SI section 3. comma-separated values withP(Plant biomass),H(herbivore biomass),p_id(parameter combination id), sorted by increasing timepoint.
Installation
For Windows users (and Docker enthusiasts) that do not already have R, Julia and Quarto installed, I would recommend running the project inside a Docker container and mounting the output directories to paths on your computer (here ./output) :
docker build -t resource-plant-herbivore .
docker run -ti -v $(pwd)/container_output:/home/workspace/output -v $(pwd)/container_data:/home/workspace/data resource-plant-herbivore
If you prefer to use the docker volumes interface, you can use docker volume create rph-output and -v rph-output:/home/workspace/output instead to later access the created rph-output volume from Docker Desktop.
Reproducing the analyses
The following steps assume you have installed Julia version >=1.11.2 as well as R >=4.4.
With Julia, run simulations :
- start
julia julia> include("scripts/setup.jl")activate the projectjulia> include("scripts/generate_data_local.jl")run local simulations (~ 5min first time and 2min afterwards)julia> include("scripts/generate_data_si.jl")for analyses from the Supporting information- exit julia
With R, draw the figures
- If you're not running the project from its dedicated container, run
R> renv::restore()to install required packages in the project library. You might need to also install external libraries. R> rmarkdown::render("notebooks/report_figures.Rmd", output_dir = "output")generate a .html with all report figures. Figures are also saved as pdf inoutput/figs
The Supporting information document can be built with Quarto: quarto render notebooks/supplement.qmd --output-dir ../output.
Browsing code
Resource-Plant-Herbivore.jl is just a wrapper project to handle R and Julia environments more easily. Source code for the actual model is located in its own Julia module, in packages/LocalRPHModel.jl. To get access to ? docstrings of functions in LocalRPHModel.jl, you can build its documentation from the Resource-Plant-Herbivore.jl root :
julia> include("./packages/LocalRPHModel.jl/docs/make.jl)
julia> ?LocalRPHModel.traj
Archive includes code necessary to reproduce the manuscript's analyses, as well as generated data and output. Simulations are run using the Julia programming language and visualized with R.
