DOI: 10.5061/dryad.9zw3r22rq
title: Data from: Maintaining local adaptation is key for evolutionary rescue and long-term persistence of populations experiencing habitat loss and a changing environment

description: The Anthropocene is marked by increased population extirpations and
 redistributions driven primarily by human-induced climate change and
 habitat loss. Habitat loss affects populations by removing occupiable
 area, which reduces carrying capacity through a reduction in resources,
 and fragmenting the landscape, which can reduce gene flow with potential
 consequences for adaptation to changing environmental conditions. Real
 patterns of habitat loss are non-random, often clustered in space and
 within a subset of environmental conditions (e.g., primarily in the
 valleys of a mountain-valley region). Spatial clustering of habitat loss
 can alter population connectivity, and environmental clustering can shift
 the mean as well as decrease the variance in environmental conditions
 available to populations. We evaluate how spatial and environmental biases
 underlying habitat loss impact the survival of populations (as a proxy of
 evolutionary rescue) exposed to both habitat loss and environmental
 change. To do this, we simulated landscapes with a spatially
 autocorrelated temperature gradient which individuals were locally adapted
 to. These landscapes were then subject to both non-random habitat loss
 (e.g., clustered based on the temperature) and increasing temperatures. We
 find that evolutionary rescue in response to increasing temperatures is
 hampered when habitat loss results in small patches, reduces the breadth
 of environmental conditions, and is concentrated on the cooler end of the
 temperature gradient. Our findings highlight the importance of maintaining
 a wide breadth of environmental conditions available to populations
 subjected to habitat loss, and the disproportionate role that colder sites
 play as a buffer to increasing temperatures, compared to warmer sites. Our
 findings also add a new dimension to the Single Large or Several Small
 (SLOSS) conservation discussion, stressing the importance of environmental
 diversity regardless of patch size.
