wright_fisher.md 1.97 KB
Newer Older
Victor's avatar
Victor committed
1
2
3
4
5
6
7
# Wright  Fisher algorithm
## Foundations

The Wright Fisher process is an individual based model where the number of agents is constant through time. It is helpful to visualize it through marbles in jar:

![alt text](https://upload.wikimedia.org/wikipedia/commons/0/0b/Random_sampling_genetic_drift.svg)

Victor's avatar
Victor committed
8
At each time step, ``N`` agents are picked up from previous generation to reproduce. Their number of offspring is proportional to their fitness, calculated as usual with **birth and death rates**.
Victor's avatar
Victor committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

It takes thus **only one time step to go trough one generation**. Thus it is more suit- able for numerical simulations. In practice, the Moran and Wright–Fisher models give qualitatively similar results, but genetic drift runs twice as fast in the Moran model.


From this perspective we can easily get that branches are less stable than in the Gillepsie scenario, for as as time goes to infinity the probability of going extinct is intuitively bigger than 0.


## Initial conditions
One need to construct the world as an array of agents, which will be the ancestors of the following
```julia
    agents = [Agent( [2e-1]  .* randn(1)) for i in 1:K0]
```
The function

is then called `p["tend"] -1` times.
## Scenarios
You have several options available concerning the resource implemented and competition:
- ``` mode="std"``` is the standard mode
- ``` mode="grad2D"``` corresponds to a an ecological gradient
>We are not sure whether this corresponds to the following two images
- ``` mode="mountain"``` corresponds to a scenario where a mountain arises (with an ecological gradient)
- ``` mode="split"``` corresponds to a scenario where the resource is splitted in two
- ``` mode="graph"``` this guy is probably not working

## Parallelism
You can run your script in parallel, which makes sense for large populations. To do so:
```julia
using Distributed;addprocs()
Victor's avatar
Victor committed
37
@everywhere using EVOID
Victor's avatar
Victor committed
38
39
40
41
42
```
Parallelism only works with Wright Fisher model.


```@autodocs
Victor's avatar
Victor committed
43
44
Modules = [EVOID]
Pages   = ["EVOID_WF.jl"]
Victor's avatar
Victor committed
45
```