To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 6880fa07 authored by Eva Bons's avatar Eva Bons

added functionality for different offspring distributions

parent 2f52f3ff
......@@ -366,9 +366,15 @@ class Simulation(object):
for pos, base in zip(changes[:, 0], changes[:, 1]):
fitness *= (self.fitness_table[int(base), int(pos)])
if self.settings['offspring_distribution'] == 'poisson':
offspring = np.random.poisson(fitness*R0)
elif self.settings['offspring_distribution'] == 'normal':
offspring = int(round(np.random.normal(loc=fitness*R0,scale=self.settings['offspring_sigma'])))
else:
raise ValueError('offspring distribution {} not understood'.format(self.settings['offspring_distribution']))
if return_fitness:
return np.random.poisson(fitness*R0), fitness
return np.random.poisson(fitness*R0)
return offspring, fitness
return offspring
def mutate_seq(self, pop, seq_id_new,seq_id_old):
"""
......
......@@ -4,6 +4,7 @@ parameters:
fl: 0.45
mu: -0.248
sigma: 0.149
offspring_distribution: 'poisson'
#settings for new mutations
mut_rate: 1.2e-4
......@@ -22,5 +23,3 @@ R0: 6
ga_increase: 1
max_pop: 10000
name: 'HCV'
......@@ -4,6 +4,7 @@ parameters:
fl: 0.045
mu: -0.248
sigma: 0.149
offspring_distribution: 'poisson'
#settings for new mutations
mut_rate: 2.16e-5
......@@ -22,5 +23,3 @@ R0: 6
ga_increase: 1
max_pop: 10000
name: 'HIV'
......@@ -4,6 +4,7 @@ parameters:
fl: 0.182
fb: 0.053
lb: 0.202
offspring_distribution: 'poisson'
#settings for new mutations
mut_rate: 2.16e-5
......
#settings for the MFED
model: 'neutral'
offspring_distribution: 'poisson'
#settings for new mutations
mut_rate: 2.16e-5
......
......@@ -28,6 +28,7 @@ parameters:
0.051000000000000004, 0.056999999999999995, 0, 0.10500000000000001,
0.07200000000000001, 0.015, 0.069, 0, 0.069, 0.372,
0.10200000000000001, 0.012, 0.07200000000000001, 0.099, 0.003, 0.084]
offspring_distribution: 'poisson'
#settings for new mutations
mut_rate: 1.0e-6
......
......@@ -28,6 +28,7 @@ parameters:
0.051000000000000004, 0.056999999999999995, 0, 0.10500000000000001,
0.07200000000000001, 0.015, 0.069, 0, 0.069, 0.372,
0.10200000000000001, 0.012, 0.07200000000000001, 0.099, 0.003, 0.084]
offspring_distribution: 'poisson'
#settings for new mutations
mut_rate: 1.0e-6
......
......@@ -6,6 +6,7 @@ parameters:
# fl: 0.045
# mu: -0.248
# sigma: 0.149
offspring_distribution: 'poisson'
#settings for new mutations
mut_rate: 0.01
......
......@@ -10,7 +10,7 @@ parameters:
sigma: #lognormal
loc: #spikes (location of spikes)
freq: #spikes (fraction at spikes)
offspring_distribution: 'poisson'
#settings for new mutations
mut_rate: 1e-6
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment