DOI: 10.5061/dryad.wdbrv162z
title: Epigenetic variation can promote adaptation by smoothing rugged fitness landscapes

description: Heritable non-genetic phenotypic variation-broadly, epigenetics can
 potentially influence evolutionary outcomes as direct targets of selection
 or through interactions with genetic variation. While their evolutionary
 benefits in generating phenotypic diversity in changing environments are
 well-characterized, there has been relatively little consideration of how
 the joint influence of epigenetic changes and mutations would affect
 traversal of multi-peak adaptive landscapes. Here, we discover general
 principles for how epigenetics, by generating an epigenetic quasispecies
 (clusters of semi-stable phenotypes mapped to a single genotype), tends to
 improve adaptive outcomes of an asexual population on rugged fitness
 landscapes even in a constant environment. In particular, rapid epigenetic
 changes tend to smooth out suboptimal fitness peaks through incorporating
 fitness contributions of epimutations, allowing access to better adaptive
 outcomes. Remarkably, the average impact of epigenetics is more strongly
 influenced by an approximate balance between switching rates rather than
 the absolute rate at which switching occurs. These findings demonstrate
 that epigenetic changes can be influential even without having strong
 heritability and have a striking, yet generally invisible, beneficial role
 in shaping a population's adaptive trajectory.
