Legofit
infers population history from nucleotide site patterns.
Data Structures | Macros | Functions | Variables
pripos.c File Reference
#include "branchtab.h"
#include "error.h"
#include "lblndx.h"
#include "misc.h"
#include "strdblqueue.h"
#include "typedefs.h"
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

Data Structures

struct  Stack
 Treat a vector of tipId_t values as a push-down stack. More...
 

Macros

#define BUFFSIZE   1024
 

Functions

static void usage (void)
 Print usage message and die.
 
static StackStack_new (int dim, tipId_t buff[dim])
 This stack is local to this file. More...
 
static void Stack_free (Stack *stk)
 Frees the stack but not the underlying buffer.
 
static void Stack_push (Stack *self, tipId_t x)
 Add an entry to the stack, checking bounds.
 
static void generatePatterns (int bit, int npops, Stack *stk, tipId_t pat, int doSing)
 Call as generatePatterns(0, npops, stk, 0); Recursive function, which generates all legal site patterns and pushes them onto a stack.
 
int main (int argc, char **argv)
 

Variables

const char * useMsg
 

Function Documentation

◆ Stack_new()

static Stack * Stack_new ( int  dim,
tipId_t  buff[dim] 
)
static

This stack is local to this file.

It provides a bounds-controlled interface to an external array, which is passed as an argument, buff, to Stack_new.

Variable Documentation

◆ useMsg

const char* useMsg
Initial value:
=
"\nUsage: pripos --admix <f> --zero <a.legosim>"
" --one <b.legosim> <obs.opf>\n\n"
" where <f> is the admixture fraction as estimated by legofit,\n"
" <a.legosim> is a file containing the results of a legosim run\n"
" with parameters as fitted by legofit, except that one admixture\n"
" fraction is set to 0, <b.legosim> is like <a.legosim> except\n"
" that this admixture fraction is set to 1, and <obs.opf>\n"
" is a file of observed site pattern frequencies, as generated\n"
" by sitepat.\n\n"
"Function calculates the conditional probability of admixture for\n"
"each site pattern and the mean posterior probability of admixture.\n"