Legofit
infers population history from nucleotide site patterns.
Data Structures | Macros | Functions | Variables
mapmix.c File Reference
#include "branchtab.h"
#include "error.h"
#include "lblndx.h"
#include "misc.h"
#include "rafreader.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.
 
static FILE * openOutput (const char *chr)
 Open a file named <chr>.mapmix for output, or abort if that file already exists or cannot be opened for writing. More...
 
int main (int argc, char **argv)
 

Variables

const char * useMsg
 

Function Documentation

◆ openOutput()

static FILE * openOutput ( const char *  chr)
static

Open a file named <chr>.mapmix for output, or abort if that file already exists or cannot be opened for writing.

Return pointer to opened file.

◆ 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: mapmix --admix <fraction> --zero <a.legosim>"
" --one <b.legosim>\\\n"
" <x>=<in_1> <y>=<in_2> ... outgroup=<in_K>\n\n"
" where <fraction> 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, <x> and <y> are arbitrary\n"
" labels, and <in_i> are input files in raf format. Labels may not\n"
" include the character \":\". Final label must be \"outgroup\".\n"
" Writes to a series of files with names like 1.mapmix, X.mapmix,\n"
" etc, where \"1\" and \"X\" are the names of chromosomes. If these\n"
" files already exist, the program aborts.\n"
"\n"
" If <in_i> file name ends with .gz, input is decompressed using\n"
" gunzip.\n"