genetic_structure.md 1.35 KB
Newer Older
Victor's avatar
Victor committed
1
2
3
4
5
6
7
8
# Modelling agents with a genetic structure

In this example, we show how to model a population which evolve on a linear geographic space, and is defined by a genotype graph. Any two connected node in the genotype graph should be thought of as two neighbour genomes, i.e that are very similar in their alleles / nucleotide.

The genotype space is inspired from the article [The architecture of an empirical genotype-phenotype map](http://doi.wiley.com/10.1111/evo.13487)

## Defining the space
```julia
Victor's avatar
Victor committed
9
10
11
12
13
14
    ##### Genotype space#####
    dim_neutr = 1000
    magicprop = 523728 / 32896
    g = SimpleGraph{Int16}(dim_neutr,round(Int16,dim_neutr * magicprop))
    initnode = argmax(eigenvector_centrality(g)) # This is the central node the we will use to instantiate the populations
    myspace = (DiscreteSegment(Int8(1),Int8(nodes)),GraphSpace(g)) # union of vector spaces
Victor's avatar
Victor committed
15
16
17
18
```
## Defining birth, death processes and mutation

```julia
Victor's avatar
Victor committed
19
20
21
22
23
    K0 = 1000
    mu = [1.,1.]
    b(X,t) = 1 / nodes
    d(X,Y,t) = (X[1]  Y[1]) / K0
    D = (5e-1,1.4825)
Victor's avatar
Victor committed
24
25
26
27
28
```

## Final set up

```julia
Victor's avatar
Victor committed
29
30
31
32
33
    NMax = 2000
    # tend = 1.5
    tend = 3000
    p_default = Dict{String,Any}();@pack! p_default = d,b,NMax,mu
    myagents = [Agent(myspace,(rand(Int8(1):Int8(nodes)),initnode),ancestors=true,rates=true) for i in 1:round(K0/nodes)]
Victor's avatar
Victor committed
34
35
    w0 = World(myagents,myspace,p_default,0.)
```
Victor's avatar
Victor committed
36
37

## Plotting