source: branches/stable/CONSENSUS_TREE/CT_hash.hxx

Last change on this file was 11401, checked in by westram, 7 years ago
  • reintegrates 'tree' into 'trunk':
    • consensus trees:
      • support for merging partial trees ("worked" before, but results were crap; implements #65)
      • generated trees are automatically re-rooted and -ordered
      • always list source trees in consensus-tree-comment; show info about partial trees
      • fixed progress bar
    • made GBT_TREE a base class of other tree classes (implements #31)
    • save tree properties in properties (not in DB)
    • new functions 'Remove zombies/marked from ALL trees'
    • tree load/save: layout fixes
    • unit tests
      • added tests for basic tree modifications (PARSIMONY)
    • performance:
      • compute_tree updates tree information in one traversal
      • tree generators are now capable to generate any type of tree (w/o needing to copy it once)
    • bugfixes:
      • NNI (of marked species) was also always performed for colored species
      • centered beautify-order is stable now
      • improved 'search optimal root'
  • adds:
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : CT_hash.hxx                                       //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#ifndef CT_HASH_HXX
12#define CT_HASH_HXX
13
14#ifndef CT_PART_HXX
15#include "CT_part.hxx"
16#endif
17#ifndef _GLIBCXX_SET
18#include <set>
19#endif
20#ifndef _GLIBCXX_VECTOR
21#include <vector>
22#endif
23
24typedef PART *PARTptr;
25typedef std::set<PARTptr, bool (*)(const PART *, const PART *)> PartSet;
26typedef std::vector<PARTptr> PartVector;
27
28inline bool topological_less(const PART *p1, const PART *p2) { return p1->topological_cmp(p2)<0; }
29
30class PartRegistry : virtual Noncopyable {
31    PartSet    parts;
32    PartSet    artificial_parts; // these occurred in no tree
33    PartVector sorted;
34    size_t     retrieved;
35
36    bool registration_phase() const { return sorted.empty(); }
37    bool retrieval_phase() const { return !registration_phase(); }
38
39    void merge_artificial_parts();
40
41public:
42    PartRegistry()
43        : parts(topological_less),
44          artificial_parts(topological_less),
45          retrieved(0)
46    {
47        arb_assert(registration_phase());
48    }
49    ~PartRegistry();
50
51    void put_part_from_complete_tree(PART*& part);
52    void put_part_from_partial_tree(PART*& part, const PART *partialTree);
53    void put_artificial_part(PART*& part);
54
55    void  build_sorted_list(double overall_weight);
56    PART *get_part();
57
58    size_t size() const {
59        if (registration_phase()) return parts.size()+artificial_parts.size();
60        return sorted.size();
61    }
62};
63
64#else
65#error CT_hash.hxx included twice
66#endif // CT_HASH_HXX
Note: See TracBrowser for help on using the repository browser.