OpenMS
Loading...
Searching...
No Matches
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
16namespace OpenMS
17{
18
24 class OPENMS_DLLAPI ClusterAnalyzer
25 {
26public:
29
32
35
46 std::vector<float> averageSilhouetteWidth(const std::vector<BinaryTreeNode> & tree, const DistanceMatrix<float> & original);
47
56 std::vector<float> dunnIndices(const std::vector<BinaryTreeNode> & tree, const DistanceMatrix<float> & original, const bool tree_from_singlelinkage = false);
57
65 std::vector<float> cohesion(const std::vector<std::vector<Size> > & clusters, const DistanceMatrix<float> & original);
66
76 float averagePopulationAberration(Size cluster_quantity, std::vector<BinaryTreeNode> & tree);
77
93 void cut(const Size cluster_quantity, const std::vector<BinaryTreeNode> & tree, std::vector<std::vector<Size> > & clusters);
94
106 void cut(const Size cluster_quantity, const std::vector<BinaryTreeNode> & tree, std::vector<std::vector<BinaryTreeNode> > & subtrees);
107
116 std::string newickTree(const std::vector<BinaryTreeNode> & tree, const bool include_distance = false);
117
118private:
121
122 };
125
126}
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:25
void cut(const Size cluster_quantity, const std::vector< BinaryTreeNode > &tree, std::vector< std::vector< Size > > &clusters)
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.
ClusterAnalyzer & operator=(const ClusterAnalyzer &source)
assignment operator
virtual ~ClusterAnalyzer()
destructor
ClusterAnalyzer(const ClusterAnalyzer &source)
copy constructor
std::vector< float > averageSilhouetteWidth(const std::vector< BinaryTreeNode > &tree, const DistanceMatrix< float > &original)
Method to calculate the average silhouette widths for a clustering.
float averagePopulationAberration(Size cluster_quantity, std::vector< BinaryTreeNode > &tree)
Method to calculate the average aberration from average population in partition resulting from a cert...
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...
ClusterAnalyzer()
default constructor
std::vector< float > cohesion(const std::vector< std::vector< Size > > &clusters, const DistanceMatrix< float > &original)
Method to calculate the cohesions of a certain partition.
std::string newickTree(const std::vector< BinaryTreeNode > &tree, const bool include_distance=false)
Returns the hierarchy described by a clustering tree as Newick-String.
A two-dimensional distance matrix, similar to OpenMS::Matrix.
Definition DistanceMatrix.h:42
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