ls# README of "gTraits" Wright Fisher simulations

"gTraits" runs Wright-Fisher simulations for g coevolving traits and is the basis for simulation for the manuscript "Survival of the simplest in microbial evolution" by Torsten Held, Daniel Klemmer, and Michael Lässig. The parameters are set with the compilation. For testing, the number of traits g must be specified (full run -1) at runtime. The fitness landscapes needs to be specified at runtime. Code: Torsten Held (torheld@thp.uni-koeln.de).

# BUILT
  when fulfilling the REQUIREMENTS, open the folder "gTraits" in a Terminal and 
        $ make g
  (may specify on Mac OSX 10 “$ make CXX=g++-8” to make -fopenmp available) or directly
	$ c++ -fopenmp -I$BOOST/Library/boost_1_55_0/ gTraits.cpp -o gTraits
  where c++ should point to a compiler alowing for OpenMP with the option -fopenmp. The compilation should take a few seconds. 

# EXECUTE
  In a Terminal, execute
     $ ./gtraits
  and follow the instructions.

# REPRODUCTION
  To reproduce the data, choose type of landscape: 
	- stability landscape (full folding statistics) for loss-statistics or
	- exponential approx. for the scaling plots
  and choose g<0 to run through the same parameters.
  For reproducing the recombination plot, set `double rho = …’ in gTraits.cpp before compiling. Large g~4000 may run on the scale of months.

# OPTION
  -f FILENAME
    specifies the filenames of the output file.

# TESTING/DEMO
  choose small g at runtime. By that, you are not in the mode of phenotypic interference

# OUTPUT
  The output files are in the folder steadystate.
  info_FILENAME contains the model parameters.
  data_FILENAME contains means and variances genome wide observables:
    g: number of genes
    c: global scale of trait selection
    Ftot: fitness (neg. genetic load)
    FtotDiv: fitness variance \sigma^2
    S_b/S_bSq: mean and mean squared selection coefficients, s^2
    DuplicationRate: Loss rate of genes (loss is immediately replaced by duplicate)
  stat_FILENAME contains means and variances of individual genes i
    g: number of genes in simulations
    c: global scale of trait selection
    i: index of trait
    ci: trait selection f_0
    Gamma: mean trait \Gamma
    Delta: mean diversity \Delta_G; from the traits c_i=0 we get the neutral trait diversity
    F: single trait fitness
    FDiv: Single trait's fitness variance \Delta_f

# REQUIREMENTS
  Boost libraries (tested with 1.55.0); make sure that the $BOOST path is set.
  OpenMP.

# TESTED WITH
  Boost 1.55.0 and 1.58.0
  gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  and with
  gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11) & intelmpi 5.0.2
  and with
  g++-8 (Homebrew GCC 8.2.0) 8.2.0

# TESTED OS's
  Linux 4.18.0-13-generic #14~18.04.1-Ubuntu SMP Thu Dec 6 14:09:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  Linux 2.6.32-573.12.1.bl6.Bull.87.x86_64 #1 SMP Fri Jan 8 23:11:04 CET 2016 x86_64 x86_64 x86_64 GNU/Linux
  Darwin 16.7.0 Darwin Kernel Version 16.7.0: Mon Nov 13 21:56:25 PST 2017; root:xnu-3789.72.11~1/RELEASE_X86_64 x86_64

# NON-STANDARD HARDWARE
  In principle, no non-standard hardware is needed. However, the runtime for large g ~ 4000 can be of the order of months.

# VARIABLE TRANSFORMATION WITH RESPECT TO PAPER
  - trait wide mutation rate u = mu*L/2
  - selection f_0 = c
  - mutational effects in standard distribution E_i=1
  - the mutational bias k1 is set by the probability of a beneficial mutation  p_b(E) = (L-E)/L, where E is a particular phenotype. Hence dynamically p_b ~ (L-Estar)/L;#
    standard: Estar=..7*L => p_b ~ 0.3
  - genome recombination rate Rho = rho*L*g

# LICENSE
  This project is licensed under GNU AGPLv3.

# ACKNOWLEDGEMENTS
  We thank Stephan Schiffels, who offered the basic block for the WrightFisher simulations.
  
