-
Notifications
You must be signed in to change notification settings - Fork 10
API Reference (Tree Module)
pll_utree_TBR()
pll_utree_SPR()
pll_utree_NNI()
pll_utree_bisect()
pll_utree_reconnect()
pll_utree_prune()
pll_utree_regraft()
pll_utree_interchange()
pll_utree_create_node()
pll_utree_connect_nodes()
pll_utree_traverse_apply()
pll_utree_is_tip()
pll_utree_set_length()
pll_utree_compute_lk()
pll_utree_traverse_apply()
pll_utree_nodes_at_node_dist()
pll_utree_nodes_at_edge_dist()
pll_utree_rf_distance()
pll_utree_split_rf_distance()
pll_utree_split_create()
pll_utree_split_show()
pll_utree_split_destroy()
pllmod_utree_serialize()
pllmod_utree_expand()
int pll_utree_tbr(pll_unode_t * b_edge,
pll_tree_edge_t * r_edge,
pll_tree_rollback_t * rollback_info);
Applies a TBR move (tree bisection and reconnection) to the tree by bisecting the tree at b_edge
and reconnect the edges r_edge.parent
and r_edge.child
. If rollback_info
is not null, it fills the structure such that the move can be undone.
1 Bisect tree. p_edge
and the adjacent edges are removed. The result of this operation is 2 unconnected trees.
2 Reconnect tree. r_edge.parent
and r_edge.child
are joint together.
3 The result is a new tree. Nodes and branches were rearranged for clarity.
int pll_utree_spr(pll_unode_t * p_edge,
pll_unode_t * r_edge,
pll_tree_rollback_t * rollback_info);
Applies a SPR move (subtree pruning and regrafting) to the tree by prunning p_edge
and regrafting it into r_edge
. If rollback_info
is not null, it fills the structure such that the move can be undone.
1 Prune subtree. p_edge
is detached from the tree and the adjacent edges are joint together.
2 Regraft subtree. The node is attached to r_edge
.
3 Rollback information.
int pll_utree_nni(pll_unode_t * edge,
int type,
pll_tree_rollback_t * rollback_info);
Applies a NNI move (nearest neighbor interchange) to the tree by interchanging the branch adjacent to edge
with one of the branches at the complementary side.
1 Adjacent branch to edge
is interchange with a non-adjacent one according to type
, that chooses between the 2 possible NNI moves across one branch.
2 Rollback information.
int pll_utree_traverse_apply(pll_unode_t * root,
int (*cb_pre_trav)(pll_unode_t *, void *),
int (*cb_post_trav)(pll_unode_t *, void *),
void *data);
Apply callback function by traversing the tree in pre- and post-order. Both callback functions are applied together while traversing the tree. cb_pre_trav
will be applied in pre-order, and cb_post_trav
in post-order.
The callback functions contain two parameters. The first one, pll_utree_t *
is the node where the function was called. The second one is the data
void pointer, containing whatever information is required by the functions.
For the above topology, pll_utree_traverse_apply
will traverse the tree as depicted in the following image:
The pre-order callback function, cb_pre_trav
is called the first time each node is visited: {9,5,6,10,7,1,2,8,3,4}
The post-order callback function, cb_post_trav
is called the last time each node is visited: {5,6,9,1,2,7,3,4,8,10}. In addition, cb_post_trav
returns an integer value that determines whether the function should continue traversing, or it should stop.
If both functions are defined, the calls are still executed in the described order, so they will be called interleaved: {pre(9), pre(5), post(5), pre(6), post(6), post(9), pre(10), pre(7), pre(1), post(1), pre(2), post(2), post(7), pre(8), pre(3), post(3), pre(4), post(4), post(8), post(10)}
inline int pll_utree_is_tip(pll_unode_t * node);
Returns true if node
is a tip.
inline void pll_utree_set_length(pll_unode_t * edge,
double length);
Sets the length of the edge
node.
double pll_utree_compute_lk(pll_partition_t * partition,
pll_unode_t * tree,
unsigned int params_index,
unsigned int freqs_index,
int update_pmatrices,
int update_partials);
Computes the likelihood directly from a tree structure, rooted at tree
without the need to build a traversal descriptor. The last 2 arguments, update_pmatrices
and update_partials
are flags that determine whether the p-matrices or conditional likelihood vectors should be recomputed.
pll_utree_t * pllmod_utree_serialize(pll_unode_t * tree,
unsigned int tip_count);
Serializes an unrooted tree structure such that it can be easily be shared between processes or saved into a binary file. Only node and branch fix-length attributes are saved, so for example tips/node names or data pointers are set to NULL.
Returns an array of 2*tip_count - 2
(i.e., the number of nodes), but all pointers are set to NULL, so keep in mind that you need to call pllmod_utree_expand
before using the return value as a regular tree structure.
pll_utree_t * pllmod_utree_expand(pll_unode_t * serialized_tree,
unsigned int tip_count);
Expands a serialized unrooted tree structure into a functional tree. The input arguments are not changed.
- Wiki Home
- Modules:
- Binary Module
- Msa Module
- Optimize Module
- Tree Module
- Util Module
- Algorithm Module
- Use cases (Binary module):
- Saving and loading partitions
- Use cases (Tree module):
- Computing RF distance