/** * Loopar igenom alla tal och lägger in dem i strängen **/ char* BitStr(char s[STRSIZE], int strl, int nr, int n) { strl++; static char s2[STRSIZE] = {""}; if(strl <= pow(2,n)) { strcpy(s2,create_nr(nr,n)); nr++; BitStr(s, strl,nr,n); } else { return s2; } }
void print_lratio_test (world_fmt * world, long *Gmax) { long c; long r, locus; long df; long zeros; int header; nr_fmt *nr; MYREAL *param0; MYREAL *param1; long *maxwhich; long nparam; long maxnum = 0; long rep = !world->options->replicate ? 0 : (world->options->replicatenum == 0 ? world->options->lchains : world->options->replicatenum); long repstop = world->repstop; param0 = (MYREAL *) mycalloc (1, sizeof (MYREAL) * (world->numpop2 + 1)); param1 = (MYREAL *) mycalloc (1, sizeof (MYREAL) * (world->numpop2 + 1)); maxwhich = (long *) mycalloc (1, sizeof (long) * (world->numpop2 + 1)); if (world->options->progress) FPRINTF (stdout, " Printing likelihood ratio tests\n"); nr = (nr_fmt *) mycalloc (1, sizeof (nr_fmt)); create_nr (nr, world, *Gmax, 0, world->loci, world->repkind, world->rep); for (locus = 0; locus < world->loci; locus++) { if (world->options->replicate) for (r = 0; r < repstop; r++) create_multiapg0 (nr->apg0[r][locus], nr, r, locus); else create_apg0 (nr->apg0[0][locus], nr, &world->atl[0][locus], locus); } if (world->loci > 1) { locus = world->loci; rep = 0; } else { world->locus=0; locus = 0; } PAGEFEEDWORLD; nparam = world->options->gamma ? world->numpop2 + 1 : world->numpop2; for (c = 0; c < world->options->lratio->counter; c++) { header = (c == 0) ? HEADER : NOHEADER; if (world->options->lratio->data[c].type == MLE) { memcpy (param1, world->atl[rep][locus].param, sizeof (MYREAL) * nparam); df = set_test_param (param0, &world->options->lratio->data[c], world, 0, -1, maxwhich, &maxnum, &zeros); test_loci_like (nr, param0, param1, df, zeros, world->loci, world, maxwhich, maxnum, header, world->options->lratio->data[c].value1); } } fflush (world->outfile); myfree(param0); myfree(param1); myfree(maxwhich); destroy_nr (nr, world); }