Legofit
infers population history from nucleotide site patterns.
Functions
gene.c File Reference

Class Gene. More...

#include "gene.h"
#include "misc.h"
#include "binary.h"
#include <string.h>
#include <stdlib.h>

Functions

GeneGene_new (tipId_t tipId)
 Constructor for Gene. More...
 
void Gene_tabulate (Gene *self, BranchTab *bt, int doSing)
 Tabulate branch lengths by tipId. More...
 
GeneGene_join (Gene *lchild, Gene *rchild)
 Create a parental Gene by coalescing two children. More...
 
void Gene_free (Gene *gene)
 Destroy a Gene.
 

Detailed Description

Class Gene.

Defines the objects that are linked together to form a gene genealogy.

Author
Alan R. Rogers

Function Documentation

◆ Gene_join()

Gene * Gene_join ( Gene lchild,
Gene rchild 
)

Create a parental Gene by coalescing two children.

The tipId of the parental gene is generated by "or"ing those of the two children. The parental gene has pointers to the children, and the children have pointers to the parent.

Returns
pointer to parental gene.

References Gene_new().

◆ Gene_new()

Gene * Gene_new ( tipId_t  tipId)

Constructor for Gene.

Parameters
[in]tipIdthe identifier of this gene

Referenced by Gene_join(), and PopNode_newSample().

◆ Gene_tabulate()

void Gene_tabulate ( Gene self,
BranchTab bt,
int  doSing 
)

Tabulate branch lengths by tipId.

Ignore root (which has null parent) because mutations there don't contribute to genetic variation.

If doSing==0, then also ignore nodes with only one descendant. These are recognizable because their tipIds are powers of 2.

Tabulate everything else.

References BranchTab_add(), and Gene_tabulate().

Referenced by Gene_tabulate().