Skip to content

Data and code used to generate the results of the manuscript "Deciphering probabilistic species interaction networks"

License

Notifications You must be signed in to change notification settings

FrancisBanville/ProbabilisticSpeciesInteractionNetworks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProbabilisticSpeciesInteractionNetworks

Data and code repository for the manuscript entitled Deciphering probabilistic species interaction networks submitted to Ecology Letters (Banville et al.).

Folder organization

  • data/: contains all raw, formatted and processed data downloaded online or generated by the scripts
  • code/: contains all the Julia functions and scripts included in main.jl, as well as the R script used for data formatting
  • figures/: contains all figures produced by the scripts and included in the manuscript

Data folder

Raw data

Raw data were downloaded from the Supporting Information of Kopelke et al. (2017):

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.

Formatted data

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 sawflies
  • df_interact.csv: information on the interactions between willows, willow-galling sawflies and parasitoids or inquilines
  • df_parasit.csv: information on parasitoids or inquilines
  • df_salix_galler.csv: summary statistics on the interactions
  • df_salix.csv: information on willows
  • df_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).

Processed data

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 species
  • metaweb.jld2: stores the metaweb of binary interactions
  • sites_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.

Code folder

Each script in the code folder achieves a specific purpose:

  • code/00_format_data.r: generates formatted data from raw data
  • code/01_process_data.jl: generates processed data from formatted data
  • code/02_build_prob_networks.jl: builds networks of probabilistic interactions using processed data
  • code/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):

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.

Figures folder

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)

Installation and execution

R script

Install R

R can be installed following the instructions provided by Posit. We used R 4.3.2 for this project.

Execute the R script

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 scripts

Install Julia

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.

  1. Follow the juliaup installation instructions.
  2. Install Julia 1.9.4 through juliaup in a terminal:
juliaup add 1.9.4

Setting up the environment

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:

  1. Clone this repository and launch Julia from a terminal in the top level folder.
julia +1.9.4 --project
  1. Install packages
using Pkg; Pkg.instantiate()

Execute the main Julia script

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.

About

Data and code used to generate the results of the manuscript "Deciphering probabilistic species interaction networks"

Resources

License

Stars

Watchers

Forks

Packages

No packages published