ARB
TreeTools.cxx
Go to the documentation of this file.
1 // ============================================================ //
2 // //
3 // File : TreeTools.cxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // www.arb-home.de //
8 // //
9 // ============================================================ //
10 
11 #include "TreeRead.h"
12 #include <TreeNode.h>
13 
14 void TREE_scale(TreeNode *tree, double length_scale, double bootstrap_scale) {
15  if (tree->leftson) {
17  else tree->leftlen *= length_scale;
18 
19  TREE_scale(tree->get_leftson(), length_scale, bootstrap_scale);
20  }
21  if (tree->rightson) {
23  else tree->rightlen *= length_scale;
24 
25  TREE_scale(tree->get_rightson(), length_scale, bootstrap_scale);
26  }
27 
28  if (!tree->is_leaf()) {
29  double bootstrap;
30  switch (tree->parse_bootstrap(bootstrap)) {
31  case REMARK_BOOTSTRAP: tree->set_bootstrap(bootstrap*bootstrap_scale); break;
32  case REMARK_OTHER: tree->remove_remark(); break; // remove non-bootstrap comments
33  case REMARK_NONE: break;
34  }
35  }
36 }
37 
38 
void set_bootstrap(double bootstrap)
Definition: TreeNode.h:323
void TREE_scale(TreeNode *tree, double length_scale, double bootstrap_scale)
Definition: TreeTools.cxx:14
GBT_RemarkType parse_bootstrap(double &bootstrap) const
Definition: TreeNode.h:302
bool is_marked_as_default_len(GBT_LEN len)
Definition: TreeRead.h:20
#define DEFAULT_BRANCH_LENGTH
Definition: arbdbt.h:18
GBT_LEN leftlen
Definition: TreeNode.h:172
TreeNode * rightson
Definition: TreeNode.h:171
TreeNode * leftson
Definition: TreeNode.h:171
GBT_LEN rightlen
Definition: TreeNode.h:172
void remove_remark()
Definition: TreeNode.h:326
bool is_leaf() const
Definition: TreeNode.h:211