DOI: 10.5061/dryad.fqz612k51
title: Data and code from: Spatial storage effect facilitates evolutionary rescue in rapidly changing environments

description: The storage effect is a plausible natural mechanism that generates
 balanced genetic polymorphism in temporally varying environments. Balanced
 polymorphism may facilitate evolutionary rescue, promoting the persistence
 of populations otherwise destined for extinction. However, it is unknown
 whether the storage effect can be established in small populations whose
 size is allowed to vary, and if so, whether it will lead to evolutionary
 rescue. In this study, we investigate whether the spatial storage effect
 emerges and facilitates evolutionary rescue across small populations of
 variable sizes that inhabit heterogeneous, temporally varying environments
 and exchange migrants. We use an eco-evolutionary model to examine the
 phenomenon under a wide set of conditions, including the magnitudes and
 periods of temporal variation, habitat harshness, migration rates, the
 degrees of spatial heterogeneity, and increasing fitness oscillations over
 time, all within the framework of the logistic population growth model. We
 find that the storage effect emerges and that it increases the persistence
 of populations in harsh, temporally varying habitats beyond levels
 expected in the absence of the mechanism. This mechanism demonstrates how
 rapid evolution broadens the known conditions for population persistence
 in the face of rapid and continuous environmental changes.
description: # Data and code from: Spatial storage effect facilitates evolutionary
 rescue in rapidly changing environments Dataset DOI:
 [10.5061/dryad.fqz612k51](10.5061/dryad.fqz612k51) ## Description of the
 data and file structure This package contains C programs used to generate
 the selection coefficients to mimic varying selection, tra.c, (developed
 by Gulisija and Kim 2015) and forward-in-time eco-evolutionary dynamics
 involving the spatial storage effect in temporally varying habitats
 (PRE.c), used in Rowland and Gulisija. 2025. Spatial Storage Effect
 Facilitates Evolutionary Rescue in Rapidly Changing Environments. To run,
 please compile using: gcc -Wall 'exe_file' -o
 'program.c' -lm , or cc 'program.c' -lm -o
 'exe_file' Brief descriptions of the programs and their input
 files follow: tra.c This program generates time-dependent selection
 coefficients (st). The input file 'parst' provides the total
 number of coefficients to be produced (TIME = 3 periods), period = P, and
 the smax. The output file is a column of values of st. The output file
 name is given as trajectory.PERIOD.WIDTH but the name should be changed to
 trajectory to be read by PRE.c. PRE.c This program simulates the
 eco-evolutionary dynamics. It requires three input files:
 "trajectory" - contains three cycles of the "st",
 generated by tra.c. "pars1" - contains a single number
 corresponding to the migration rate. In the sample 'pars1' the
 migration rate is 0.0125, which corresponds to 50 migrants at the carrying
 capacity of 4000. "distr" - contains the counts of frequencies
 of derived allele out of 16000 simulation runs. From this distribution the
 populations are initiated, randomly, at the onset of selection. The sample
 distribution is generated under parameters and drift as reported in the
 manuscript (see Figure S1). This distribution can be preset (with total
 counts summing up to 16000) or simulated using PRE.c until equilibrium is
 confirmed with 16000 replicates and tallying up the occurrences
 (frequencies) for allele frequency. Based on the parameters provided by
 the input files and those included in PRE.c, the system will eco-evolve
 until either the maximum simulation time of 100K (400000 generations) is
 reached or the population goes extinct (population size in V falls below
 100 individuals, critical value based on Gomulkiewicz & Holt, 1995).
 The output file (outst) reports: P (number of generations per cycle of
 selection), smax (maximum numerator fitness deviation due to varying
 selection), Migrants, mu (recurrent mutation rate), G RATE V (growth rate
 in V), G Rate R (growth rate in R), REPS (number of replicate
 populations), MaxTime (maximum simulation time), cumuHL (cumulative
 heterozygosity for metapopulation), HLpB (cumulative heterozygosity for
 V), timeEqu (number of replicate populations that persist to max time),
 polymorphs (number of polymorphic populations at max time), aveNtotal
 (average metapopulation size), aveNV (average population size in V),
 minExt (average survival time), extincts (proportion of replicate
 populations that went extinct) ### Files and variables #### File: distr
 **Description:** Input file for PRE.c that contains the counts of
 frequencies of derived allele out of 16000 simulation runs. From this
 distribution the populations are initiated, randomly, at the onset of
 selection. The sample distribution is generated under parameters and drift
 as reported in the manuscript (see Figure S1). This distribution can be
 preset (with total counts summing up to 16000) or simulated using PRE.c
 until equilibrium is confirmed with 16000 replicates and tallying up the
 occurrences (frequencies) for allele frequency. #### File: outst
 **Description:** Output file for PRE.c that reports P (number of
 generations per cycle of selection), smax (maximum numerator fitness
 deviation due to varying selection), Migrants, mu (recurrent mutation
 rate), G RATE V (growth rate in V), G Rate R (growth rate in R), REPS
 (number of replicate populations), MaxTime (maximum simulation time),
 cumuHL (cumulative heterozygosity for metapopulation), HLpB (cumulative
 heterozygosity for V), timeEqu (number of replicate populations that
 persist to max time), polymorphs (number of polymorphic populations at max
 time), aveNtotal (average metapopulation size), aveNV (average population
 size in V), minExt (average survival time), extincts (proportion of
 replicate populations that went extinct) #### File: parst
 **Description:** Input file for tra.c that provides the total number of
 coefficients to be produced (TIME = 3 periods), period = P, and the smax.
 The output file is a column of values of st. The output file name is given
 as trajectory.PERIOD.WIDTH but the name should be changed to trajectory to
 be read by PRE.c. #### File: pars1 **Description:** Input file for PRE.c
 that contains a single number corresponding to the migration rate. In the
 sample 'pars1' the migration rate is 0.0125, which corresponds
 to 50 migrants at the carrying capacity of 4000. #### File: PRE.c
 **Description:** This program simulates the eco-evolutionary dynamics and
 is the main code used in the study. #### File: README.txt
 **Description:** describes the package of programs used to generate the
 selection coefficients to mimic varying selection, tra.c, (developed by
 Gulisija and Kim 2015) and forward-in-time eco-evolutionary dynamics
 involving the spatial storage effect in temporally varying habitats
 (PRE.c), used in Rowland and Gulisija. 2025. Spatial Storage Effect
 Facilitates Evolutionary Rescue in Rapidly Changing Environments. ####
 File: tra.c **Description:** This program generates time-dependent
 selection coefficients (st). The input file 'parst' provides the
 total number of coefficients to be produced (TIME = 3 periods), period =
 P, and the smax. The output file is a column of values of st. The output
 file name is given as trajectory.PERIOD.WIDTH but the name should be
 changed to trajectory to be read by PRE.c. #### File: trajectory
 **Description:** Input file for PRE.c that contains three cycles of the
 "st", generated by tra.c. ## Code/software This package contains
 C programs used to generate the selection coefficients to mimic varying
 selection, tra.c, (developed by Gulisija and Kim 2015) and forward-in-time
 eco-evolutionary dynamics involving the spatial storage effect in
 temporally varying habitats (PRE.c), used in Rowland and Gulisija. 2025.
 Spatial Storage Effect Facilitates Evolutionary Rescue in Rapidly Changing
 Environments. To run, please compile using: gcc -Wall 'exe_file'
 -o 'program.c' -lm , or cc 'program.c' -lm -o
 'exe_file' Output files can be viewed as text files