Data and code repository for the manuscript entitled Deciphering probabilistic species interaction networks submitted to Ecology Letters (Banville et al.).
data/: contains all raw, formatted and processed data downloaded online or generated by the scriptscode/: contains all the Julia functions and scripts included inmain.jl, as well as the R script used for data formattingfigures/: contains all figures produced by the scripts and included in the manuscript
Raw data were downloaded from the Supporting Information of Kopelke et al. (2017):
- DOI: https://doi.org/10.1002/ecy.1832
- Downloaded dataset (csv file): ecy1832-sup-0004-Supinfo.csv
The raw data contain information regarding the interactions between willows, willow-galling sawflies, and their natural enemies in different locations across Europe. This file can be found in data/raw/salix_webs.csv, and metadata describing variable names are in data/raw/salix_webs_metadata.csv.
Raw data were formatted using the R script code/00_format_data.r to generate the following relational csv files in data/formatted/:
df_galler.csv: information on willow-galling sawfliesdf_interact.csv: information on the interactions between willows, willow-galling sawflies and parasitoids or inquilinesdf_parasit.csv: information on parasitoids or inquilinesdf_salix_galler.csv: summary statistics on the interactionsdf_salix.csv: information on willowsdf_site.csv: information on the sites (each row corresponds to a willow species sampled at a different time and location)
The variables used in these datasets are the same as those in the raw dataset (metadata found in data/raw/salix_webs_metadata.csv).
Formatted data were processed using the Julia script code/01_process_data.jl to generate local networks for each location and the metaweb for the whole region (objects of type UnipartiteNetwork). The following data files can be found in data/processed/:
local_networks.jld2: stores all local networks of binary interactions containing more than 5 speciesmetaweb.jld2: stores the metaweb of binary interactionssites_lat.csv: contains the latitude of each site
Processed data are used in the scripts code/02_build_prob_networks.jl and code/03_make_figures.jl for the analyses and visualization.
Each script in the code folder achieves a specific purpose:
code/00_format_data.r: generates formatted data from raw datacode/01_process_data.jl: generates processed data from formatted datacode/02_build_prob_networks.jl: builds networks of probabilistic interactions using processed datacode/03_make_figures.jl: makes all figures included in the manuscript using the networks of probabilistic interactions
The script code/00_format_data.r executes the function code/functions/format4R.r. They were both adapted from the scripts provided in the Supplementary Information of Kopelke et al. (2017):
- DOI: https://doi.org/10.1002/ecy.1832
- Original scripts found in ecy1832-sup-0002-AppendixS1.zip
The script code/00_format_data.r must be executed in R. All other scripts are executed in Julia and included in main.jl.
The code folder contains other functions in code/functions/. They are used in the Julia scripts to achieve particular tasks, which are described at the top of each function. All functions are included in main.jl.
The script code/03_make_figures.jl produces the following figures, which were all included in the manuscript:
figures/spatiotemporal_model.png: Parameters of the spatiotemporally explicit model of interactions (Figure 1)figures/network_accumulation.png: Network accumulation curves (Figure 2)figures/spatial_scaling.png: Spatial scaling of interactions (Figure 3)figures/network_sampling.png: Connectance of sampled binary interaction networks (Figure 4)
R can be installed following the instructions provided by Posit. We used R 4.3.2 for this project.
Execute the script code/00_format_data.r to reproduce the formatted data, available in the data/formatted/ folder, from the raw data. This script uses the package magrittr, which can be installed by executing the following command:
install.packages("magrittr")Julia can be installed using the cross-platform installer juliaup to install a specific version of Julia. We used Julia 1.9.4 for this project.
- Follow the juliaup installation instructions.
- Install Julia 1.9.4 through juliaup in a terminal:
juliaup add 1.9.4
The Julia package manager tracks the packages and versions used in the Project.toml and Manifest.toml files. To set up your environment using the same packages and versions:
- Clone this repository and launch Julia from a terminal in the top level folder.
julia +1.9.4 --project
- Install packages
using Pkg; Pkg.instantiate()Execute the script main.jl to reproduce the results and generate the figures of the manuscript. This script imports and loads the necessary Julia packages, the Julia functions found in code/functions/, and the Julia scripts code/01_process_data.jl, code/02_build_prob_networks.jl and code/03_make_figures.jl. Intermediate outputs can be obtained by executing these scripts line by line.