Legofit
infers population history from nucleotide site patterns.
Loading...
Searching...
No Matches
sampndx.c File Reference

An index of haploid genetic samples. More...

#include "sampndx.h"
#include "ptrptrmap.h"
#include "misc.h"
#include <string.h>
#include <stdio.h>

Functions

void SampNdx_init (SampNdx *self)
 Set everything to zero.
void SampNdx_addSamples (SampNdx *self, unsigned nsamples, void *ptr)
 Add samples for a single population.
void * SampNdx_get (SampNdx *self, unsigned i)
 Return pointer to home of i'th sample.
unsigned SampNdx_size (SampNdx *self)
int SampNdx_equals (const SampNdx *lhs, const SampNdx *rhs)
 This equality check doesn't do much, because the pointers in different SampNdx objects don't have to be (in fact shouldn't be) equal.
void SampNdx_sanityCheck (SampNdx *self, const char *file, int line)
 Check sanity of a SampNdx.
int SampNdx_ptrsLegal (SampNdx *self, void *start, void *end)
 Return 1 if all pointers in SampNdx are in [start,end); return 0 otherwise.
void SampNdx_remapPtrs (SampNdx *self, PtrPtrMap *ppm)
 Remap pointers.

Detailed Description

An index of haploid genetic samples.

Author
Alan R. Rogers

Function Documentation

◆ SampNdx_addSamples()

void SampNdx_addSamples ( SampNdx * self,
unsigned nsamples,
void * ptr )

Add samples for a single population.

Should be called once for each sampled population. This justs sets a pointer and increments the count of pointers. It doesn't allocate anything.

References eprintf().

Referenced by parseSegment().