Skip to content

Bitbol-Lab/fitness-landscapes

Repository files navigation

fitness-landscapes

Repository for 'Impact of population size on early adaptation in rugged fitness landscapes' (2023) by R. Servajean and A.-F. Bitbol available here: https://royalsocietypublishing.org/doi/full/10.1098/rstb.2022.0045 (referred to as [SER23] below) and 'Impact of spatial structure on early and long-term adaptation in rugged fitness landscapes' (2024) by R. Servajean, A. Alexandre and A.-F. Bitbol available here: https://www.biorxiv.org/content/10.1101/2024.09.23.614481.abstract (referred to as [SER24] below)

Getting started

Clone this repository on your local machine by running:

git clone git@github.com:Bitbol-Lab/fitness-landscapes.git

Executing the following line runs a working example of the Moran and Wright-Fisher walks:

python moran_and_wright_fisher_walks.py

Executing the following line runs a working example of the Moran and Wright-Fisher star walks:

python star_walk.py

Requirements

In order to use the function moran_wf_walk in moran_and_wright_fisher_walks.py, or star_walk in star_walk.py, NumPy is required.

Usage

In the file moran_and_wright_fisher_walks.py, moran_wf_walk runs either Moran or Wright-Fisher walks in a given fitness landscape.

In the file star_walk.py, star_walk runs either Moran or Wright-Fisher star walks in a given fitness landscape.

Landscapes

The 200,000 LK landscapes (with L=3 and K=1) used in both [SER23] and [SER24] are stored in a file called landscapes.pickle available here: https://drive.google.com/drive/folders/1Er1wZb_FQr2e-NWZU279jvjZxgnWJVWc?usp=sharing

Each landscape is associated with an index (started from 0). The following line of Python code provides access to the ith landscape (as a dictionnary where a key is a sequence and the value is the corresponding fitness):

landscape_i = pickle.load(open("landscapes.pickle", "rb"))[i]

Landscapes labelled A and B in both [SER23] and [SER24] correspond to landscapes 9 and 3, respectively. Landscape C in [SER24] corresponds to landscape 142706.

The landscapes generated by different fitness landscape models used in figures S11 (where L = 3) and S18 (where L = 6) in [SER24] are available in the folders L = 3 and L = 6, respectively, which are in the folder landscapes (S11 and S18 in [SER24]). Details about the models and parameter values used to generate these landscapes are given in the captions of the aformentionned figures. Once a file storing one landscape is downloaded on your local machine, the following line of Python code provides access to the landscape:

landscape = pickle.load(open("landscape_file_name.txt", "rb"))

Simulation data

Simulation data used in the main figures of [SER24] and [SER23] is available in the folders data [SER24] and data [SER23], respectively. For figure 4 of [SER24], as indicated in its caption, we performed a first step analysis using the fixation probabilities estimated by running the model from 'Frequent asymmetric migrations suppress natural selection in spatially structured populations' by Abbara and Bitbol (details in the caption).