dunhill_toarcian

Code to Reproduce Dunhill et al analysis of secondary extinctions in Toarcian food webs, submitted to Nature Ecology and Evolution for review.

The project assumes the user has R and RStudio installed.

To initiate the project, after cloning/downloading the file containing the Scripts and Data and project file, the user should double click the project file dunhill_toarcian.Rproj.

Details for each file are provided below.

The reader/replicator/referee can start with network generation, scenario modelling or plotting/analysis. The data from each of those steps is provided and the use of read_csv() or load() data is embedded in each stage to acquire the previous stages data.

Data Files

- ToarcianWebs_Guild_May2021.RData - core input data of Toarcian Network
- wrkWebs_allSeqs.RData - output from GenerateExintctionSequences (can be recreated with set.seed()) and used (loaded) in AnalyseToarcianNetworks.
- metrics_time2.csv - details among times slices on network metrics
- metrics_time.csv - details among times slices on network metrics

Food Web Generation, Scenario Generation, Scenario Modelling, Robustness

  1. pfwim.R - This file contains the functions necessary to construct food webs using Shaw et al (https://www.biorxiv.org/content/10.1101/2024.01.30.578036v1) method described in the MS. It also contains bespoke functions to calcuate several metrics and motifs. This is a self contained subset of the PFIM code base and does not require the package in that pre-print.
  2. GenerateExtinctionSequences.R is the primary tool to generate the secondary extinction scenarios from the networks. The code -
  3. robustness_gradient.R - function to cacluate robustness following generalised method from Jonsson et al Oikos 124: 446–457, 2015

Visualisation of networks in 3D - produces features for Fig 1

  1. plot_3d_foodwebs_orig.R - Shaw et al (https://www.biorxiv.org/content/10.1101/2024.01.30.578036v1) functions to plot food webs in 3D.
  2. See MakeCompositeFigure.R for final figure.

Analysis of secondary exinction scenarios - Produces Figure 2a,b.

1.AnalyseToarcianNetworks.R - estimates several structural metrics, motifs and True Skill Statistic from secondary extinction scenarios and the outcome networks.

Analysis of network structure through time - Produces Figure 2c,d.

1.guild network metric plotting.R accesses combined data generated by GuildWebsBuildPlotAnalyse.R in Reference-Scratch

Make Composite Fig 2a-d

1.MakeCompositeFigure.R - uses patchwork in R to combine figures

Robustness Evaluation Fig 4

1.RobustnessTest_FineScale.R - uses robustness_gradient.R above to generate analysis and Fig 4.