Skip to content

This code was used to generate figures in the paper "Environment heterogeneity creates fast amplifiers of natural selection in graph-structured populations", by Cecilia Fruet, Arthur Alexandre, Alia Abbara, Claude Loverdo, and Anne-Florence Bitbol.

License

Notifications You must be signed in to change notification settings

Bitbol-Lab/StructPop_Heterogeneity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Structured populations with heterogeneity

bioRxiv License: Apache 2.0

This code was used to generate figures in the paper Environment heterogeneity creates fast amplifiers of natural selection in graph-structured populations, by Cecilia Fruet, Arthur Alexandre, Alia Abbara, Claude Loverdo, and Anne-Florence Bitbol.

Requirements

This project requires the following packages:

ipython==8.15.0
matplotlib==3.7.2
numba==0.57.1
numpy==1.24.3

You can install all dependencies with:

pip install -r requirements.txt

Usage

Clone the repository:

git clone https://github.com/yourusername/structured-population.git
cd structured-population

In Python, import the main module:

from struct_pop_delta import *

And, after setting all parameters:

  • The inital number of individuals in each deme in_numbers
  • The migration matrix mig_mat
  • Fitnesses fs
  • Number of simulations nb_sims
  • Number of cycles nb_cycles
  • Growth time t
  • Bottleneck size k

the simulation is run with:

et, ci95et, ft, ci95ft, fp = fixation_probability(
      in_numbers,
      mig_mat,
      fs,
      nb_sim,
      nb_cycles,
      t,
      k,
      size_follow_numbers=1000,
      print_frequency=1
)

et and ft are the extinction and fixation times for mutants, averaged over nb_sim simulations. ci95et and ci95ft are the 95% confidence intervals on those times. fp is the mutant fixation probability estimated over nb_sim simulations. Demo notebook here for an example simulation.

This code generalizes to heterogeneous environments the one provided in the StructuredPop Repo, used in the paper Frequent asymmetric migrations suppress natural selection in spatially structured populations by Alia Abbara and Anne-Florence Bitbol.

Citation

If you use this code in your research, please cite our preprint:

@article{fruet2025environment,
  title={Environment heterogeneity creates fast amplifiers of natural selection in graph-structured populations},
  author={Cecilia Fruet and Arthur Alexandre and Alia Abbara and Claude Loverdo and Anne-Florence Bitbol},
  journal={bioRxiv},
  pages={2025.07.31.667961},
  year={2025},
  publisher={Cold Spring Harbor Laboratory},
  doi={10.1101/2025.07.31.667961},
  url={https://www.biorxiv.org/content/10.1101/2025.07.31.667961v1}
}

License

This project is licensed under the Apache 2.0 License.

About

This code was used to generate figures in the paper "Environment heterogeneity creates fast amplifiers of natural selection in graph-structured populations", by Cecilia Fruet, Arthur Alexandre, Alia Abbara, Claude Loverdo, and Anne-Florence Bitbol.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published