description: # Data from: Maintaining local adaptation is key for evolutionary rescue
 and long-term persistence of populations experiencing habitat loss and a
 changing environment
 [https://doi.org/10.5061/dryad.9zw3r22rq](https://doi.org/10.5061/dryad.9zw3r22rq) ## Description of the data and file structure Simulation results and accompanying code from "Baiotto, T. and Guzman, L.M. (2025) Maintaining local adaptation is key for evolutionary rescue and long-term persistence of populations experiencing habitat loss and a changing environment. Submitted to Evolutionary Applications". ### Files and variables This repository contains one file (evolutionary-rescue.zip), with contents described below. ### Directory and File Structure: ``` ├── images ├── other ├── outputs │ ├── spatial │ │ ├── landscapes │ │ ├── simulation_output │ │ └── spinup_files │ └── stats └── script ├── R │ └── addt_functions └── slim ``` The .zip contains several folders. 1) script, which contains the archived script to reproduce simulation results. All files are numbered in the order in which they should be run (01 - 11), and a markdown file titled "main" is also available to run all scripts. 2) other, which contains two CSV files with parameter information for the local and global sensitivity analyses. 3) outputs, which contain two subfolders (spatial and stats). *images*: An empty folder, which is left for ease of running the full script included, since several images are generated. *other:* Contains three files: (1) *other/sensitivity_analysis.csv*, which details the parameter values used for each iteration of the local sensitivity analysis; (2) *other/sensitivity_analysis_global.csv*, which details the min and max possible parameter value for each parameter in the global sensitivity analysis; and (3) *other/sensitivity_analysis_global_samples.rds*, which has the randomly selected parameter values (bounded by min/max values detailed in *other/sensitivity_analysis_global.csv*) for each iteration of the global sensitivity analysis. *outputs:* Contains two sub-folders: (1) *outputs/spatial* and (2) *outputs/stats*. The *outputs/spatial* folder contains all environmental landscapes, represented as a matrix and saved as CSV files, in *outputs/spatial/landscapes* (file name following "[ENV_SEED]_ENV.csv"). Each environmental landscape also has a csv file containing all 100,000 generated habitat loss scenarios, and their corresponding network properties, in the files following the name "[ENV_SEED]_HL_samples.csv". ENV_SEED is a number corresponding to an integer representing a unique environmental landscape. The *outputs/spatial* folder contains all environmental landscapes, represented as a matrix and saved as CSV files, in *outputs/spatial/landscapes* (file name following "[ENV_SEED]_ENV.csv"). Each environmental landscape also has a csv file containing all 100,000 generated habitat loss scenarios, and their corresponding network properties, in the files following the name "[ENV_SEED]_HL_samples.csv". ENV_SEED is a number corresponding to an integer representing a unique environmental landscape. *outputs/spatial/landscapes* also include two other files. (1) *outputs/spatial/landscapes/HLSeedsMainTrend.rds*, which contains the seeds selected using density-weighted sampling used for the generation of habitat loss landscapes used in the main analyses of this project. (2) *outputs/spatial/landscapes/HLSeedsInteractions.rds*, which contains the other habitat loss landscape generation seeds used in the interaction analyses of this project. Both .rds files contain a named list of vectors. The names of the vectors correspond to the environmental landscape seed, and the values in the vectors are the selected seeds used for different habitat loss scenarios (for that specific environmental landscape). The *outputs/spatial* folder contains all simulation spinup files in *outputs/spatial/spinup_files*. These are named following "[ENV_SEED][HL_SEED][PREFIX]populations.txt" for temporary population files output from Slim which details each individual in the population and all mutations that individual contains, and "[ENV_SEED][SLIM_SEED]_[PREFIX]_muts.txt" for mutation files output from Slim, which categorize the location and effect size of each mutation in the population. ENV_SEED is a number corresponding to an integer representing a unique environmental landscape. SLIM_SEED is a number corresponding to an integer representing a replicate population. PREFIX is used to differentiate replicate populations that underwent spinup using different simulation parameters. The *outputs/spatial* folder contains all simulation outputs in *outputs/spatial/simulation_output*. Files are saved as .txt and named according to "ENV[ENV_SEED]_out_summary[SUFFIX].txt". Thus, all simulation outputs for the same simulation scenario and environmental landscape are saved in the same file. Each row in each file represents the outcomes of an individual replicate population facing a specific habitat loss scenario. The SUFFIX is used to distinguish simulation scenarios with different governing parameters (CCO is for main simulations without climate change; CC3 is for main simulations with climate change; interactions are for interaction simulations; sensitivity is for local sensitivity analyses and corresponds to the suffix outlined in the *other/sensitivity_analysis.csv*; globalSA is for each unique combination of parameters used in the global sensitivity analysis. *script* contains two subfolders, (1) *script/R* and (2) *script/slim*, and one script file, *script/main.qmd*. *script/R* contains all scripts needed to reproduce the included results, and are numbered in the order in which they should be run (01-11). Additional functions that are sourced throughout the script are included in *script/R/addt_functions*. *script/slim* contains the slim script to spinup populations prior to habitat loss and environmental change (*script/slim/continuous_s.slim*), and the script to impose pressures on the population and save the final population state (*script/slim/continuous_n.slim*). ### Description: **outputs/spatial/simulation_output** * *ENV_SEED*: the number representing a unique environmental landscape (integer) * *HL_SEED*: the number representing a unique habitat loss scenario, derived from the large file of generated habitat loss scenarios prior to density-weighted sampling (integer) * *SLIM_SEED*: the number representing a replicate population (integer) * *end_tick*: last generation of the simulation that contained any individuals (integer) * *proportion_original_pop_size*: the proportion of the population still present at generation end_tick, relative to the population size at generation 10000 (float) * *phenotypic_variance*: the variance in phenotypes of the quantitative trait that defines the preferred environmental condition of an individual (float) * *propotion_original_muts*: the proportion of non-neutral variants still present at generation end_tick, relative to the number at generation 10000 (float) * *avg_movement*: the average distance moved by an individual between generation 10000 and end_tick (float) * *avg_movement_num*: the average number of times an individual moved between generation 10000 and end_tick (float) **Other important variables present in other files:** * *envSeed*: equivalent to ENV_SEED (integer) * *hlSeed* - equivalent to HL_SEED (integer) * *envMean* - the mean environmental condition of the corresponding environmental landscape, given the corresponding hlSeed habitat scenario occurs (float) * *envBreadthLoss* - the breadth of environmental conditions lost in the environmental landscape following the corresponding habitat loss scenario (float) * *acLen* - the autocorrelation length used to generate the corresponding habitat loss scenario (float) ## Access information Other publicly accessible locations of the code used to generate these simulations: * **Github:** [https://github.com/baiottoe/evolutionary-rescue](https://github.com/baiottoe/evolutionary-rescue)