2
// File: HierarchicalClustering.h
3
// From file Cluster.h in CoMap package.
4
// Created by: Julien Dutheil
5
// Created on: Tue Aug 30 17:19 2005
9
Copyright or © or Copr. Bio++ Development Team, (November 16, 2004, 2005, 2006)
11
This software is a computer program whose purpose is to map substitutions
12
on a tree and to detect co-evolving positions in a dataset.
14
This software is governed by the CeCILL license under French law and
15
abiding by the rules of distribution of free software. You can use,
16
modify and/ or redistribute the software under the terms of the CeCILL
17
license as circulated by CEA, CNRS and INRIA at the following URL
18
"http://www.cecill.info".
20
As a counterpart to the access to the source code and rights to copy,
21
modify and redistribute granted by the license, users are provided only
22
with a limited warranty and the software's author, the holder of the
23
economic rights, and the successive licensors have only limited
26
In this respect, the user's attention is drawn to the risks associated
27
with loading, using, modifying and/or developing or reproducing the
28
software by the user in light of its specific status of free software,
29
that may mean that it is complicated to manipulate, and that also
30
therefore means that it is reserved for developers and experienced
31
professionals having in-depth computer knowledge. Users are therefore
32
encouraged to load and test the software's suitability as regards their
33
requirements in conditions enabling the security of their systems and/or
34
data to be ensured and, more generally, to use and operate it in the
35
same conditions as regards security.
37
The fact that you are presently reading this means that you have had
38
knowledge of the CeCILL license and that you accept its terms.
41
#ifndef _HIERARCHICALCLUSTERING_H_
42
#define _HIERARCHICALCLUSTERING_H_
44
#include "AbstractAgglomerativeDistanceMethod.h"
51
unsigned int numberOfLeaves;
54
ClusterInfos(): numberOfLeaves(0), length(0) {}
58
* @brief Hierarchical clustering.
60
* This class implements the complete, single, average (= UPGMA), median, ward and centroid linkage methods.
62
class HierarchicalClustering:
63
public AbstractAgglomerativeDistanceMethod
66
static const std::string COMPLETE;
67
static const std::string SINGLE;
68
static const std::string AVERAGE;
69
static const std::string MEDIAN;
70
static const std::string WARD;
71
static const std::string CENTROID;
78
* @brief Builds a new clustering object.
80
* @param method The linkage method to use. should be one of COMPLETE, SINGLE, AVERAGE, MEDIAN, WARD, CENTROID.
81
* @param verbose Tell if some progress information should be displayed.
83
HierarchicalClustering(const std::string& method, bool verbose = false):
84
AbstractAgglomerativeDistanceMethod(verbose), method_(method) {}
85
HierarchicalClustering(const std::string& method, const DistanceMatrix& matrix, bool verbose = false) throw (Exception): AbstractAgglomerativeDistanceMethod(matrix, verbose), method_(method)
90
virtual ~HierarchicalClustering() {}
93
TreeTemplate<Node>* getTree() const;
96
std::vector<unsigned int> getBestPair() throw (Exception);
97
std::vector<double> computeBranchLengthsForPair(const std::vector<unsigned int>& pair);
98
double computeDistancesFromPair(const std::vector<unsigned int>& pair, const std::vector<double> & branchLengths, unsigned int pos);
99
void finalStep(int idRoot);
100
virtual Node* getLeafNode(int id, const std::string& name);
101
virtual Node* getParentNode(int id, Node* son1, Node* son2);
104
} //end of namespace bpp.
106
#endif //_HIERARCHICALCLUSTERING_H_