A forward-in-time individual-based simulation of partial protection from cyclical selection.
This program can simulate two different models of partial protection from the selection: Refuge model and Seedbank model. Each model has 3 different versions of the simulation.
- version E : A part of a population (subpopulation 2) acts as a refuge or a seed bank, where selection does not occur (S, D, SL, DL scenarios)
- In the Refuge model, reproduction and mutation occur in subpopulation 2.
- In the Seedbank model, repeoduction and mutation do not occurs in subpopulation 2
- version C : There is no population structure, and thus considered as a "control" version (CS, CD, CSL, CDL scenarios)
- version N : Selection does not occur in any population or subpopulation (N or CN scenarios)
This program is intended to be built and run in Linux. We used gcc to compile and build a program.
To generate a simulation program with a selected model and version, macro should be defined. Macros for different combinations of a model and version are listed below. One of these macros should be used when generating a program.
| Model | version E | version C | version N |
|---|---|---|---|
| Refuge model | _RSE_ |
_RSC_ |
_RSN_ |
| Seedbank model | _SBE_ |
_SBC_ |
_SBN_ |
_NOPHENO_: Simulation does not genearting .pheno files, which could be too large_EXP_: When assigning the phenotypic effect of each non-neutral (or nonsynonymous) site, get random numbers from a symmetric exponential distribution rather than a normal distribution.
Example 1. Simulation for Refuge model with S scenario (E version)
gcc -o Refuge_E -Ofast -D_RSE_ -lm main.c indiv.c migration.c mutation.c pop.c printBit.c random.c parameter.c phenoList.c environment.c recombination.c subpopReproduction.c reproduction.c writeFile.c
Example 2. Simulation for Seedbank model with N scenario (N version)
gcc -o Seedbank_N -Ofast -D_SBN_ -lm main.c indiv.c migration.c mutation.c pop.c printBit.c random.c parameter.c phenoList.c environment.c recombination.c subpopReproduction.c reproduction.c writeFile.c
Example 3. Simulation for Refuge model with CSL scenario (C version) with exponentially distributed phenotypic effects
gcc -o Refuge_C -Ofast -D_SBN_ -D_EXP_ -lm main.c indiv.c migration.c mutation.c pop.c printBit.c random.c parameter.c phenoList.c environment.c recombination.c subpopReproduction.c reproduction.c writeFile.c
This program imports parameter values from an input file (see below for the format) and generates several types of output files. The name of output files should be specified in the command line as an argument.
./[program name] [input file name] [output file head name]
./Refuge_E input_refugE.txt refugeE
Input file specifies the parameter values used in the simulation. The example below is for S scenario with M = 100 and lambda = 100.
nDeme..... 2
nTry...... 50
nGen...... 50000
nInd1..... 5000
nInd2..... 5000
nSeq_block 2
nNon...... 30
mig....... 100
period.... 100
Nu........ 0.01
recomRate. 0
optPheno.. 1
epsilon... 0
sigma_s... 1
sigma_m... 0.2
seed...... 11986
burnIn.... 100000
An .out file will be generated after one simulation with nTry replicates. .pheno, .freq, .sample files are generated in every different replicates.
An .out file contains simulation mode (defined by the compile option), parameters read from input files, and the delta of each non-neutral site, which is randomly assigned at the start of each replicate.
<< REFUGE - EXPERIMNET MODE >>
nDeme 2
nTry 1
nGen 50000
nInd1_2_T. 5000 5000 10000
N_S_Total 30 30 60
mig 1000
period 100
Nu 0.010000
recomRate 0.000000
optPheno 1.000000
epsilon 0.500000
sigma_s 1.000000
sigma_m. 0.200000
seed 10005
burnIn.... 100000
==================================
Try0 0.062557 0.091738 0.248691 0.145805 0.111615 -0.254352 0.026204 0.114404 -0.074613 0.000827 -0.132159 -0.136374 -0.184432 -0.039777 0.356160 0.082372 0.158428 -0.021250 -0.001715 0.145134 -0.024764 0.183721 -0.179107 -0.347547 -0.040988 0.062983 0.000383 0.151464 0.202621 -0.158947
...
.freq, .freq1, and .freq2 files contain the number individuals with mutant allele at each site in whole population, subpopulation 1, and subpopulation 2, respectively.
gen non0 syn0 non1 syn1 non2 syn2 non3 syn3 non4 syn4 non5 syn5 non6 syn6 non7 syn7 non8 syn8 non9 syn9 non10 syn10 non11 syn11 non12 syn12 non13 syn13 non14 syn14 non15 syn15 non16 syn16 non17 syn17 non18 syn18 non19 syn19 non20 syn20 non21 syn21 non22 syn22 non23 syn23 non24 syn24 non25 syn25 non26 syn26 non27 syn27 non28 syn28 non29 syn29
1 10000 0 0 0 0 359 0 0 362 0 0 50 359 0 0 0 0 10000 0 0 0 0 0 0 10000 0 9641 0 0 0 0 0 0 0 10000 0 0 0 0 0 9641 9641 0 0 9641 0 10000 0 0 359 0 0 0 7 0 17 10000 0 9641 0
2 10000 0 0 0 0 1384 0 0 1384 0 0 46 1384 0 0 0 0 10000 0 0 0 0 0 0 10000 0 8616 0 0 0 0 0 0 0 10000 0 0 0 0 0 8616 8616 0 0 8616 0 10000 0 0 1384 0 0 0 6 0 12 10000 0 8616 0
...
A .sample file contains the detailed information of sampled individuals, including the allele type in every site and phenotype of an individual.
Sampling will be performed in every _sampling_generation_ generations, and in each sampling step, _nSample_ individual will be sampled from the total population.
_nSample_ and _sampling_generation_ are defined in option.h file in package_codes folder.
Sampling continues during one cycle, from (_sampling_generation_ - period + 1)th generation to (_sampling_generation_) generation.
.sample files contain the generation, selective optimum of the generation, individual sample number, the phenotype of the individual, sequence of the individual.
Each column is generation / selective optimum of the generation / individual sample number / the phenotype of the individual / sequence of the individual.
4900 0.739884 0 -0.913223 100000000000000001000000101000000010000011001010000000001010
4900 0.739884 1 -0.913223 100000000000000001000000101000000010000011001010000000001010
4900 0.739884 2 -0.913223 100000000000000001000000101000000010000011001010000000001010
4900 0.739884 3 -0.913223 100000000000000001000000101000000010000011001010000000001010
4900 0.739884 4 -0.913223 100000000000000001000000101000000010000011001010000000001010
4900 0.739884 5 -0.913223 100000000000000001000000101000000010000011001010000000001010
...
4999 -1.320613 97 -0.913223 100000000000000001000000101000000010000011001010000000001010
4999 -1.320613 98 -0.913223 100000000000000001000000101000000010000011001010000000001010
4999 -1.320613 99 -0.913223 100000000000000001000000101000000010000011001010000000001010
9900 1.449090 0 -0.913223 100000000000000001000000101000000010000011001010000000001010
9900 1.449090 1 -0.913223 100000000000000001000000101000000010000011001010000000001010
9900 1.449090 2 -0.913223 100000000000000001000000101000000010000011001010000000001010
...
This file contains the information about the phenotype observed throughout each simulation replicate.
Generation, selective optimum of the generation, and observed phenotypes, and the count of each phenotype in the whole population, subpopulation 1, and subpopulation 2 are recorded.
This file could be large, so we recommend to skip generating this file using (_NOPHENO_) unless you need phenotype information in every generation.
Each column is generation / selective optimum of the generation / observed phenotype / count in whole population / count in subpopulation 1 / count in subpopulation 2.
1 1.000000 0.733415 2711 2017 694
1 1.000000 -0.670008 7102 2838 4264
1 1.000000 0.563073 177 138 39
1 1.000000 0.250566 6 4 2
1 1.000000 -0.864980 2 1 1
1 1.000000 0.162651 2 2 0
2 1.000000 0.733415 4276 3355 921
2 1.000000 -0.670008 5472 1451 4021
2 1.000000 0.563073 245 191 54
2 1.000000 0.250566 6 2 4
2 1.000000 0.162651 1 1 0
3 1.000000 0.733415 5449 4121 1328
3 1.000000 0.563073 276 186 90
...