Legofit
infers population history from nucleotide site patterns.
lblndx.h
1#ifndef ARR_LBLNDX
2# define ARR_LBLNDX
3
4# include "gptree.h"
5# include "popnode.h"
6# include "strdblqueue.h"
7
8struct LblNdx {
9 unsigned n; // number of samples
10 char lbl[MAXSAMP][POPNAMESIZE];
11};
12
13void LblNdx_init(LblNdx * self);
14void LblNdx_addSamples(LblNdx * self, unsigned nsamples,
15 const char *lbl);
16const char *LblNdx_lbl(const LblNdx * self, unsigned i);
17unsigned LblNdx_size(const LblNdx * self);
18void LblNdx_sanityCheck(const LblNdx *self, const char *file, int line);
19int LblNdx_equals(const LblNdx *lhs, const LblNdx *rhs);
20tipId_t LblNdx_getTipId(const LblNdx *self, const char *lbl);
21void LblNdx_print(const LblNdx *self, FILE *fp);
22int LblNdx_collapse(LblNdx *self, tipId_t collapse, const char *lbl);
23int LblNdx_rmPops(LblNdx *self, tipId_t remove);
25char *patLbl(size_t n, char buff[n], tipId_t tid, const LblNdx * lblndx);
26void orderpat(int n, unsigned order[n], tipId_t tid[n]);
27int compare_tipId(const void *void_x, const void *void_y);
28
29#endif
int LblNdx_collapse(LblNdx *self, tipId_t collapse, const char *lbl)
Reduce dimension of LblNdx object by collapsing several entries into a single entry.
Definition: lblndx.c:305
const char * LblNdx_lbl(const LblNdx *self, unsigned i)
Return the label associated with index i.
Definition: lblndx.c:55
void LblNdx_addSamples(LblNdx *self, unsigned nsamples, const char *lbl)
Add samples for a single population.
Definition: lblndx.c:30
unsigned LblNdx_size(const LblNdx *self)
Return number of samples, which equals number of labels.
Definition: lblndx.c:61
void LblNdx_init(LblNdx *self)
Set everything to zero.
Definition: lblndx.c:23
char * patLbl(size_t n, char buff[n], tipId_t tid, const LblNdx *lblndx)
Generate a label for site pattern tid.
Definition: lblndx.c:166
int LblNdx_from_StrDblQueue(LblNdx *lndx, StrDblQueue *queue)
Initialize a pre-allocated LblNdx from a StrDblQueue.
Definition: lblndx.c:359
void orderpat(int n, unsigned ord[n], tipId_t pat[n])
On entry, pat is an array of n tipId_t values.
Definition: lblndx.c:251
int LblNdx_equals(const LblNdx *lhs, const LblNdx *rhs)
Return 1 if the two arguments are equal; 0 otherwise.
Definition: lblndx.c:79
void LblNdx_print(const LblNdx *self, FILE *fp)
Print a LblNdx.
Definition: lblndx.c:158
tipId_t LblNdx_getTipId(const LblNdx *self, const char *lbl)
Reverse lookup.
Definition: lblndx.c:116
int compare_tipId(const void *void_x, const void *void_y)
Compare pointers to two tipId_t values.
Definition: lblndx.c:226
Definition: lblndx.h:8
Definition: strdblqueue.h:22