From d4b54d81449d62cacd2048214f36ae997a141625 Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Thu, 19 Mar 2015 20:21:16 +0000 Subject: [PATCH] add options hash to json output add warning for uneven allele count --- sim/sim.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sim/sim.c b/sim/sim.c index 7919300..31a78c7 100644 --- a/sim/sim.c +++ b/sim/sim.c @@ -15,11 +15,17 @@ void hexlistjson(struct afrhex *map); static void setpop(struct afrhex *map, int hexid, int *pop) { struct afrhex *hex; int i; + int sum = 0; hex = find_hex(map, hexid); for (i=0; i < 2; i++) { hex->freq[i] = pop[i]; + sum += pop[i]; } + if (sum % 2) { + fprintf(stderr, "allele frequency for hex %d not even\n", hexid); + } + hex->pop = sum/2; } static void setpopstr(struct afrhex *map, char *spec) { @@ -123,6 +129,7 @@ int main (int ac, char *av[]) { printf("{"); printf(" \"run\": %d, \"seed\": %d, \"gens\": %d", run, seed, gens); + printf(",\n\"options\": { \"capfactor\": %f }", capfactor); printf(",\n\"gendata\": [\n"); dumpgenjson(map, 0, year); -- 2.40.0