Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
QTCluster Class Reference

A representation of a QT cluster used for feature grouping. More...

#include <OpenMS/DATASTRUCTURES/QTCluster.h>

Public Member Functions

 QTCluster (GridFeature *center_point, Size num_maps, double max_distance, bool use_IDs)
 Detailed constructor. More...
 
virtual ~QTCluster ()
 Destructor. More...
 
double getCenterRT () const
 Returns the RT value of the cluster. More...
 
double getCenterMZ () const
 Returns the m/z value of the cluster center. More...
 
Size size () const
 Returns the size of the cluster (number of elements, incl. center) More...
 
bool operator< (QTCluster &cluster)
 Compare by quality. More...
 
void add (GridFeature *element, double distance)
 Adds a new element/neighbor to the cluster. More...
 
void getElements (OpenMSBoost::unordered_map< Size, GridFeature * > &elements)
 Gets the clustered elements. More...
 
bool update (const OpenMSBoost::unordered_map< Size, GridFeature * > &removed)
 Updates the cluster after data points were removed. More...
 
double getQuality ()
 Returns the cluster quality. More...
 
const std::set< AASequence > & getAnnotations ()
 Return the set of peptide sequences annotated to the cluster center. More...
 
void setInvalid ()
 
bool isInvalid ()
 
NeighborMap getNeighbors ()
 

Private Types

typedef OpenMSBoost::unordered_map< Size, std::multimap< double, GridFeature * > > NeighborMap
 Mapping: input map -> distance to center (ordered!) -> neighboring point. More...
 

Private Member Functions

 QTCluster ()
 Base constructor (not accessible) More...
 
void computeQuality_ ()
 Computes the quality of the cluster. More...
 
double optimizeAnnotations_ ()
 Finds the optimal annotation (peptide sequences) for the cluster. More...
 

Private Attributes

GridFeaturecenter_point_
 Pointer to the cluster center. More...
 
NeighborMap neighbors_
 Neighbors of the cluster center, sorted by distance, for different input maps. More...
 
double max_distance_
 Maximum distance of a point that can still belong to the cluster. More...
 
Size num_maps_
 Number of input maps. More...
 
double quality_
 Quality of the cluster. More...
 
bool changed_
 Has the cluster changed (if yes, quality needs to be recomputed)? More...
 
bool use_IDs_
 Keep track of peptide IDs and use them for matching? More...
 
std::set< AASequenceannotations_
 Set of annotations of the cluster. More...
 
bool valid_
 

Detailed Description

A representation of a QT cluster used for feature grouping.

Ultimately, a cluster represents a group of corresponding features (or consensus features) from different input maps (feature maps or consensus maps).

Clusters are defined by their center points (one feature each). A cluster also stores a number of potential cluster elements (other features) from different input maps, together with their distances to the cluster center. Every feature that satisfies certain constraints with respect to the cluster center is a potential cluster element. However, since a feature group can only contain one feature from each input map, only the "best" (i.e. closest to the cluster center) such feature is considered a true cluster element.

The QT clustering algorithm has the characteristic of initially producing all possible, overlapping clusters. Iteratively, the best cluster is then extracted and the clustering is recomputed for the remaining points.

In our implementation, multiple rounds of clustering are not necessary. Instead, the clustering is updated in each iteration. This is the reason for storing all potential cluster elements: When a certain cluster is finalized, its elements have to be removed from the remaining clusters, and affected clusters change their composition. (Note that clusters can also be invalidated by this, if the cluster center is being removed.)

The quality of a cluster is the normalized average distance to the cluster center for present and missing cluster elements. The distance value for missing elements (if the cluster contains no feature from a certain input map) is the user-defined threshold that marks the maximum allowed radius of a cluster.

See also
QTClusterFinder

Member Typedef Documentation

typedef OpenMSBoost::unordered_map<Size, std::multimap<double, GridFeature*> > NeighborMap
private

Mapping: input map -> distance to center (ordered!) -> neighboring point.

Note
There should never be an empty sub-map! (When a sub-map becomes empty, it should be removed from the overall map.)

Constructor & Destructor Documentation

QTCluster ( )
private

Base constructor (not accessible)

QTCluster ( GridFeature center_point,
Size  num_maps,
double  max_distance,
bool  use_IDs 
)

Detailed constructor.

Parameters
center_pointPointer to the center point
num_mapsNumber of input maps
max_distanceMaximum allowed distance of two points
use_IDsUse peptide annotations?
virtual ~QTCluster ( )
virtual

Destructor.

Member Function Documentation

void add ( GridFeature element,
double  distance 
)

Adds a new element/neighbor to the cluster.

Note
There is no check whether the element/neighbor already exists in the cluster!
Parameters
elementThe element to be added
distanceDistance of the element to the center point
void computeQuality_ ( )
private

Computes the quality of the cluster.

const std::set<AASequence>& getAnnotations ( )

Return the set of peptide sequences annotated to the cluster center.

double getCenterMZ ( ) const

Returns the m/z value of the cluster center.

double getCenterRT ( ) const

Returns the RT value of the cluster.

void getElements ( OpenMSBoost::unordered_map< Size, GridFeature * > &  elements)

Gets the clustered elements.

NeighborMap getNeighbors ( )
inline
double getQuality ( )

Returns the cluster quality.

bool isInvalid ( )
inline
bool operator< ( QTCluster cluster)

Compare by quality.

double optimizeAnnotations_ ( )
private

Finds the optimal annotation (peptide sequences) for the cluster.

The optimal annotation is the one that results in the best quality. It is stored in annotations_;

Returns
The total distance between cluster elements and the center.
void setInvalid ( )
inline
Size size ( ) const

Returns the size of the cluster (number of elements, incl. center)

bool update ( const OpenMSBoost::unordered_map< Size, GridFeature * > &  removed)

Updates the cluster after data points were removed.

Returns
Whether the cluster is still valid (it's not if the cluster center is among the removed points).

Member Data Documentation

std::set<AASequence> annotations_
private

Set of annotations of the cluster.

The set of peptide sequences that is compatible to the cluster center and results in the best cluster quality.

GridFeature* center_point_
private

Pointer to the cluster center.

bool changed_
private

Has the cluster changed (if yes, quality needs to be recomputed)?

double max_distance_
private

Maximum distance of a point that can still belong to the cluster.

NeighborMap neighbors_
private

Neighbors of the cluster center, sorted by distance, for different input maps.

The first (best) point in each sub-map is considered a cluster element.

Size num_maps_
private

Number of input maps.

double quality_
private

Quality of the cluster.

bool use_IDs_
private

Keep track of peptide IDs and use them for matching?

bool valid_
private

OpenMS / TOPP release 2.0.0 Documentation generated on Tue Aug 25 2015 05:54:06 using doxygen 1.8.9.1