| Bsoft 2.0.5 Bernard's software package

rwtree.h
Go to the documentation of this file.
1
10 #ifndef _Bnode_
11 /************************************************************************
12 @Object: struct Bnode
13 @Description:
14 Unrooted tree node structure.
15 @Features:
16 An unrooted tree consists of a set of trifurcated internal nodes and
17 a set of end or tip nodes. The choice of the root node is arbitrary,
18 although it is always defined as the entry point into the tree.
19 The branch length is the distance from the node closer to the root
20 of the tree (thus inherent directionality which must be reset if
21 the tree is rerooted). The plot angle is just a convenient field
22 for tree display.
23 *************************************************************************/
24 struct Bnode {
25 Bnode *one, *two, *three; // Node pointers, two are 0 for tip nodes
26 int number; // Number of tip nodes in branch, 1 for a tip node
27 char label[100]; // Node label, '.' denotes an internal node
28 float length; // Branch length
29 float angle; // Plot angle
30 };
31 #define _Bnode_
32 #endif
33
34 // Function prototypes
35 Bnode* read_tree(char* filename);
36 Bnode* tree_read_node(char** handle, Bnode* parent);
37 int tree_calculate_angle(Bnode* node, int* itip, float tip_angle);
38 int tree_delete_node(Bnode* node);
39 int tree_rotate(Bnode* node, float angle);
40 int tree_show(Bnode* node);
read_tree
Bnode * read_tree(char *filename)
Reads a phylip format tree file.
Definition: rwtree.cpp:23
tree_delete_node
int tree_delete_node(Bnode *node)
Deletes a node with all daughter nodes.
Definition: rwtree.cpp:160
tree_read_node
Bnode * tree_read_node(char **handle, Bnode *parent)
Reads a node into a tree structure.
Definition: rwtree.cpp:75
tree_rotate
int tree_rotate(Bnode *node, float angle)
Adds an angle to all nodes.
Definition: rwtree.cpp:184
Bnode::two
Bnode * two
Definition: rwtree.h:25
Bnode::label
char label[100]
Definition: rwtree.h:27
tree_calculate_angle
int tree_calculate_angle(Bnode *node, int *itip, float tip_angle)
Calculates an angle for each node for plotting.
Definition: rwtree.cpp:133
Bnode::length
float length
Definition: rwtree.h:28
Bnode::angle
float angle
Definition: rwtree.h:29
Bnode::number
int number
Definition: rwtree.h:26
Bnode::three
Bnode * three
Definition: rwtree.h:25
tree_show
int tree_show(Bnode *node)
Shows a node with all daughter nodes.
Definition: rwtree.cpp:204
Bnode
Definition: rwtree.h:24
Bnode::one
Bnode * one
Definition: rwtree.h:25