Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
QTCluster.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2015.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Hendrik Weisser $
32 // $Authors: Steffen Sass, Hendrik Weisser $
33 // --------------------------------------------------------------------------
34 
35 
36 #ifndef OPENMS_DATASTRUCTURES_QTCLUSTER_H
37 #define OPENMS_DATASTRUCTURES_QTCLUSTER_H
38 
39 #include <OpenMS/CONCEPT/Types.h>
41 #include <OpenMS/OpenMSConfig.h>
42 #include <OpenMS/config.h>
43 
44 #include <boost/unordered_map.hpp>
45 #include <set>
46 
47 namespace OpenMS
48 {
49  class GridFeature;
50 
51  // Boost switch since with 1.47 several classes got moved into a new
52  // boost::unordered namespace (specifically unordered_map).
53  namespace OpenMSBoost
54  {
55 #if OPENMS_BOOST_VERSION_MINOR > 47
56  using namespace boost::unordered;
57 #else
58  using namespace boost;
59 #endif
60  }
61 
62 
82  class OPENMS_DLLAPI QTCluster
83  {
84 private:
85 
90  typedef OpenMSBoost::unordered_map<Size, std::multimap<double, GridFeature*> > NeighborMap;
91 
94 
100  NeighborMap neighbors_;
101 
104 
107 
109  double quality_;
110 
112  bool changed_;
113 
115  bool use_IDs_;
116 
122  std::set<AASequence> annotations_;
123 
125  QTCluster();
126 
128  void computeQuality_();
129 
137  double optimizeAnnotations_();
138 
139  bool valid_;
140 public:
148  QTCluster(GridFeature* center_point, Size num_maps,
149  double max_distance, bool use_IDs);
150 
152  virtual ~QTCluster();
153 
155  double getCenterRT() const;
156 
158  double getCenterMZ() const;
159 
161  Size size() const;
162 
164  bool operator<(QTCluster& cluster);
165 
172  void add(GridFeature* element, double distance);
173 
175  void getElements(OpenMSBoost::unordered_map<Size, GridFeature*>& elements);
176 
181  bool update(const OpenMSBoost::unordered_map<Size, GridFeature*>& removed);
182 
184  double getQuality();
185 
187  const std::set<AASequence>& getAnnotations();
188 
189  inline void setInvalid() {valid_ = false; }
190 
191  inline bool isInvalid() {return !valid_; }
192 
193  NeighborMap getNeighbors() {return neighbors_; }
194 
195  };
196 }
197 
198 #endif // OPENMS_DATASTRUCTURES_QTCLUSTER_H
std::set< AASequence > annotations_
Set of annotations of the cluster.
Definition: QTCluster.h:122
void setInvalid()
Definition: QTCluster.h:189
A representation of a QT cluster used for feature grouping.
Definition: QTCluster.h:82
NeighborMap neighbors_
Neighbors of the cluster center, sorted by distance, for different input maps.
Definition: QTCluster.h:100
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
NeighborMap getNeighbors()
Definition: QTCluster.h:193
GridFeature * center_point_
Pointer to the cluster center.
Definition: QTCluster.h:93
Representation of a feature in a hash grid.
Definition: GridFeature.h:53
bool use_IDs_
Keep track of peptide IDs and use them for matching?
Definition: QTCluster.h:115
bool changed_
Has the cluster changed (if yes, quality needs to be recomputed)?
Definition: QTCluster.h:112
Size num_maps_
Number of input maps.
Definition: QTCluster.h:106
bool isInvalid()
Definition: QTCluster.h:191
bool valid_
Definition: QTCluster.h:139
OpenMSBoost::unordered_map< Size, std::multimap< double, GridFeature * > > NeighborMap
Mapping: input map -> distance to center (ordered!) -> neighboring point.
Definition: QTCluster.h:90
double quality_
Quality of the cluster.
Definition: QTCluster.h:109
double max_distance_
Maximum distance of a point that can still belong to the cluster.
Definition: QTCluster.h:103

OpenMS / TOPP release 2.0.0 Documentation generated on Thu Aug 20 2015 01:44:28 using doxygen 1.8.9.1