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, WarningConsumer warn) {
15  if (tree->leftson) {
17  else tree->leftlen *= length_scale;
18 
19  TREE_scale(tree->get_leftson(), length_scale, bootstrap_scale, warn);
20  }
21  if (tree->rightson) {
23  else tree->rightlen *= length_scale;
24 
25  TREE_scale(tree->get_rightson(), length_scale, bootstrap_scale, warn);
26  }
27 
28  if (!tree->is_leaf() && !tree->is_root_node()) {
29  bool skip = tree->is_son_of_root() && tree->is_rightson() && !tree->get_brother()->is_leaf(); // modify root edge only once
30  if (!skip) {
31  double bootstrap;
32  switch (tree->parse_bootstrap(bootstrap, warn)) {
33  case REMARK_BOOTSTRAP: tree->set_bootstrap(bootstrap*bootstrap_scale); break;
34  case REMARK_OTHER: break; // do not touch custom node remarks
35  case REMARK_NONE: break; // does not scale implicit 100% bootstrap "value" (intentionally)
36  }
37  }
38  }
39 }
40 
41 
void set_bootstrap(double bootstrap)
Definition: TreeNode.cxx:841
bool is_rightson() const
Definition: TreeNode.h:285
bool is_marked_as_default_len(GBT_LEN len)
Definition: TreeRead.h:23
#define DEFAULT_BRANCH_LENGTH
Definition: arbdbt.h:18
GBT_LEN leftlen
Definition: TreeNode.h:224
TreeNode * rightson
Definition: TreeNode.h:223
bool is_son_of_root() const
Definition: TreeNode.h:307
GBT_RemarkType parse_bootstrap(double &bootstrap, WarningConsumer report)
Definition: TreeNode.cxx:763
void TREE_scale(TreeNode *tree, double length_scale, double bootstrap_scale, WarningConsumer warn)
Definition: TreeTools.cxx:14
bool is_root_node() const
Definition: TreeNode.h:486
TreeNode * get_brother()
Definition: TreeNode.h:489
TreeNode * leftson
Definition: TreeNode.h:223
GBT_LEN rightlen
Definition: TreeNode.h:224
bool is_leaf() const
Definition: TreeNode.h:263
void(* WarningConsumer)(const char *message)
Definition: arbdbt.h:84