Legofit
infers population history from nucleotide site patterns.
Data Structures | Macros | Enumerations | Functions | Variables
booma.c File Reference
#include "string.h"
#include "strint.h"
#include "tokenizer.h"
#include "misc.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

Data Structures

struct  ModSelCrit
 
struct  ModPar
 
struct  ParNameLst
 

Macros

#define LINESIZE   65536
 
#define MAXNAME   100
 

Enumerations

enum  MscType { MSC_BEPE , MSC_CLIC , MSC_UNKNOWN }
 

Functions

void usage (void)
 
ModSelCritModSelCrit_new (const char *fname)
 Construct a new object of type ModSelCrit by parsing a file. More...
 
void ModSelCrit_free (ModSelCrit *self)
 
int ModSelCrit_compare (ModSelCrit *x, ModSelCrit *y, MscType msctype)
 
int ModSelCrit_dim (ModSelCrit *self)
 
double ModSelCrit_badness (ModSelCrit *self, int ndx)
 
ModParModPar_new (const char *fname, ParNameLst **namelist)
 ModPar constructor. More...
 
void ModPar_free (ModPar *self)
 
int ModPar_exists (ModPar *self, const char *parname)
 Return 1 if parname exists w/i this model; 0 otherwise.
 
double ModPar_value (ModPar *self, int row, const char *parname)
 
int ModPar_nrows (ModPar *self)
 
int ModPar_ncols (ModPar *self)
 
char * ModPar_dataFileName (ModPar *self, int i)
 
ParNameLstParNameLst_new (const char *name, ParNameLst *next)
 ParNameLst constructor.
 
ParNameLstParNameLst_insert (ParNameLst *self, const char *name)
 Insert a new name. Do nothing if name already exists.
 
void ParNameLst_free (ParNameLst *self)
 Free linked list of ParNameLst objects.
 
int ParNameLst_exists (ParNameLst *self, const char *name)
 Return 1 if name is present in list, 0 otherwise.
 
void ParNameLst_print (const ParNameLst *self, FILE *fp)
 Print linked list of ParNameLst objects.
 
unsigned ParNameLst_size (ParNameLst *self)
 Return number of links in list.
 
MscType Msc_classify (const char *s)
 Return 1 if string ends with ".bepe", 0 otherwise.
 
const char * Msc_name (MscType msctype)
 
char * clic_datafname (char *fname, char **end)
 Parse a file name of form "abc-dataname-def.pts". More...
 
int cliccmp (char *xarg, char *yarg)
 Compare two .pts file names, which must be of form "abc-name-def.pts". More...
 
int legofitFileMismatch (ModSelCrit *msc, ModPar *modpar)
 
int main (int argc, char **argv)
 

Variables

const char * usageMsg
 

Function Documentation

◆ clic_datafname()

char * clic_datafname ( char *  fname,
char **  end 
)

Parse a file name of form "abc-dataname-def.pts".

Function returns pointer to character after the first dash. On return *end points to the second dash. If fname doesn't have exactly two dashes, return NULL.

Referenced by cliccmp().

◆ cliccmp()

int cliccmp ( char *  xarg,
char *  yarg 
)

Compare two .pts file names, which must be of form "abc-name-def.pts".

Only the portion between the two dashes is compared. It is illegal for a name to have more or fewer than two dashes.

References clic_datafname().

◆ ModPar_new()

ModPar * ModPar_new ( const char *  fname,
ParNameLst **  namelist 
)

ModPar constructor.

First argument is the name of a file in the format produced by flatfile.py. Second argument is the address of a ParNameLst. On return, this list will contain the names of parameters in the input file.

◆ ModSelCrit_new()

ModSelCrit * ModSelCrit_new ( const char *  fname)

Construct a new object of type ModSelCrit by parsing a file.

Return NULL on failure.

Variable Documentation

◆ usageMsg

const char* usageMsg
Initial value:
=
"Usage: booma <m1.msc> ... <mK.msc> -F <m1.flat> ... <mK.flat>\n"
"\n"
"Here, the \"mX\" arguments refer to model \"X\". The \"msc\" suffix\n"
"stands for \"model selection criterion\", which might look like\n"
"either \".bepe\" or \".clic\". After the \"-F\" argument comes a\n"
"list of files, each of which can be generated by \"flatfile.py\".\n"
"There must be a \".flat\" file for each \".msc\" file, in the same\n"
"order.\n"