DOI: 10.5281/zenodo.17791136
title: Widespread slowdown in short-term species turnover  despite accelerating climate change

description: R Scripts for 

  Widespread slowdown in species turnover despite accelerating climate change

This repository contains the R scripts used for the analysis presented in the manuscript "Widespread slowdown in species turnover despite accelerating climate change". The scripts are designed to be run sequentially to reproduce the results.

Scripts

The following R scripts are included:

1. 1_Study_gridding_community_partitioning.R: This script processes the raw data from the BioTIME database, focusing on partitioning the data into distinct communities, identified by a unique "rarefyID".

2. 2_Turnover_estimate_new_approach_06May25_HPC_trim_false.R: This script performs community resampling and estimates turnover rates. It is designed for execution on a High-Performance Computing (HPC) cluster to handle the computational demands.  For this, rarefyIDs are split into 54 chunks of 1000, and one call of the script works through one chunk. The chunk number can be passed as the UNIX environment variable SGE_TASK_ID or set manually inside the script. The output of running the script over all chunks is included as a zip file with this submission.  Running one chunk can take several hours on a laptop computer.

3. 3_BioTIME_Slowdown_Post-HPC-run_19May25.R: This script is used after the HPC run of script 2. It collates the turnover rate results from the different parallelised chunks (or alternatively from the provided zip file with the results placed in the same directory as the script), performs necessary statistical analyses, and generates the figures showing the results of the study.

This software requires no installation.

Requirements

To run these scripts, you will need:



R Environment: A working installation of R.

R Packages: Please ensure the pacman package is installed. It will install and load other required packages as required

Data: The analysis requires the BioTIME database files. Please download the BioTIME database (as a .zip file) and its corresponding metadata (as a .csv file), and place them in the same directory as the R scripts.


The code has been tested on

R version 4.1.2 (2021-11-01)Platform: x86_64-pc-linux-gnu (64-bit)Running under: Ubuntu 22.04.5 LTS

with packages

ggtext_0.1.2      readxl_1.4.2      DescTools_0.99.49 ggpubr_0.6.0     data.table_1.14.8 ade4_1.7-22       this.path_2.5.0   iNEXT_3.0.0      vegan_2.6-4       lattice_0.22-5    permute_0.9-7     scales_1.3.0     dggridR_3.0.0     sp_2.1-1          sf_1.0-12         rlang_1.1.1      lubridate_1.9.2   forcats_1.0.0     stringr_1.5.0     dplyr_1.1.2      purrr_1.0.1       readr_2.1.4       tidyr_1.3.0       tibble_3.2.1     ggplot2_3.5.1     tidyverse_2.0.0  

Execution

The scripts should be executed in the following numerical order:1. Run 1_Study_gridding_community_partitioning.R.2. Run 2_Turnover_estimate_new_approach_06May25_HPC_trim_false.R.   * Note: As mentioned above, this version of the script runs only for chunk #1.3. Run 3_BioTIME_Slowdown_Post-HPC-run_19May25.R.You can run these scripts from your R environment or using Rscript from the command line on an HPC or local machine.

Output

When Script 2 is run for all 54 chunks, a key output of Script 3 will be Extended_Data_Table_S1.csv, which corresponds to Extended Data Table S1.  Script 3 also reproduces all other quantitative results of this study, except for Figures S4 and S5. 

Datasets

Chunked_turnover_results_06May25_trim_false.zip is the chunked output from the turnover analysis from the High-Performance Computing. The collated results from the chunked output can be imported into R using the btDT_turnover_results_gridded_filtered.RData. The R object biotime_breakyear_lags and biotime_breakyear_all_lags_and_metrics.csv have the following columns:



rarefyID: The ID is a representation of the communities  

metric: the metric used for the analysis   

N_resamples: Number of resamples used in each break year analysis   

break_year: the break year considered for the analysis

max_lag: the year lag  considered 

overall_turnover: the turnover across all the years for each community analysed

overall_se: the standard error estimate from turnover across all the years for each community analysed

before_turnover: turnover rate estimate before the break year   

before_se: the standard error estimate from the turnover rate before the break year    

since_turnover: turnover rate estimate since the break year     

since_se: the standard error estimate from the turnover rate since the break year        

organisms: the taxon of the community


Included are the data sets used to produce Fig. 1, Figs. 4a, b and c and Fig. 5.



HadCRUT.5.0.1.0.summary_series.global.annual.csv is the dataset used to produce Fig. 1. Global surface atmospheric temperature (GSAT) time series.

Figure_4a_dataset.csv has three columns: Break year, Taxon, and Number of communities. For each breakpoint year, the number and type of communities included in the analysis.

 Figure_4b_dataset.csv was used to produce the median change (column: median) in turnover rate for each breakpoint year (column: break_year) with 95% confidence intervals (columns: lwr_ci for lower confidence interval and upr_ci for upper confidence interval).

Figure_4c_dataset.csv provides a separate analysis for the main community types shown in Fig. 4b. In addition to the columns in Figure_4b_dataset.csv, there is a column named organisms indicating taxa.

Figure_5_dataset.csv   provides the dataset underlying the 1975 breakpoint year. This covers periods before and since the break year by the community time series entering the 1975 break year. 


 

Contact

If you have any questions regarding these scripts, please contact Axel Rossberg at a.rossberg@qmul.ac.uk.