Functions
topologies.c File Reference

Miscellanous functions working with tree topology. More...

Functions

static void saveTopolRELLRec (pllInstance *tr, nodeptr p, topolRELL *tpl, int *i, int numsp)
 
static void saveTopolRELL (pllInstance *tr, topolRELL *tpl)
 
static void restoreTopolRELL (pllInstance *tr, topolRELL *tpl, int numBranches)
 
void initTL (topolRELL_LIST *rl, pllInstance *tr, int n)
 Initializes space as large as the tree. More...
 
void freeTL (topolRELL_LIST *rl)
 Deallocate the space associated with this structure. More...
 
void restoreTL (topolRELL_LIST *rl, pllInstance *tr, int n, int numBranches)
 
void resetTL (topolRELL_LIST *rl)
 Reset this structure. More...
 
void saveTL (topolRELL_LIST *rl, pllInstance *tr, int index)
 Save. More...
 
static void * tipValPtr (nodeptr p)
 
static int cmpTipVal (void *v1, void *v2)
 
static topolsetupTopol (int maxtips)
 Allocate and initialize space for a tree topology. More...
 
static void freeTopol (topol *tpl)
 Deallocate the space occupied by a topol structure. More...
 
static int saveSubtree (nodeptr p, topol *tpl, int numsp, int numBranches)
 
static nodeptr minSubtreeTip (nodeptr p0, int numsp)
 Get the node with the smallest tip value. More...
 
static nodeptr minTreeTip (nodeptr p, int numsp)
 
static void saveTree (pllInstance *tr, topol *tpl, int numBranches)
 Save the tree topology in a topol structure. More...
 
static boolean restoreTree (topol *tpl, pllInstance *tr, partitionList *pr)
 
int initBestTree (bestlist *bt, int newkeep, int numsp)
 Initialize a list of best trees. More...
 
void resetBestTree (bestlist *bt)
 
boolean freeBestTree (bestlist *bt)
 
static int cmpSubtopol (connptr p10, connptr p1, connptr p20, connptr p2)
 
static int cmpTopol (void *tpl1, void *tpl2)
 
static int cmpTplScore (void *tpl1, void *tpl2)
 
static int findInList (void *item, void *list[], int n, int(*cmpFunc)(void *, void *))
 
static int findTreeInList (bestlist *bt, pllInstance *tr, int numBranches)
 
int saveBestTree (bestlist *bt, pllInstance *tr, int numBranches)
 Save the current tree in the bestlist structure. More...
 
int recallBestTree (bestlist *bt, int rank, pllInstance *tr, partitionList *pr)
 Restore the best tree from bestlist structure. More...
 

Detailed Description

Miscellanous functions working with tree topology.

Function Documentation

void freeTL ( topolRELL_LIST rl)

Deallocate the space associated with this structure.

rl This structure

Todo:
fill the description

+ Here is the caller graph for this function:

static void freeTopol ( topol tpl)
static

Deallocate the space occupied by a topol structure.

Deallocate the space occupied by a topol structure

Parameters
tplThe topol structure that is to be deallocated
int initBestTree ( bestlist bt,
int  newkeep,
int  numsp 
)

Initialize a list of best trees.

Initialize a list that will contain the best newkeep tree topologies, i.e. the ones that yield the best likelihood. Inside the list initialize space for newkeep + 1 topologies of numsp tips. The additional topology is the starting one

Parameters
btPointer to bestlist to be initialized
newkeepNumber of new topologies to keep
numspNumber of species (tips)
Returns
number of tree topology slots in the list (minus the starting one)
Todo:
Is there a reason that this function is so complex? Many of the checks are unnecessary as the function is called only at two places in the code with newkeep=1 and newkeep=20

+ Here is the call graph for this function:

void initTL ( topolRELL_LIST rl,
pllInstance tr,
int  n 
)

Initializes space as large as the tree.

Parameters
rlRELL
trPLL instance
nNumber of
Todo:
Don't know what is this used for. Something with RELL?

+ Here is the caller graph for this function:

static nodeptr minSubtreeTip ( nodeptr  p0,
int  numsp 
)
static

Get the node with the smallest tip value.

Recursively finds and returns the tip with the smallest value around a node p0, or returns p0 if it is a tip.

Parameters
p0Node around which to at which the recursion starts
numspNumber of species (tips) in the tree
Todo:
Why do we return p0 immediately if it is a tip? Perhaps one of the two other nodes, i.e. p0->next and p0->next->next, is a tip as well with a smaller number than p0.

+ Here is the call graph for this function:

int recallBestTree ( bestlist bt,
int  rank,
pllInstance tr,
partitionList pr 
)

Restore the best tree from bestlist structure.

Restore the rank-th best tree from the bestlist structure bt.

Parameters
btThe bestlist structure containing the stored best trees
rankThe rank (by score) of the tree we want to retrieve
trPLL instance
prList of partitions
Returns
Index (rank) of restored topology in bestlist
void resetTL ( topolRELL_LIST rl)

Reset this structure.

Reset the likelihoods in this structure

Parameters
rlThis structure
Todo:
Complete this
int saveBestTree ( bestlist bt,
pllInstance tr,
int  numBranches 
)

Save the current tree in the bestlist structure.

Save the current tree topology in bestlist structure bt.

Parameters
trThe PLL instance
btThe bestlist structure
numBranchesNumber of branches u
Returns
it is never used
Todo:
What to do with the return value? Should we simplify the code?

+ Here is the caller graph for this function:

void saveTL ( topolRELL_LIST rl,
pllInstance tr,
int  index 
)

Save.

Save this topology?

Todo:
Complete this

+ Here is the caller graph for this function:

static void saveTree ( pllInstance tr,
topol tpl,
int  numBranches 
)
static

Save the tree topology in a topol structure.

Save the current tree topology in topol structure tpl.

static topol* setupTopol ( int  maxtips)
static

Allocate and initialize space for a tree topology.

Allocate and initialize a topol structure for a tree topology of maxtips tips

Parameters
Numberof tips of topology
Returns
Pointer to the allocated topol structure

+ Here is the caller graph for this function: