DOI: 10.6084/m9.figshare.28062653.v1
title: BEF_Coextinctions_Repo

description: OverviewThis repository contains all data, code, and supplementary materials associated with the manuscript "<i>Co-extinctions and co-compensatory species responses to climate change moderate ecosystem futures</i>". The repository enables full reproduction of all analyses, figures, and results presented in the paper.Repository Structure📁 Data FilesRaw Data<code><strong>ChAOS_2018_macrofauna_data.csv</strong></code> - Original macrofaunal survey data from the ChAOS 2018 sampling campaign<b>Columns</b>: <code>ScientificName_accepted</code>, <code>Mi</code> (mobility trait, 1-4 scale), <code>Ri</code> (reworking trait, 1-5 scale), <code>Source</code> (trait classification source), <code>Link</code>, <code>Year</code> (sampling year), <code>Station</code>, <code>Replicate</code>, <code>Abundance</code> (total abundance), <code>Biomass</code> (total biomass in grams)Contains species-level abundance and biomass with functional traitsUsed in: <code>CoExt_ChAOS_SupplementaryCode.Rmd</code>Processed Data<code><strong>ChAOS_2018_macrofauna_model_ready.csv</strong></code> - Model-ready macrofaunal dataset with extinction scenarios<b>Columns</b>: <code>ScientificName_accepted</code>, <code>Habitat</code> (Arctic/Boreal region), <code>Station</code> (pre-extinction station), <code>Scenario</code> (extinction scenario, e.g., B17-B16), <code>Mi</code>, <code>Ri</code>, <code>Bi</code> (mean individual body size in grams), <code>Ai</code> (mean abundance at pre-extinction station), <code>Btot</code> (total biomass at pre-extinction station), <code>Atot</code> (total abundance at pre-extinction station), <code>Bind_Habitat</code> (mean body size within habitat), <code>Bind_Scenario</code> (mean body size across scenario stations), <code>B_Vulnerability</code> (vulnerability rank score based on Table S2), <code>Amed</code> (median abundance in post-extinction regional pool)<b>B_Vulnerability</b>: Ranked vulnerabilities to climate-driven transitions based on percentage biomass differences between pre-extinction (northernmost) and post-extinction (southernmost) stations for regional species pool (n=113). "Inf." indicates taxa absent from pre-extinction but present in post-extinction communities.Species-level data structured for co-extinction modeling across climate scenariosUsed in: <code>CoExt_ChAOS_model.Rmd</code><code><strong>ChAOS_2018_allstations_Competitors[based_off_Biomass].csv</strong></code> - Pairwise species competition coefficients (Table S3b)<b>Columns</b>: Row number, <code>x</code> (species 1), <code>y</code> (species 2), <code>correlation_coefficient</code> (Pearson correlation)Contains negative correlations (n = 6) ≥1.5 standard deviations from mean coefficient valueRepresents competitive interactions between species pairsReferenced as Table S3(b) and Figure S4 in manuscriptUsed in: <code>CoExt_ChAOS_model.Rmd</code><code><strong>ChAOS_2018_allstations_Co_Occurence[based_off_Biomass].csv</strong></code> - Species co-occurrence correlation matrix (Table S3a)<b>Columns</b>: Row number, <code>x</code> (species 1), <code>y</code> (species 2), <code>correlation_coefficient</code> (Pearson correlation)Contains positive correlations (n = 460) representing co-occurrence patternsSpatial co-occurrence relationships derived from biomass distributionsReferenced as Table S3(a) in manuscriptUsed in: <code>CoExt_ChAOS_model.Rmd</code>📁 Code FilesMain Analysis Scripts<code><strong>CoExt_ChAOS_model.Rmd</strong></code> - Primary co-extinction and compensation model<b>Purpose</b>: Implements species extinction and compensation dynamics across Barents Sea climate gradient<b>Study System</b>: Macrobenthic communities from 2018 ChAOS expedition (RRS James Clark Ross)<b>Scenarios</b>: Six climate transition levels (B17→B16, B16→B15, B15→Xs, Xs→B14, B14→B13, B17→B13)<b>Model Framework</b>: Species sensitivity based on biomass differences between adjacent stations; co-occurrence relationships determine secondary extinctions and compensatory responses<b>Function</b>: Runs the model and generates Model Output Files needed for manuscript figures<b>Output Variables</b>:<code>Simulation</code>: Simulation number<code>Nsp</code>: Total species remaining in community<code>CompRep</code>: Number of compensating species per extinction<code>Nsp_active</code>: Number of species present (active) in community<code>ExtSp</code>: Species going extinct at next step<code>CoExtSp</code>: Species undergoing co-extinction at next step<code>CompSp</code>: Species compensating at next step<code>AbnComp</code>: Abundance increase in compensating species<code>BioComp</code>: Biomass increase in compensating species<code>BioLost</code>: Biomass lost per extinction (if compensation incomplete)<code>TotBio</code>: Total community biomass remaining<b>Key Features</b>: Only present species can go extinct; all non-extinct species can compensate; extinction is permanentDependencies: See <code>sessionInfo()</code> output in script<code><strong>CoExt_ChAOS_SupplementaryCode.Rmd</strong></code> - Data processing and supplementary analyses<b>Purpose</b>: Data wrangling, quality control, and supplementary code chunks S1-S8<b>Study System</b>: Same Barents Sea macrobenthic dataset from 2018 ChAOS expedition<b>Content</b>: Initial data processing pipeline and supplementary analyses referenced in main manuscript<b>Prerequisites</b>: Should be run before main model scriptGenerates supplementary figures and tables📁 Model Output FilesFull Model (Co-extinction + Co-compensation)<code><strong>Full_Model_Coext_Cocomp_Output_[1-6].csv</strong></code> - Main model results (500 simulations per scenario)<b>Columns</b>: <code>Simulation</code>, <code>Nsp</code>, <code>CompRep</code>, <code>Nsp_active</code>, <code>ExtSp</code>, <code>CoExtSp</code>, <code>CompSp</code>, <code>AbnComp</code>, <code>BioComp</code>, <code>BioLost</code>, <code>TotBio</code> (see main script documentation for variable definitions)Used in: Main manuscript figures<code><strong>Full_Model_Coext_Cocomp_Output_[1-6].rds</strong></code> - Species-level contributions dataframe ⚠️ <b>Large files</b><b>Columns</b>: <code>Simulation</code>, <code>Nsp</code>, <code>Nsp_active</code>, <code>species</code> (ScientificName_accepted), <code>species_AiSim</code>, <code>species_Bind</code>, <code>species_Mi</code>, <code>species_Ri</code>, <code>species_BPi</code>, <code>BPc</code>Contains full community state at each simulation iteration for detailed analysisMemory intensive: Complete species-by-simulation matricesReduced Model (Co-extinction only)<code><strong>Reduced_Model_Coext_No_Comp_Output_[1-6].csv</strong></code> - Model results without compensation mechanismsSame column structure as Full Model outputsUsed for: Isolating co-extinction effects and model comparisonsUsed in: Main manuscript figures<code><strong>Reduced_Model_Coext_No_Comp_Output_[1-6].rds</strong></code> - Species contributions without compensation ⚠️ <b>Large files</b>Simple Model (No interactions)<code><strong>Simple_Model_No_Coext_No_Comp_Output_[1-6].csv</strong></code> - Baseline model without species interactionsSame column structure as other model outputsUsed for: Baseline comparisons in main manuscript figures<code><strong>Simple_Model_No_Coext_No_Comp_Output_[1-6].rds</strong></code> - Species contributions without interactions ⚠️ <b>Large files</b>Usage InstructionsSystem Requirements<b>R version</b>: 4.4.2 (2024-10-31) or higher<b>Required packages</b>:<b>Main model</b>: <code>tidyverse</code>, <code>rio</code>, <code>patchwork</code>, <code>data.table</code>, <code>formatR</code><b>Supplementary code</b>: <code>tidyverse</code>, <code>Hmisc</code>, <code>qgraph</code>, <code>rio</code>, <code>patchwork</code>, <code>MetBrewer</code>, <code>ggpmisc</code>, <code>mgcv</code><b>Recommended RAM</b>: ≥ 16GB (for .rds contribution files)<b>Runtime estimates</b>: 5-20 minutes per scenario (500 simulations)Full Model: ~20 minutes per scenarioReduced Model: ~10-15 minutes per scenarioSimple Model: ~5-10 minutes per scenarioTotal runtime for all models: ~3-6 hoursWorkflow<b>Data Preparation</b>: Run <code>CoExt_ChAOS_SupplementaryCode.Rmd</code> firstProcesses raw data and generates derived datasetsCreates supplementary materials<b>Main Analysis</b>: Run <code>CoExt_ChAOS_model.Rmd</code>Requires processed data from step 1Generates main manuscript results<b>Model Outputs</b>: Pre-computed model results are provided for referenceCan be used to reproduce figures without re-running computationally intensive modelsFull model re-runs will overwrite these filesReproducibility NotesAll model outputs provided are used directly in main manuscript figures<b>Package management</b>: Automated installation of missing packages included in scripts<b>Computational considerations</b>: .rds contribution files are memory-intensive; consider available RAM before loadingSession information available in script outputsCitationIf using this code or data, please cite:<pre><pre>@article{Williams2025,<br> author = "Tom Williams",<br> title = "{BEF_Coextinctions_Repo}",<br> year = "2025",<br> month = "9",<br> url = "https://figshare.com/articles/dataset/BEF_Coextinctions_Repo/28062653",<br> doi = "10.6084/m9.figshare.28062653.v1"<br>}<br></pre></pre>ContactFor questions regarding data or code, see contact info on associated paper.LicenseThis work is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0)AcknowledgmentsSee main manuscript for complete acknowledgments of funding sources and collaborators.