OpenMS
ClusterAnalyzer.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Mathias Walzer $
6 // $Authors: $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 
14 #include <vector>
15 
16 namespace OpenMS
17 {
18  class String;
19 
25  class OPENMS_DLLAPI ClusterAnalyzer
26  {
27 public:
30 
33 
35  virtual ~ClusterAnalyzer();
36 
47  std::vector<float> averageSilhouetteWidth(const std::vector<BinaryTreeNode> & tree, const DistanceMatrix<float> & original);
48 
57  std::vector<float> dunnIndices(const std::vector<BinaryTreeNode> & tree, const DistanceMatrix<float> & original, const bool tree_from_singlelinkage = false);
58 
66  std::vector<float> cohesion(const std::vector<std::vector<Size> > & clusters, const DistanceMatrix<float> & original);
67 
77  float averagePopulationAberration(Size cluster_quantity, std::vector<BinaryTreeNode> & tree);
78 
94  void cut(const Size cluster_quantity, const std::vector<BinaryTreeNode> & tree, std::vector<std::vector<Size> > & clusters);
95 
107  void cut(const Size cluster_quantity, const std::vector<BinaryTreeNode> & tree, std::vector<std::vector<BinaryTreeNode> > & subtrees);
108 
117  String newickTree(const std::vector<BinaryTreeNode> & tree, const bool include_distance = false);
118 
119 private:
122 
123  };
126 
127 }
Elements of a binary tree used to represent a hierarchical clustering process.
Definition: BinaryTreeNode.h:23
Bundles analyzing tools for a clustering (given as sequence of BinaryTreeNode's)
Definition: ClusterAnalyzer.h:26
std::vector< float > cohesion(const std::vector< std::vector< Size > > &clusters, const DistanceMatrix< float > &original)
Method to calculate the cohesions of a certain partition.
void cut(const Size cluster_quantity, const std::vector< BinaryTreeNode > &tree, std::vector< std::vector< Size > > &clusters)
ClusterAnalyzer & operator=(const ClusterAnalyzer &source)
assignment operator
virtual ~ClusterAnalyzer()
destructor
std::vector< float > averageSilhouetteWidth(const std::vector< BinaryTreeNode > &tree, const DistanceMatrix< float > &original)
Method to calculate the average silhouette widths for a clustering.
ClusterAnalyzer(const ClusterAnalyzer &source)
copy constructor
float averagePopulationAberration(Size cluster_quantity, std::vector< BinaryTreeNode > &tree)
Method to calculate the average aberration from average population in partition resulting from a cert...
std::vector< float > dunnIndices(const std::vector< BinaryTreeNode > &tree, const DistanceMatrix< float > &original, const bool tree_from_singlelinkage=false)
Method to calculate Dunns indices for a clustering.
void cut(const Size cluster_quantity, const std::vector< BinaryTreeNode > &tree, std::vector< std::vector< BinaryTreeNode > > &subtrees)
Method to calculate subtrees from a given tree resulting from a certain step in clustering given by t...
String newickTree(const std::vector< BinaryTreeNode > &tree, const bool include_distance=false)
Returns the hierarchy described by a clustering tree as Newick-String.
ClusterAnalyzer()
default constructor
A two-dimensional distance matrix, similar to OpenMS::Matrix.
Definition: DistanceMatrix.h:42
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
bool compareBinaryTreeNode(const BinaryTreeNode &x, const BinaryTreeNode &y)
returns the value of (x.distance < y.distance) for use with sort