source: tags/arb-7.0/SL/TREE_READ/TreeTools.cxx

Last change on this file was 17428, checked in by westram, 6 years ago
  • partial merge from 'svalues' into 'trunk'
    • root branches always need to have identical remarks (associated with the root-edge)
      • condition previously implicit, now hardened by tests/assertions/…
      • fixed several bugs that violated this condition
  • adds: log:branches/svalues@17420:17427
File size: 1.6 KB
Line 
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
14void TREE_scale(TreeNode *tree, double length_scale, double bootstrap_scale) {
15    if (tree->leftson) {
16        if (is_marked_as_default_len(tree->leftlen)) tree->leftlen  = DEFAULT_BRANCH_LENGTH;
17        else                                         tree->leftlen *= length_scale;
18
19        TREE_scale(tree->get_leftson(), length_scale, bootstrap_scale);
20    }
21    if (tree->rightson) {
22        if (is_marked_as_default_len(tree->rightlen)) tree->rightlen  = DEFAULT_BRANCH_LENGTH;
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
Note: See TracBrowser for help on using the repository browser.