Code from: Evolution of phenotypic plasticity owing to migration
Data files
Oct 23, 2025 version files 17.56 KB
-
Migrant_Plasticity.c
14.72 KB
-
pars
14 B
-
README.md
2.82 KB
Abstract
Phenotypic plasticity enables organisms to produce better-suited phenotypes when the environment changes, enhancing fitness under adverse conditions. Yet responding to environmental cues may provide little use in a constant environment, where organisms already express optimal phenotypes. The forces that sustain plasticity and account for its widespread presence, thus, remain unclear, as plasticity must remain advantageous to persist. Although typically associated with changing environments, maintenance of plasticity requires generational turnover such that parents and offspring regularly encounter different conditions. Here, we demonstrate that even low number of migrants between locally adapted populations, in constant environments, can promote the emergence and persistence of phenotypic plasticity even when plasticity is costly, never associated with the fittest genotype, and independent of its genetic architecture. We support this conclusion by exploring the parameter space of a two-locus, two-deme model using stochastic simulations and analytical approximations. We derive analytical conditions under which plasticity is adaptively maintained as a function of selection strength, migration, and fitness trade-offs. These findings reshape our understanding of the evolutionary origins of plasticity and offer insight into how maladaptive traits can invade adapted populations in stable environments.
Dataset DOI: 10.5061/dryad.37pvmcvzg
Description of the data and file structure
This C program simulates evolutionary dynamics at a plasticity locus following the introduction of a single plasticity-conferring allele (M) into one of two locally adapted demes that exchange migrants, as described in Gulisija and Newberry (2025).
At the structural locus, alleles a and b encode locally adapted, non-plastic phenotypes in demes A and B. At the modifier locus, alleles m and M determine whether plastic environmental responses occur, with specified benefits and costs.
Input parameters for deme A are provided in the pars file:
1. Selection coefficient against non-plastic immigrants (sel, sA)
2. Plasticity benefit (pla, pA)
3. Plasticity cost (cost, cA)
A sample pars file includes sA = 0.01, pA = 0.01, and cA = 0.0. Parameters for deme B are symmetric unless modified on line 39.
Population sizes (N1=NA, N2=NB), maximum simulation time (TIME), and replicate number (REPS) are defined on line 30. Burn-in duration (migration–selection equilibrium without plasticity) is set on line 31, recombination rate between the two loci on line 40, and reciprocal migration values are specified on lines 50–75.
Output is written to output, including: population sizes, migration rate, recombination rate, selection coefficients, plasticity benefits and costs, cumulative heterozygosity at the plasticity locus (where values > 4 suggest balancing selection), fixation and loss times, fixation probability, equilibrium check at burn-in (difference in frequency of a over 100 generation before introduction of plasticity), with the number of polymorphic runs and replicates.
To run, please compile using:
gcc -Wall 'exe_file' -o 'Migrant\ Plasticity.c' -lm , or
cc 'Migrant\ Plasticity.c' -lm -o 'exe_file'
The output file (output) reports the main input parameters as well as the heterozygosity and fixation probabilities of the plasticity-conferring allele.
Files and variables
File: Migrant_Plasticity.c
Description: Main program - forward-in-time evolution at the plasticity locus in a subdivided population with two locally adapted demes.
File: pars
Description: Sample input file, with suggested selection, plasticity, and cost coefficients.
Code/software
The code is written in C and need a C compiler, such as can freely available within Xcode.
Access information
Other publicly accessible locations of the data:
Data was derived from the following sources:
- NA
