Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kingman prototype #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions lib/dev.cfg
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
# Common parameters
# [(50, 50), (50, 50)] [{'rate': 1.0, 'r': 1.0, 'u': 0.01}] 100

torus_diameter=100.0;
dimension = 1;
torus_diameter = 70.0;
dimension = 2;
num_parents = 2;
events = (
{
type="disc";
u = 0.01;
u = 0.23;
r = 1.0;
rate = 1.0;
},
{
type="disc";
u = 0.01;
r = 50.0;
rate = 1.0e-7;
}

);

# Simulation
simulate_pedigree = 1;
#sample = ([50.0, 50.0], [50.0, 50.0]);
sample = (50.0, 50.0);
simulate_pedigree = 0;
simulate_kingman = 1;
sample = ([1.0, 1.0], [1.0, 2.0], [3.0, 3.0], [2.0, 1.0]);
random_seed = 1;
num_loci = 10;
num_loci = 1000;
pixel_size = 2.0; # must be 2 for 1D sims
recombination_probability = 0.5;
max_time = 1e4;
max_population_size = 100;
max_occupancy = 500;
recombination_probability = 0.0005;
rho = 20000.0;
Ne = 20000.0;
max_time = 67813845.3;
max_population_size = 2000;
max_occupancy = 2000;

# Identity
num_quadrature_points = 256;
Expand Down
19 changes: 17 additions & 2 deletions lib/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ read_sim_config(sim_t *self, const char *filename)
fatal_error("simulate_pedigree is a required parameter");
}
self->simulate_pedigree = tmp;
if (config_lookup_int(config, "simulate_kingman", &tmp)
== CONFIG_FALSE) {
fatal_error("simulate_kingman is a required parameter");
}
self->simulate_kingman = tmp;
if (config_lookup_int(config, "num_parents", &tmp)
== CONFIG_FALSE) {
fatal_error("num_parents is a required parameter");
Expand Down Expand Up @@ -233,12 +238,18 @@ read_sim_config(sim_t *self, const char *filename)
&self->max_time) == CONFIG_FALSE) {
fatal_error("max_time is a required parameter");
}


if (config_lookup_float(config, "recombination_probability",
&self->recombination_probability) == CONFIG_FALSE) {
fatal_error("recombination_probability is a required parameter");
}
if (config_lookup_float(config, "rho",
&self->rho) == CONFIG_FALSE) {
fatal_error("rho is a required parameter");
}
if (config_lookup_float(config, "Ne",
&self->Ne) == CONFIG_FALSE) {
fatal_error("Ne is a required parameter");
}

self->event_classes = read_events(config, &self->num_event_classes);
read_sample(self, config);
Expand Down Expand Up @@ -270,6 +281,10 @@ run_sim(const char *config_file)
}
not_done = ret != 0;
}
if(self->simulate_kingman == 1) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space needed here - if (..)

ret = sim_setup_arg(self);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check these return values for errors: if (ret != 0) etc.

ret = sim_simulate_arg(self);
}

ret = sim_print_state(self, 2);
if (ret != 0) {
Expand Down
Loading