Data and code for: Multiple genetic impacts of immigration interact to shape local population persistence versus extinction
Data files
Jul 30, 2025 version files 1.78 MB
-
juv.surv.prob.data.N40.Imm0.Igg0.8.ID5.Va0.1.txt
26.42 KB
-
juv.surv.prob.data.N40.Imm0.Igg1.2.ID6.Va0.06.txt
31.20 KB
-
juv.surv.prob.data.N40.Imm0.Igg1.6.ID8.Va0.06.txt
21.38 KB
-
juv.surv.prob.data.N40.Imm1.Igg0.8.ID5.Va0.1.txt
28.96 KB
-
juv.surv.prob.data.N40.Imm1.Igg1.2.ID6.Va0.06.txt
28.03 KB
-
juv.surv.prob.data.N40.Imm1.Igg1.6.ID8.Va0.06.txt
22.38 KB
-
juv.surv.prob.data.N40.Imm2.Igg0.8.ID5.Va0.1.txt
30.90 KB
-
juv.surv.prob.data.N40.Imm2.Igg1.2.ID6.Va0.06.txt
26.07 KB
-
juv.surv.prob.data.N40.Imm2.Igg1.6.ID8.Va0.06.txt
21.17 KB
-
max.break.counter.N40.Imm0.Igg0.8.ID5.Va0.1.txt
6.40 KB
-
max.break.counter.N40.Imm0.Igg1.2.ID6.Va0.06.txt
6.40 KB
-
max.break.counter.N40.Imm0.Igg1.6.ID8.Va0.06.txt
6.40 KB
-
max.break.counter.N40.Imm1.Igg0.8.ID5.Va0.1.txt
6.40 KB
-
max.break.counter.N40.Imm1.Igg1.2.ID6.Va0.06.txt
6.40 KB
-
max.break.counter.N40.Imm1.Igg1.6.ID8.Va0.06.txt
6.40 KB
-
max.break.counter.N40.Imm2.Igg0.8.ID5.Va0.1.txt
6.40 KB
-
max.break.counter.N40.Imm2.Igg1.2.ID6.Va0.06.txt
6.40 KB
-
max.break.counter.N40.Imm2.Igg1.6.ID8.Va0.06.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm0.Igg0.8.ID5.Va0.1.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm0.Igg1.2.ID6.Va0.06.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm0.Igg1.6.ID8.Va0.06.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm1.Igg0.8.ID5.Va0.1.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm1.Igg1.2.ID6.Va0.06.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm1.Igg1.6.ID8.Va0.06.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm2.Igg0.8.ID5.Va0.1.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm2.Igg1.2.ID6.Va0.06.txt
6.40 KB
-
max.break.counter.stoch.N40.Imm2.Igg1.6.ID8.Va0.06.txt
6.40 KB
-
med.bv.js.base.data.N40.Imm0.Igg0.8.ID5.Va0.1.txt
26.75 KB
-
med.bv.js.base.data.N40.Imm0.Igg1.2.ID6.Va0.06.txt
31.84 KB
-
med.bv.js.base.data.N40.Imm0.Igg1.6.ID8.Va0.06.txt
22.20 KB
-
med.bv.js.base.data.N40.Imm1.Igg0.8.ID5.Va0.1.txt
28.44 KB
-
med.bv.js.base.data.N40.Imm1.Igg1.2.ID6.Va0.06.txt
28.12 KB
-
med.bv.js.base.data.N40.Imm1.Igg1.6.ID8.Va0.06.txt
22.42 KB
-
med.bv.js.base.data.N40.Imm2.Igg0.8.ID5.Va0.1.txt
31.20 KB
-
med.bv.js.base.data.N40.Imm2.Igg1.2.ID6.Va0.06.txt
26.87 KB
-
med.bv.js.base.data.N40.Imm2.Igg1.6.ID8.Va0.06.txt
22.16 KB
-
med.bv.js.tot.data.N40.Imm0.Igg0.8.ID5.Va0.1.txt
26.75 KB
-
med.bv.js.tot.data.N40.Imm0.Igg1.2.ID6.Va0.06.txt
31.84 KB
-
med.bv.js.tot.data.N40.Imm0.Igg1.6.ID8.Va0.06.txt
22.20 KB
-
med.bv.js.tot.data.N40.Imm1.Igg0.8.ID5.Va0.1.txt
28.77 KB
-
med.bv.js.tot.data.N40.Imm1.Igg1.2.ID6.Va0.06.txt
28.50 KB
-
med.bv.js.tot.data.N40.Imm1.Igg1.6.ID8.Va0.06.txt
22.69 KB
-
med.bv.js.tot.data.N40.Imm2.Igg0.8.ID5.Va0.1.txt
31.89 KB
-
med.bv.js.tot.data.N40.Imm2.Igg1.2.ID6.Va0.06.txt
27.34 KB
-
med.bv.js.tot.data.N40.Imm2.Igg1.6.ID8.Va0.06.txt
22.37 KB
-
med.f.data.N40.Imm0.Igg0.8.ID5.Va0.1.txt
23.78 KB
-
med.f.data.N40.Imm0.Igg1.2.ID6.Va0.06.txt
29.23 KB
-
med.f.data.N40.Imm0.Igg1.6.ID8.Va0.06.txt
19.10 KB
-
med.f.data.N40.Imm1.Igg0.8.ID5.Va0.1.txt
26.17 KB
-
med.f.data.N40.Imm1.Igg1.2.ID6.Va0.06.txt
25.57 KB
-
med.f.data.N40.Imm1.Igg1.6.ID8.Va0.06.txt
19.48 KB
-
med.f.data.N40.Imm2.Igg0.8.ID5.Va0.1.txt
28.58 KB
-
med.f.data.N40.Imm2.Igg1.2.ID6.Va0.06.txt
22.71 KB
-
med.f.data.N40.Imm2.Igg1.6.ID8.Va0.06.txt
17.58 KB
-
med.igc.data.N40.Imm0.Igg0.8.ID5.Va0.1.txt
8.19 KB
-
med.igc.data.N40.Imm0.Igg1.2.ID6.Va0.06.txt
7.82 KB
-
med.igc.data.N40.Imm0.Igg1.6.ID8.Va0.06.txt
8.49 KB
-
med.igc.data.N40.Imm1.Igg0.8.ID5.Va0.1.txt
22.02 KB
-
med.igc.data.N40.Imm1.Igg1.2.ID6.Va0.06.txt
20.83 KB
-
med.igc.data.N40.Imm1.Igg1.6.ID8.Va0.06.txt
14.94 KB
-
med.igc.data.N40.Imm2.Igg0.8.ID5.Va0.1.txt
24.91 KB
-
med.igc.data.N40.Imm2.Igg1.2.ID6.Va0.06.txt
19.51 KB
-
med.igc.data.N40.Imm2.Igg1.6.ID8.Va0.06.txt
15.08 KB
-
pop.size.data.N40.Imm0.Igg0.8.ID5.Va0.1.txt
8.05 KB
-
pop.size.data.N40.Imm0.Igg1.2.ID6.Va0.06.txt
8.17 KB
-
pop.size.data.N40.Imm0.Igg1.6.ID8.Va0.06.txt
7.30 KB
-
pop.size.data.N40.Imm1.Igg0.8.ID5.Va0.1.txt
8.22 KB
-
pop.size.data.N40.Imm1.Igg1.2.ID6.Va0.06.txt
7.84 KB
-
pop.size.data.N40.Imm1.Igg1.6.ID8.Va0.06.txt
7.32 KB
-
pop.size.data.N40.Imm2.Igg0.8.ID5.Va0.1.txt
8.50 KB
-
pop.size.data.N40.Imm2.Igg1.2.ID6.Va0.06.txt
7.67 KB
-
pop.size.data.N40.Imm2.Igg1.6.ID8.Va0.06.txt
7.26 KB
-
pop.size.data.neutral.txt
18.38 KB
-
pop.size.data.stoch.N40.Imm0.Igg0.8.ID5.Va0.1.txt
7.78 KB
-
pop.size.data.stoch.N40.Imm0.Igg1.2.ID6.Va0.06.txt
7.90 KB
-
pop.size.data.stoch.N40.Imm0.Igg1.6.ID8.Va0.06.txt
7.39 KB
-
pop.size.data.stoch.N40.Imm1.Igg0.8.ID5.Va0.1.txt
7.96 KB
-
pop.size.data.stoch.N40.Imm1.Igg1.2.ID6.Va0.06.txt
7.86 KB
-
pop.size.data.stoch.N40.Imm1.Igg1.6.ID8.Va0.06.txt
7.40 KB
-
pop.size.data.stoch.N40.Imm2.Igg0.8.ID5.Va0.1.txt
8.08 KB
-
pop.size.data.stoch.N40.Imm2.Igg1.2.ID6.Va0.06.txt
7.67 KB
-
pop.size.data.stoch.N40.Imm2.Igg1.6.ID8.Va0.06.txt
7.26 KB
-
README_Final.txt
12.33 KB
-
README.md
11.54 KB
-
results.out5Env.R.txt
73.86 KB
-
results.out5H.R.txt
65.91 KB
-
results.out5HE.R.txt
72.12 KB
-
results.out5Main.R.txt
72.58 KB
-
results.out5N.R.txt
129.06 KB
Abstract
Major ongoing theoretical and empirical challenges are to predict the impacts of immigration on extinction probabilities of remaining populations within fragmented habitats. Comprehensive prediction requires considering multiple genetic effects on demography, including inbreeding and resulting inbreeding depression, additive genetic variance in fitness and resulting adaptive micro-evolution, and local adaptation and resulting migration load. However, all such effects have not been quantified or modelled simultaneously, especially for small wild populations experiencing regular natural immigration. We used quantitative genetic individual-based simulations parameterised using long-term data from song sparrows (Melospiza melodia) to show that, contrary to broad expectation, increasing immigration could slightly increase short-term extinction probability. This outcome arose because, while immigration reduced inbreeding and resulting expression of inbreeding depression, migration load stemming from apparent local adaptation was substantial and counteracted local adaptive micro-evolution, especially given heterosis-enhanced introgression. However, alternative self-reinforcing outcomes of rapid extinction due to an inbreeding-induced extinction vortex or migrational meltdown, and persistence due to micro-evolution of increased population growth, commonly arose. These results imply that altering dispersal rates among populations will not necessarily predictably affect local population persistence over short eco-evolutionary timeframes, and highlight how remaining populations can lie on a knife-edge between persistence and alternative routes to genetically-induced extinction.
https://doi.org/10.5061/dryad.tx95x6b70
Description of the data and file structure
The data are the outputs of a quantitative genetic individual-based simulation model. The R scripts for the model and to produce figures from the simulated data are also provided.
The overarching aims were to investigate how multiple genetic effects (inbreeding depression, additive genetic variance, and local adaptation) affect the probability of extinction of a small population receiving immigrants.
Files and variables
Explanations of R code and simulated data:
Summary of R code and data files provided:
There are five files containing R scripts (originally produced and run with R v4.2.1)
"PopSims_RCode_RunBlock_Final.txt"
"Heatmap_RCode_Final.txt"
"CombinedFigures_RCode_Final.txt"
"CombinedFiguresStoch_RCode_Final.txt"
"EffectSizeChecks_RCode_Final.txt"
The purposes of these scripts are explained below:
There are four main data files containing the summary simulation results across the full parameter space.
"results.out5Main.R.txt"
"results.out5HE.R.txt"
"results.out5N.R.txt"
"results.out5Env.R.txt"
The purposes of these files are explained below"
There is one data file containing the simulation results for populations with no genetic effects (neutral)
"pop.size.data.neutral.txt"
There are nine sets of nine data files (i.e., 81 files in total) containing the detailed simulation results for the nine focal points in the overall parameter space. The identities and contents of these files are explained below
Code for population simulations
The file "PopSims_RCode_RunBlock_Final.txt" contains the R code to run the main blocks of simulations.
No input dataset required, but output files are generated. Explanations of all parameters are included within the code file and explained below
Data and code for heatmap figures
The file "Heatmap_RCode_Final.txt" contains the R code to produce the heatmap figures presented in the manuscript and supporting information (Figures 2, S7-S11, S13 , and S15-S18)
It also produces additional plots of time to extinction (Figure S6)
Four input data files are required:
"results.out5Main.R.txt" = Main simulation results (Figures 2, S6-S11, S13)
"results.out5HE.R.txt" = Simulation results without additional heterosis and epistatic breakdown (Figures S15-S16)
"results.out5N.R.txt" = Simulation results with different starting population sizes (Figure S17)
"results.out5Env.R.txt" = Simulation results with additional cohort-level environmental stochasticity (Figure S18)
The contents of these files are explained below
An additional file, "results.out5H.R.txt," is also provided
This contains simulation results without epistatic breakdown, but is not needed to reproduce any presented figures
Data and code for nine-panel figures - main results
The file "CombinedFigures_RCode_Final.txt" contains the R code to produce the nine-panel figures of population and genetic trajectories presented in the main manuscript and supporting information (Figures 1, 3-6, S12, and S14)
Seven sets of nine input data files are required for the figures depicting the main simulation results:
The seven sets are:
"pop.size.data.X.txt" = Population size
"juv.surv.prob.data.X.txt" = Juvenile survival probabilities
"med.f.data.X.txt" = Median coefficient of inbreeding
"med.bv.js.tot.data.X.txt" = Median total breeding value
"med.igc.data.X.txt" = Median coefficient of immigrant ancestry
"med.bv.js.base.data.X.txt" = Median breeding value originating from founders
"max.break.counter.X.txt" = Years in which simulations were terminated at the maximum population size
Within each set, there are nine files, where X corresponds to one of the following parameter spaces:
Parameter space for likely extinction (x3):
"N40.Imm0.Igg1.6.ID8.Va0.06"
"N40.Imm1.Igg1.6.ID8.Va0.06"
"N40.Imm2.Igg1.6.ID8.Va0.06"
(Number of female founders (N) = 40; Number of immigrants (Imm) = 0, 1 or 2;
Immigrant genetic group effect (Igg, i.e., degree of local adaptation) = -1.6
Inbreeding depression (ID) = -8; Additive genetic variance (Va) = 0.06)
Parameter space for likely persistence (x3):
"N40.Imm0.Igg0.8.ID5.Va0.1"
"N40.Imm1.Igg0.8.ID5.Va0.1"
"N40.Imm2.Igg0.8.ID5.Va0.1"
(Number of female founders (N) = 40; Number of immigrants (Imm) = 0, 1 or 2
Immigrant genetic group effect (Igg, i.e,. degree of local adaptation) = -0.8
Inbreeding depression (ID) = -5; Additive genetic variance (Va) = 0.1)
Central estimated parameter space for the song sparrow system (x3):
"N40.Imm0.Igg1.2.ID6.Va0.06"
"N40.Imm1.Igg1.2.ID6.Va0.06"
"N40.Imm2.Igg1.2.ID6.Va0.06"
(Number of female founders (N) = 40; Number of immigrants (Imm) = 0, 1 or 2
Immigrant genetic group effect (Igg, i.,e. degree of local adaptation) = -1.2
Inbreeding depression (ID) = -6; Additive genetic variance (Va) = 0.06)
Data and code for nine-panel figures - results with cohort-level environmental stochasticity
The file "CombinedFiguresStoch_RCode_Final.txt" contains the R code to produce the nine-panel figure of population trajectories presented in the supporting information (Figure S19)
Two sets of nine input data files are required:
"pop.size.data.stoch.X.txt" = Population size
"max.break.counter.stoch.X.txt" = Years in which simulations were terminated at the maximum population size
where X is the same set of nine extensions listed above
All 81 of the data files contain the results for the variable specified in the file name across:
60 simulated timesteps (columns, headed V1...V60)
50 replicate simulations (rows)
The file "CombinedFigures_RCode_Final.txt" also produces a figure showing the trajectories of genetically neutral populations (Figure S5)
One input data file is required:
"pop.size.data.neutral.txt"
Code to illustrate effect sizes and forms of density-dependence
The file "EffectSizeChecks_RCode_Final.txt" contains the R code to illustrate simulated effect sizes, and forms of density-dependence. It produces supporting information figures S1-S4.
No input data files are required
Details of the simulation code "PopSims_RCode_RunBlock_Final"
This code does not require any input data, but it generates output data and files.
All model parameters are defined within the code.
A "results.out.txt" file needs to be created to receive the output data.
The code to generate this file is provided in the R script, with column headings defined as follows.
All output values are for one set of replicate simulations with the same parameter values.
"start.n" = Initial number of adult females and males
"iter" = Number of replicate simulations
"burnin" = Number of burnin years before genetic effects act
"years" = Total number of years simulated
"pop.max" = Upper limit of population size at which simulations are terminated
"imms" = Number of immigrants per year
"id" = Magnitude of inbreeding depression
"igg" = Magnitude of the immigrant genetic group effect (representing the degree of local adaptation)
"va" = Magnitude of additive genetic variance
"p.ext" = Probability of population extinction within the simulated timeframe
"t.ext" = Time to extinction (conditional on extinction)
The variables below are measured at the extraction year set in the simulation code, and relate to:
- populations that were not extinct at the extraction year but that did go extinct subsequently (extinct)
- populations that were not extinct at the extraction year and that did not go extinct subsequently (extant)
The difference between the grand medians for these extinct and extant populations (diff)
"med.f.extinct" = Grand median coefficient of inbreeding for extinct populations
"med.f.extant" = Grand median coefficient of inbreeding for extant populations
"med.f.diff" = Difference in grand median coefficient of inbreeding between extinct and extant populations
"med.igc.extinct" = Grand median coefficient of immigrant genetic ancestry for extinct population
, med. igc.extant" = Grand median coefficient of immigrant genetic ancestry for extant populations
"med.igc.diff" = Difference in grand median immigrant genetic ancestry between extinct and extant populations
"med.bv.js.tot.extinct" = Grand median breeding value for juvenile liability to survive for extinct populations
"med.bv.js.tot.extant" = Grand median breeding value for juvenile liability to survive for extant populations
"med.bv.js.tot.diff" = Difference in grand median breeding value between extinct and extant populations
"med.bv.js.base.extinct" = Grand median founder contribution to breeding value for juvenile liability to survive for extinct populations
, med.bv.js.base.extant" = Grand median founder contribution to breeding value for juvenile liability to survive for extant populations
"med.bv.js.base.diff" = Difference in grand median founder contribution to breeding value between extinct and extant populations
"med.juv.surv.prob.extinct" = Median juvenile survival probability for extinct populations
"med.juv.surv.prob.extant" = Median juvenile survival probability for extant populations
"med.juv.surv.prob.diff" = Difference in median juvenile survival probability between extinct and extant populations
The simulation code generates some internal dataframes that are not outputted (but could be, if useful for other analyses)
Columns in these dataframes are defined as follows:
"female.id" = Identity of a focal female (numerical identifier)
"male.id" = Identity of a focal male (numerical identifier)
"year" = Year in which the focal individual was produced (numerical identifier)
"dam" = Identity of the mother of the focal individual (numerical identifier)
"sire" = Identity of the father of the focal individual (numerical identifier)
"pair.year" = Year in which the focal individual's parent pair formed (numerical identifier)
"f1" = F1 status of the focal individual (binary variable)
"f2" = F2 status of the focal individual (binary variable)
"bv" = Breeding value of the focal individual (continuous variable)
"fcoef" = Coefficient of inbreeding of the focal individual (continuous variable)
"surv.l" = Liability to survive of the focal individual (continuous variable)
"surv" = Realised survival of the focal individual (binary variable)
In all data files, NA denotes missing data, e.g., because there are no data when all or no replicate populations have gone extinct.
In files of juvenile survival probabilities, 0 denotes missing data (i.,e. when populations have gone extinct)
In files of max break counters, 1 and 0, respectivel,y denote that simulations were and were not terminated.
Code required to run a re-analysis of previously published song sparrow data: The file "SongSparrowAnalysis_RCode_Archive_Final.txt" contains the R code required to re-run a previously published quantitative genetic animal model analysis of data on juvenile survival in song sparrows, formulated as a threshold trait with a probit link function.
The original analysis is fully explained in Reid et al. (2021) Evolution Letters https://doi.org/10.1002/evl3.214. The original model code is in the Supporting Information of this paper.
The required data are available from the Dryad repository https://doi.org/10.5061/dryad.rjdfn2z95