This repository includes all the scripts to reproduce the theoretical investigations carried out in our paper "On the Dynamic Nature of Omnivory in a Changing World" (a study codenamed 'Labmnivory').
Simulations are implemented in Julia, a recent version of Julia is required to reproduce the analysis (note that the code was only tested for Julia v1.7.0) along with the following packages (note that they can be installed using src/install_packages.jl
in this repository, see below):
Package | Links |
---|---|
DifferentialEquations | repo |
ForwardDiff | repo |
LinearAlgebra | doc |
NLsolve | repo |
Parameters | repo |
PyPlot | repo |
QuadGK | repo |
RecursiveArrayTool | repo |
Statistics | repo |
FileIO | repo |
JLD2 | repo |
Then, clone this repository using git:
git clone https://github.com/McCannLab/Labmnivory.git
or downloaded the zip file. If you haven't yet installed the packages, you can actually use src/install_packages.jl
in this repository. To do so, in a terminal, set your working directory at the root of the freshly cloned/downloaded repository, then use the following command line :
julia src/install_packages.jl
You should now be ready to reproduce the analysis.
src
: include source code.fig/
: where figures are exported to.fig/final
: final figures (after edition with Inkscape), available as SVG (/svg/
) and EPS (/eps/
).
install_packages.jl
: contains code to install packages required;basic_omnivory_module.jl
: includes all basic building blocs including the basic set of ODEs (model!()
) and the functions to compute the different metrics (e.g.overshoot()
);pulse.jl
: functions to run pulse analysis;press.jl
: functions to run press analysis;fig_press.jl
: script to create pulse figure panels (Figs. 3 (a-c), 4 (a-c), S3 (a-c), S4 (a-c));fig_pulse.jl
: script to create press figure panels (Figs. 3 (d-f), 4 (d-f), S3 (d-f), S4 (d-f));fig_S1.jl
: script to create figure S1;fig_S2.jl
: script to create figure S2;pipeline.jl
: orchestrates the different scripts to reproduce the analysis.
In a terminal, assuming the working directory is the root of the freshly cloned/downloaded repository, use the following command line to reproduce the analysis.
julia src/pipeline.jl
Scripts have been commented for ease of comprehension but if you still have some questions regarding the numerical implementation, do not hesitate to create an issue.