DOI: 10.5061/dryad.280gb5mvj
title: Codes for: A numerical model supports the evolutionary advantage of recombination plasticity in shifting environments

description: Numerous empirical studies have witnessed an increase in meiotic
 recombination rate in response to physiological stress imposed by
 unfavorable environmental conditions. Thus, inherited plasticity in
 recombination rate is hypothesized to be evolutionarily advantageous in
 changing environments. Previous theoretical models proceeded from the
 assumption that organisms increase their recombination rate when the
 environment becomes more stressful and demonstrated the evolutionary
 advantage of such a form of plasticity. Here, we numerically explore a
 complementary scenario – when the plastic increase in recombination rate
 is triggered by the environmental shifts. Specifically, we assume
 increased recombination in individuals developing in a different
 environment than their parents and optionally, also in offspring of such
 individuals. We show that such shift-inducible recombination is always
 superior when the optimal constant recombination implies an intermediate
 rate. Moreover, under certain conditions, plastic recombination may appear
 beneficial also when the optimal constant recombination is either zero or
 free. The advantage of plastic recombination was better predicted by the
 range of the population’s mean fitness over the period of environmental
 fluctuations, compared to the geometric mean fitness. These results hold
 for both panmixia and partial selfing, with faster dynamics of
 recombination modifier alleles under selfing. We think that recombination
 plasticity can be acquired under the control of environmentally responsive
 mechanisms such as chromatin epigenetics remodeling.
