| 1 | #define TREEBUFINCREASE 200 |
|---|
| 2 | |
|---|
| 3 | /* tree utility functions */ |
|---|
| 4 | int AddToTreeList (TreeList *treeList, Tree *tree); |
|---|
| 5 | Tree *AllocateTree (int numTaxa); |
|---|
| 6 | Tree *AllocateFixedTree (int numTaxa, int isRooted); |
|---|
| 7 | int AllocateTreePartitions (Tree *t); |
|---|
| 8 | PolyTree *AllocatePolyTree (int numTaxa); |
|---|
| 9 | int AllocatePolyTreePartitions (PolyTree *pt); |
|---|
| 10 | int AllocatePolyTreeRelClockParams (PolyTree *pt, int nBSets, int nESets); |
|---|
| 11 | int AreTopologiesSame(Tree *t1, Tree *t2); |
|---|
| 12 | int AreTreesSame (Tree *t1, Tree *t2); |
|---|
| 13 | int BuildConstraintTree (Tree *t, PolyTree *pt, char **localTaxonNames); |
|---|
| 14 | int BuildRandomRTopology (Tree *t, SafeLong *seed); |
|---|
| 15 | int BuildRandomUTopology (Tree *t, SafeLong *seed); |
|---|
| 16 | int CheckConstraints (Tree *t); |
|---|
| 17 | int CheckSetConstraints (Tree *t); |
|---|
| 18 | void ColorClusters (TreeNode *p, int *index); |
|---|
| 19 | void CopySubtreeToTree (Tree *subtree, Tree *t); |
|---|
| 20 | int CopyToPolyTreeFromPolyTree (PolyTree *to, PolyTree *from); |
|---|
| 21 | int CopyToSpeciesTreeFromPolyTree (Tree *to, PolyTree *from); |
|---|
| 22 | int CopyToTreeFromPolyTree (Tree *to, PolyTree *from); |
|---|
| 23 | void CopyPolyNodes (PolyNode *p, PolyNode *q, int nLongsNeeded); |
|---|
| 24 | int CopyToTreeFromTree (Tree *to, Tree *from); |
|---|
| 25 | void CopyTreeNodes (TreeNode *p, TreeNode *q, int nLongsNeeded); |
|---|
| 26 | void CopyTreeToSubtree (Tree *t, Tree *subtree); |
|---|
| 27 | int Deroot(PolyTree *pt); |
|---|
| 28 | void EraseTreeList (TreeList *treeList); |
|---|
| 29 | void findAllowedClockrate (Tree *t, MrBFlt *minClockRate, MrBFlt *maxClockRate ); |
|---|
| 30 | void FreePolyTree (PolyTree *pt); |
|---|
| 31 | void FreePolyTreePartitions (PolyTree *pt); |
|---|
| 32 | void FreePolyTreePopSizeParams (PolyTree *pt); |
|---|
| 33 | void FreePolyTreeRelClockParams (PolyTree *pt); |
|---|
| 34 | void FreeTree (Tree *t); |
|---|
| 35 | void FreeTreePartitions (Tree *pt); |
|---|
| 36 | void GetDatedNodeDepths (TreeNode *p, MrBFlt *nodeDepths); |
|---|
| 37 | void GetDatedNodes (TreeNode *p, TreeNode **datedNodes); |
|---|
| 38 | void GetDownPass (Tree *t); |
|---|
| 39 | void GetNodeDownPass (Tree *t, TreeNode *p, int *i, int *j); |
|---|
| 40 | void GetPolyAges (PolyTree *t); |
|---|
| 41 | void GetPolyDepths (PolyTree *t); |
|---|
| 42 | void GetPolyDownPass (PolyTree *t); |
|---|
| 43 | void GetPolyNodeDownPass (PolyTree *t, PolyNode *p, int *i, int *j); |
|---|
| 44 | int GetRandomEmbeddedSubtree (Tree *t, int nTerminals, SafeLong *seed, int *nEmbeddedTrees); |
|---|
| 45 | int GetFromTreeList (TreeList *treeList, Tree *tree); |
|---|
| 46 | int InitBrlens (Tree *t, MrBFlt v); |
|---|
| 47 | int InitCalibratedBrlens (Tree *t, MrBFlt minLength, SafeLong *seed); |
|---|
| 48 | int InitClockBrlens (Tree *t); |
|---|
| 49 | int IsCalibratedClockSatisfied (Tree *t,MrBFlt *minClockRate,MrBFlt *maxClockRate , MrBFlt tol); |
|---|
| 50 | int IsClockSatisfied (Tree *t, MrBFlt tol); |
|---|
| 51 | int IsTreeConsistent (Param *param, int chain, int state); |
|---|
| 52 | int LabelTree (Tree *t, char **taxonNames); |
|---|
| 53 | void Mark (TreeNode *p); |
|---|
| 54 | void MarkDatedSubtree (TreeNode *p); |
|---|
| 55 | int MoveCalculationRoot (Tree *t, int outgroup); |
|---|
| 56 | int MovePolyCalculationRoot (PolyTree *t, int outgroup); |
|---|
| 57 | int NumConstrainedTips (TreeNode *p); |
|---|
| 58 | int NumDatedTips (TreeNode *p); |
|---|
| 59 | void OrderTips (PolyTree *t); |
|---|
| 60 | void PrintNewick (char **s, int *len, Tree *t); |
|---|
| 61 | void PrintNodes (Tree *t); |
|---|
| 62 | void PrintPolyNodes (PolyTree *pt); |
|---|
| 63 | int PrunePolyTree (PolyTree *pt); |
|---|
| 64 | int RandPerturb (Tree *t, int nPert, SafeLong *seed); |
|---|
| 65 | int RandResolve (Tree *tt, PolyTree *t, SafeLong *seed, int destinationIsRooted); |
|---|
| 66 | int ResetBrlensFromTree (Tree *tree, Tree *vTree); |
|---|
| 67 | void ResetIntNodeIndices(PolyTree *t); |
|---|
| 68 | void ResetPolyTree (PolyTree *t); |
|---|
| 69 | void ResetPolyTreePartitions (PolyTree *pt); |
|---|
| 70 | void ResetPolyTreeRelClockParams (PolyTree *pt); |
|---|
| 71 | int ResetRootHeight (Tree *t, MrBFlt rootHeight); |
|---|
| 72 | void ResetTipIndices (PolyTree *pt); |
|---|
| 73 | int ResetTopology (Tree *t, char *s); |
|---|
| 74 | int ResetTopologyFromTree (Tree *tree, Tree *top); |
|---|
| 75 | int ResetTopologyFromPolyTree (Tree *tree, PolyTree *top); |
|---|
| 76 | void ResetTreePartitions (Tree *t); |
|---|
| 77 | int RetrieveRTopology (Tree *t, int *order); |
|---|
| 78 | int RetrieveRTree (Tree *t, int *order, MrBFlt *brlens); |
|---|
| 79 | int RetrieveRTreeWithIndices (Tree *t, int *order, MrBFlt *brlens); |
|---|
| 80 | int RetrieveUTopology (Tree *t, int *order); |
|---|
| 81 | int RetrieveUTree (Tree *t, int *order, MrBFlt *brlens); |
|---|
| 82 | void SetDatedNodeAges(Param* param, int chain, int state); |
|---|
| 83 | void SetNodeDepths (Tree *t); |
|---|
| 84 | int SetTreeNodeAges (Param *param, int chain, int state); |
|---|
| 85 | int ShowPolyNodes (PolyTree *pt); |
|---|
| 86 | int ShowTree (Tree *t); |
|---|
| 87 | int StoreRPolyTopology (PolyTree *t, int *order); |
|---|
| 88 | int StoreRPolyTree (PolyTree *t, int *order, MrBFlt *brlens); |
|---|
| 89 | int StoreRTopology (Tree *t, int *order); |
|---|
| 90 | int StoreRTree (Tree *t, int *order, MrBFlt *brlens); |
|---|
| 91 | int StoreRTreeWithIndices (Tree *t, int *order, MrBFlt *brlens); |
|---|
| 92 | int StoreUPolyTopology (PolyTree *t, int *order); |
|---|
| 93 | int StoreUPolyTree (PolyTree *t, int *order, MrBFlt *brlens); |
|---|
| 94 | int StoreUTopology (Tree *t, int *order); |
|---|
| 95 | int StoreUTree (Tree *t, int *order, MrBFlt *brlens); |
|---|
| 96 | MrBFlt TreeLen (Tree *t); |
|---|
| 97 | void Unmark (TreeNode *p); |
|---|
| 98 | void UpdateTreeWithClockrate (Tree *t, MrBFlt clockRate); |
|---|
| 99 | void WriteEventTree (TreeNode *p, int chain, Param *param); |
|---|
| 100 | void WriteEventTreeToPrintString (TreeNode *p, int chain, Param *param, int printAll); |
|---|
| 101 | void WriteEvolTree (TreeNode *p, int chain, Param *param); |
|---|
| 102 | void WriteTopologyToFile (FILE *fp, TreeNode *p, int isRooted); |
|---|
| 103 | void WriteTreeToPrintString (Param *param, int chain, TreeNode *p, int showBrlens, int isRooted); |
|---|