description: # Epigenetic variation can promote adaptation by smoothing rugged fitness
 landscapes Dataset DOI:
 [10.5061/dryad.wdbrv162z](https://doi.org/10.5061/dryad.wdbrv162z) ##
 Description of the data and file structure This repository contains code
 and data for the manuscript titled "Epigenetic variation can promote
 adaptation by smoothing rugged fitness landscapes", published in
 Proceedings of the Royal Society B, DOI: 10.1098/rspb.2025.2619 The
 central tenet of this work is analyzing how epigenetic switching affects
 adaptation on fitness landscapes. This analysis has two critical aspects
 - \ First. generating landscapes which vary significantly in their
 ruggedness. We use two approaches to do this: \ 1\. Creating correlated
 fitness landscapes with a tunable degree of epistasis. The script to do
 this is "CreatingLandscapes_Main.R"\ 2\. Creating uncorrelated
 fitness landscapes following the house of cards (HoC) model. The  script
 to do this is -  "CreatingLandscapes_HoC.R" The focus of this
 work has been on genotypes with 5 loci. However, the landscapes with more
 loci can be easily generated by changing the parameter L in either scripts
 mentioned above. The degree of ruggedness of the landscape (another
 critical feature in the work) can also be tuned by changing the strength
 of epistatic interactions in either script. The second critical feature of
 this work, simulating adaptation with epigenetic changes. To do this, we
 use a Wright-Fisher (WF) model modified to include epigenetic effects and
 transitions. The script for simulations following this model is
 "WFmodel.R" **The outline of our analysis follows as such :\ a)
 using one of the two ways to generate a large number of fitness
 landscapes, and\ b) analyzing those landscapes using the WF model.** The
 exact landscapes used in our work are - \ 1\. Correlated landscapes -
 "LandscapesAll.csv" included in MainText_Data.zip. This file
 contains a set of 1000 fitness landscapes generated using the epistatic
 model, and we use this set for all analyses linked to this model. \ 2\.
 HoC model - "HoC_SetOfAllLandscapes.csv" included in
 Supplementary_Data.zip. This file contains a set of 1000 fitness
 landscapes generated using the HoC model, and we use this set for all
 analyses linked to this model. \ In both datasets, each column denotes one
 landscape - specifically, the set of fitness values for all 32 genotypes
 in that landscape.  The specific data generated and used for our analysis
 are included in the MainText_Data.zip and Supplementary_Data.zip folders,
 respectively, based on whether the dataset is used for figures in the main
 or supplementary text. The file names correspond to the figure they were
 used to make in the paper. For example, "Npeaks_vs_Rank_1A.csv"
 in the MainText_Data.zip folder refers to the data used to generate Fig.
 1A.  All scripts to generate and analyze the data and make figures are
 included in the MainText_Code.zip and Supplementary_Code.zip folders,
 respectively, based on whether the code is used for figures in the main or
 supplementary text. For example, "EffectiveLandscapes_FigS6.R"
 in the Supplementary_Code.zip folder refers to the script used for
 generating, analyzing, and making the plot associated with Fig S6 in the
 Supplementary Material.  A central component of your analysis is comparing
 the effect of adaptation with and without epigenetic changes. For the
 instances where epigenetic changes are allowed, they are denoted by
 "epi". For the instances where adaptation is mediated by genetic
 changes alone, they are denoted by "gen". All data generated is
 dimensionless. More details on the data files and the data enclosed are
 listed below: | File Name | Folder | Details | |
 :------------------------------------------- | :------------------ |
 :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Npeaks\_vs\_Rank\_1A.csv | MainText\_Data | Mean Rank (mean) +/- 95% CI (upper, lower) as a function of number of peaks (npeaks) for adaptation with (epi) and without (gen) epigenetic changes.  | | Heterogeneity\_outcomes\_1B.csv | MainText\_Data | Mean rank (mean) with (rank\_epi) and without (rank\_gen) epigenetic switching for 5-peaked landscapes. "col" column refers to color used for plotting.   | | Rank\_Improvement\_Fig2.csv | MainText\_Data | The average improvement in rank (delrank) as a function of effective number of peaks (epinumpeaks5) for 5-peaked landscapes. | | Mu\_vs\_Rank\_4A.csv | MainText\_Data | Mean Rank (mean) +/- 95% CI (upper, lower) as a function of mutation rate (mu) for adaptation with (epi) and without (gen) epigenetic changes.  | | EpigeneticRates\_Diagonal\_4B.csv | MainText\_Data | Mean Rank (mean) +/- 95% CI (upper, lower) as a function of epigenetic switching rate ON (RateOn) and OFF (RateOff). Data also included for Mean Fitness +/- 95% CI.  | | EpigeneticRates\_HeatMap\_4C.csv | MainText\_Data | Mean Rank (mean) +/- 95% CI (upper, lower) as a function of epigenetic switching rate ON (RateOn) and OFF (RateOff). "col" column refers to color used for plotting.   | | EpigeneticRates\_Diagonal\_S10.csv | Supplementary\_Data | same as EpigeneticRates\_Diagonal\_4B.csv | | EpigeneticRates\_HeatMap\_S11.csv | Supplementary\_Data | same as EpigeneticRates\_HeatMap\_4C.csv | | Epigeneticrates\_NewRatio\_S9.csv | Supplementary\_Data | same as EpigeneticRates\_Diagonal\_4B.csv | | Heterogeneity\_4peaks\_S4A.csv | Supplementary\_Data | same as Heterogeneity\_outcomes\_1B.csv but for 4-peaked landscapes | | Heterogeneity\_6peaks\_S4B.csv | Supplementary\_Data | same as Heterogeneity\_outcomes\_1B.csv but for 6-peaked landscapes | | Heterogeneity\_EffectiveLands\_S6.csv | Supplementary\_Data | Mean rank with (rank\_epi) epigenetic switching and mean rank on effective landscapes (rank\_gen) for 5-peaked landscapes | | Heterogeneity\_EffectiveLands\_HoC\_S13C.csv | Supplementary\_Data | same as Heterogeneity\_EffectiveLands\_S6.csv, but for 5-peaked landscapes following the house of cards model | | Mu\_vs\_ProbGlobal\_S8.csv | Supplementary\_Data | Mean Rank (mean) +/- 95% CI (upper, lower) as a function of mutation rate (mu) for adaptation with (epi) and without (gen) epigenetic changes. Data also included for Mean Fitness +/- 95% CI. | | Npeaks\_vs\_ProbGlobal\_S3.csv | Supplementary\_Data | Mean Rank (mean) +/- 95% CI (upper, lower) as a function of number of peaks (npeaks) for adaptation with (epi) and without (gen) epigenetic changes. Data also included for Mean Fitness +/- 95% CI. | | Npeaks\_vs\_Rank\_HoC\_S13A.csv | Supplementary\_Data | same as Npeaks\_vs\_Rank\_1A.csv but for landscapes constructed via the House of Cards model | | RankImprovement\_HoC\_S13B.csv | Supplementary\_Data | same as Rank\_Improvement\_Fig2.csv but following the HoC model | | RankOfPeakRemoved\_S5B.csv | Supplementary\_Data | Number of landscapes for which the peak with rank = {1,2,3,4,5} was removed, in that order | | Valleys\_Delta\_s\_5peaked\_S7.csv | Supplementary\_Data | Characterizing fitness valleys for landscapes where epigenetic switching is not allowed (delta\_gen, s\_gen) and landscapes where epigenetic switching is allowed (delta\_epi, s\_epi). Please refer to the manuscript Fig. S7 for a detailed description of what the parameters "delta" and "s" signify. | | dfe\_epi\_HoC\_S12B.csv | Supplementary\_Data | A list containing all fitness effects of all epigenetic changes in our House of Cards model.  | | dfe\_epi\_epist\_S12A.csv | Supplementary\_Data | A list containing all fitness effects of all epigenetic changes in our epistatic model.  | ### Files and variables #### File: CreatingLandscapes_HoC.R **Description:** The R script used to generate fitness landscapes following the house of cards model. #### File: CreatingLandscapes_Main.R **Description:** The R script used to generate fitness landscapes following the epistatic model.   #### File: WFmodel.R **Description:** The R script used to simulate adaptation across fitness landscapes, incorporating epigenetic switching. #### File: MainText_Code.zip **Description:** The figure-specific R scripts used to generate figures in the main text.  #### File: Supplementary_Code.zip **Description:** The figure-specific R scripts used to generate figures in the supplementary material.  #### File: Supplementary_Data.zip **Description:** The data files used to generate the figures in the supplementary material.  #### File: MainText_Data.zip **Description:** The data files used to generate the figures in the main text.  ## Code/software All scripts are based on R (version 4.2.3), and use the following packages: stringr; MASS; doParallel; ggplot2; flock; foreach; reshape2; dplyr; tidyr; broom; scales ## Access information Other publicly accessible locations of the data: * [https://github.com/mallakshat/EpigeneticQuasispecies](https://github.com/mallakshat/EpigeneticQuasispecies)