description: The codes are written in GNU Octave v.8.1.0.
description: # 1\. General Information ## Title Codes for: A numerical model supports
 the evolutionary advantage of recombination plasticity in shifting
 environments ## Authors * Sviatoslav R. Rybnikov * Sariel Hübner * Abraham
 B. Korol # 2\. Codes/Data Description ## File structure The folder
 contains: * input file "regimes.txt" * five script files for GNU
 Octave v. 8.1.0 ("\*.m") * file "results.xlsx" with
 results of the main simulations ## INPUT FILE The input file
 "regimes.txt" contains characteristics of 1,000 selection
 regimes analyzed in the study. Each row describes a specific regime,
 including: * half-period T (column 1); * selection intensity s (column 2);
 * dominance lift d (column 3); * the lower and the upper values of
 recombination compatible with polymorphism maintenance in the selected
 system (columns 4 and 5). ## SCRIPTS The scripts must be launched
 sequentially since they generate output files needed for the next scripts,
 as follows: 1. Script "1\_find\_optima.m" estimates the optimal
 constant recombination r\* for each selection regime from input file
 "regimes.txt". The found optima will appear in an intermediate
 output file optima.txt. The estimated calculation time is \~45 h (for
 Intel® Core™ i7-7700K CPU @ 4.20GHz, RAM 8 GB). 2. Script
 "2\_split\_optima.m" analyses the found optima (the intermediate
 output file optima.txt), finds those that had converged, and splits them
 into two or three groups: * with r\*=0 (output file
 "optima\_zero.txt"); * with r\*=0.5 (output file
 "optima\_free.txt"); * [if exist] with r\* between 0 and 0.5
 (output file "optima\_int.txt"); 3. Scripts
 "3\_test\_plastic\_vs\_zero.m",
 "4\_test\_plastic\_vs\_free.m" and
 "5\_test\_plastic\_vs\_int.m" compare plastic recombination vs
 r\*=0, r\*=0.5, and r\* between 0 and 0.5, respectively. The results of
 these comparisons will appear in the main output files:
 plastic\_vs\_zero.txt (\~8 h), plastic\_vs\_free.txt (\~5 h), and
 plastic\_vs\_int.txt (\~0.5 h) ## Output files The main output files are
 "plastic\_vs\_zero.txt", "plastic\_vs\_free.txt" and
 "plastic\_vs\_int.txt". Each line in these files corresponds to
 a specific selection regime and contains the following information: *
 half-period T (column 1); * selection intensity s (column 2); * dominance
 lift d (column 3); * the optimal constant recombination r\* (column 4); *
 comparison between the optimal constant recombination r\* (allele M1) and
 one-generation plastic recombination with the magnitude Δr=0.025 (allele
 M2) – columns 5-14; * comparison between the optimal constant
 recombination r\* (allele M1) and one-generation plastic recombination
 with the magnitude Δr=0.05 (allele M2) – columns 15-24; * comparison
 between the optimal constant recombination r\* (allele M1) and
 one-generation plastic recombination with the magnitude Δr=0.1 (allele M2)
 – columns 25-34; * comparison between the optimal constant recombination
 r\* (allele M1) and damped transgenerational plastic recombination with
 the magnitude Δr=0.05 (allele M2) – columns 35-44; * comparison between
 the optimal constant recombination r\* (allele M1) and non-damped
 transgenerational plastic recombination with the magnitude Δr=0.05 (allele
 M2) – columns 45-54. Each comparison (i.e., columns 5-14, 15-24, 25-34,
 35-44 and 45-54) contains the following information: * geometric mean and
 range of fitness under allele M1 at the beginning of the burn-in stage –
 e.g., columns 15-16 for one-generation plastic recombination with Δr=0.05;
 * geometric mean and range of fitness under allele M1 at the end of the
 burn-in stage – e.g., columns 17-18 for one-generation plastic
 recombination with Δr=0.05; * geometric mean and range of fitness under
 allele M2 at the beginning of the burn-in stage – e.g., columns 19-20 for
 one-generation plastic recombination with Δr=0.5; * geometric mean and
 range of fitness under allele M2 at the end of the burn-in stage – e.g.,
 columns 21-22 for one-generation plastic recombination with Δr=0.5; * the
 increases in frequency of allele M2 from initial frequencies of 0.05 and
 0.95 – e.g., columns 23-24 for one-generation plastic recombination with
 Δr=0.5. ### IMPORTANT! Scripts "1\_find\_optima.m",
 "3\_test\_plastic\_vs\_zero.m",
 "4\_test\_plastic\_vs\_free.m", and
 "5\_test\_plastic\_vs\_int.m" by default assume panmixia and
 linked modifier. To perform simulations for partial selfing, change the
 parameter slf (line 24) in the mentioned scripts from 0 to 0.1 or 0.2. To
 perform simulations for unlinked modifier, change the parameter linkM
 (line 58) in the mentioned scripts from 0.2 to 0.5. ### CAUTION!!! All
 scripts clean the existing output files before simulations. Thus, before
 changing parameters slf and/or linkM, care to copy the scripts into a new
 folder in order not to lose the results of previous simulations. ##
 Simulation results File "results.xlsx" contains results of the
 basic simulations, i.e. those implying: * panmixia * one-generation
 shift-inducible recombination * magnitude of the plastic increase Δr=0.05
 The file contains four sets of simulated data: * linked modifier, regimes
 with r\*=0 (sheet 1) * linked modifier, regimes with r\*=0.5 (sheet 2) *
 unlinked modifier, regimes with r\*=0 (sheet 3) * unlinked modifier,
 regimes with r\*=0.5 (sheet 4) Each sheet contains the following
 variables: * half-period T column A) * selection intensity s (column B) *
 selection intensity expressed as 1/sigma^2 (column C) * cumulative
 selection expressed as Ts (column D) * cumulative selection expressed as
 T/sigma^2 (column E) * geometric mean of population mean fitness (column
 F) * range of population mean fitness (column G) * advantage of
 shift-inducible recombination over the optimal constant recombination (1 -
 yes, 0 - no) (column H) # 3\. Sharing/Access Information License: CC0 1.0
 # 4\. Version History Starting from version 6: * all script files are
 annotated * file "results.xlsx" with results of basic
 simulations is included