|
OpenMS
2.5.0
|
Go to the documentation of this file.
79 threshold_(source.threshold_)
111 template <
typename Data,
typename SimilarityComparator>
113 const SimilarityComparator & comparator,
115 std::vector<BinaryTreeNode> & cluster_tree,
121 original_distance.
clear();
122 original_distance.
resize(data.size(), 1);
123 for (
Size i = 0; i < data.size(); i++)
125 for (
Size j = 0; j < i; j++)
128 original_distance.
setValueQuick(i, j, 1 - comparator(data[i], data[j]));
134 clusterer(original_distance, cluster_tree, threshold_);
154 void cluster(std::vector<PeakSpectrum> & data,
160 std::vector<BinaryTreeNode> & cluster_tree,
163 std::vector<BinnedSpectrum> binned_data;
164 binned_data.reserve(data.size());
167 for (
Size i = 0; i < data.size(); i++)
170 binned_data.push_back(
BinnedSpectrum(data[i], sz,
false, sp, offset));
174 original_distance.
clear();
175 original_distance.
resize(data.size(), 1);
177 for (
Size i = 0; i < binned_data.size(); i++)
179 for (
Size j = 0; j < i; j++)
182 original_distance.
setValue(i, j, 1 - comparator(binned_data[i], binned_data[j]));
187 clusterer(original_distance, cluster_tree, threshold_);
216 =
"Clustering with unnormalized similarity measurement requested, normalized is mandatory")
throw();
void cluster(std::vector< PeakSpectrum > &data, const BinnedSpectrumCompareFunctor &comparator, double sz, UInt sp, float offset, const ClusterFunctor &clusterer, std::vector< BinaryTreeNode > &cluster_tree, DistanceMatrix< float > &original_distance)
clustering function for binned PeakSpectrum
Definition: ClusterHierarchical.h:154
This is a binned representation of a PeakSpectrum.
Definition: BinnedSpectrum.h:75
void cluster(std::vector< Data > &data, const SimilarityComparator &comparator, const ClusterFunctor &clusterer, std::vector< BinaryTreeNode > &cluster_tree, DistanceMatrix< float > &original_distance)
Clustering function.
Definition: ClusterHierarchical.h:112
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Base class for compare functors of BinnedSpectra.
Definition: BinnedSpectrumCompareFunctor.h:56
virtual ~ClusterHierarchical()
destructor
Definition: ClusterHierarchical.h:84
SizeType dimensionsize() const
gives the number of rows (i.e. number of columns)
Definition: DistanceMatrix.h:418
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
Exception base class.
Definition: Exception.h:89
A two-dimensional distance matrix, similar to OpenMS::Matrix.
Definition: DistanceMatrix.h:67
void setValue(SizeType i, SizeType j, ValueType value)
sets a value at a given position:
Definition: DistanceMatrix.h:263
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
Base class for cluster functors.
Definition: ClusterFunctor.h:53
void setThreshold(double x)
Definition: ClusterHierarchical.h:199
void resize(SizeType dimensionsize, Value value=Value())
resizing the container
Definition: DistanceMatrix.h:349
ClusterHierarchical()
default constructor
Definition: ClusterHierarchical.h:72
Exception thrown if clustering is attempted without a normalized compare functor.
Definition: ClusterHierarchical.h:211
Hierarchical clustering with generic clustering functions.
Definition: ClusterHierarchical.h:63
ClusterHierarchical(const ClusterHierarchical &source)
copy constructor
Definition: ClusterHierarchical.h:78
double threshold_
the threshold given to the ClusterFunctor
Definition: ClusterHierarchical.h:68
void clear()
reset all
Definition: DistanceMatrix.h:327
double getThreshold()
get the threshold
Definition: ClusterHierarchical.h:191
void setValueQuick(SizeType i, SizeType j, ValueType value)
sets a value at a given position:
Definition: DistanceMatrix.h:309