12 #ifndef DI_CLUSTERTREE_HXX
13 #define DI_CLUSTERTREE_HXX
18 #ifndef AP_SEQUENCE_HXX
26 #define cl_assert(cond) arb_assert(cond)
45 unsigned minClusterSize;
57 unsigned get_minClusterSize()
const {
return minClusterSize; }
65 ClusterTree *ct1, *ct2;
73 const ClusterTree *
first()
const {
return ct1; }
74 const ClusterTree *
second()
const {
return ct2; }
77 return ct1 == other.ct1 ? ct2<other.ct2 : ct1<other.ct1;
91 if (value == other.value)
return *pair < *other.pair;
92 return value < other.value;
107 #define TRACE_DIST_CALC
124 void calc_branch_depths();
125 void calc_branch_dists();
127 #if defined(TRACE_DIST_CALC)
128 unsigned calculatedDistances;
129 #endif // TRACE_DIST_CALC
131 unsigned get_depth()
const {
return depth; }
133 unsigned possible_relations()
const {
return (leaf_count*(leaf_count-1)) / 2; }
134 unsigned known_seqDists()
const {
return knows_seqDists() ? possible_relations() : 0; }
137 if (!branchDepths) calc_branch_depths();
142 if (!branchDists) calc_branch_dists();
148 const ClusterTree *commonFatherWith(
const ClusterTree *other)
const;
150 void oblivion(
bool forgetDistances);
154 delete worstKnownDistance;
155 delete sequenceDists;
159 friend class ClusterTreeRoot;
171 worstKnownDistance(
NULp)
180 #if defined(TRACE_DIST_CALC)
181 unsigned get_calculated_distances()
const {
return calculatedDistances; }
182 #endif // TRACE_DIST_CALC
194 inline TreeNode *ClusterTreeRoot::makeNode()
const {
return new ClusterTree(const_cast<ClusterTreeRoot*>(
this)); }
195 inline void ClusterTreeRoot::destroyNode(
TreeNode *
node)
const {
delete DOWNCAST(ClusterTree*, node); }
202 #error di_clustertree.hxx included twice
203 #endif // DI_CLUSTERTREE_HXX
TwoLeafs(ClusterTree *c1, ClusterTree *c2)
ClusterTree(ClusterTreeRoot *tree_root_)
const ClusterTree * second() const
~ClusterTreeRoot() OVERRIDE
#define DEFINE_DOWNCAST_ACCESSORS(CLASS, NAME, VALUE)
AP_FLOAT get_maxDistance() const
const ClusterTree * first() const
ClusterState get_state() const
LeafRelations::const_iterator LeafRelationCIter
#define OVERRIDE_SEQ_ACCESSORS(SEQTYPE, BASETREETYPE)
#define DOWNCAST(totype, expr)
unsigned get_cluster_count() const
virtual TreeNode * makeNode() const =0
DEFINE_TREE_ACCESSORS(ARB_seqtree_root, ARB_countedTree)
AP_FLOAT get_min_bases() const
const TwoLeafs & get_pair() const
std::map< TwoLeafs, AP_FLOAT > LeafRelations
bool operator<(const LeafRelation &other) const
LeafRelation(const TwoLeafs &pair_, AP_FLOAT value_)
virtual void init_tree()=0
std::map< ClusterTree *, AP_FLOAT > NodeValues
bool operator<(const TwoLeafs &other) const
unsigned get_leaf_count() const OVERRIDE