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-2013.
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 
41 #include <boost/unordered_map.hpp>
42 
43 namespace OpenMS
44 {
45 
46  // Boost switch since with 1.47 several classes got moved into a new
47  // boost::unordered namespace (specifically unordered_map).
48  namespace OpenMSBoost
49  {
50 #if OPENMS_BOOST_VERSION_MINOR > 47
51  using namespace boost::unordered;
52 #else
53  using namespace boost;
54 #endif
55  }
56 
57 
77  class OPENMS_DLLAPI QTCluster
78  {
79 private:
80 
85  typedef OpenMSBoost::unordered_map<Size, std::multimap<DoubleReal, GridFeature *> > NeighborMap;
86 
89 
96 
99 
102 
105 
107  bool changed_;
108 
110  bool use_IDs_;
111 
117  std::set<AASequence> annotations_;
118 
120  QTCluster();
121 
123  void computeQuality_();
124 
132  DoubleReal optimizeAnnotations_();
133 
134  bool valid_;
135 public:
143  QTCluster(GridFeature * center_point, Size num_maps,
144  DoubleReal max_distance, bool use_IDs);
145 
147  virtual ~QTCluster();
148 
150  DoubleReal getCenterRT() const;
151 
153  DoubleReal getCenterMZ() const;
154 
156  Size size() const;
157 
159  bool operator<(QTCluster & cluster);
160 
167  void add(GridFeature * element, DoubleReal distance);
168 
170  void getElements(OpenMSBoost::unordered_map<Size, GridFeature *> & elements);
171 
176  bool update(const OpenMSBoost::unordered_map<Size, GridFeature *> & removed);
177 
179  DoubleReal getQuality();
180 
182  const std::set<AASequence> & getAnnotations();
183 
184  inline void setInvalid() {valid_ = false;}
185 
186  inline bool isInvalid() {return !valid_;}
187 
188  NeighborMap getNeighbors() {return neighbors_;}
189 
190  };
191 }
192 
193 #endif // OPENMS_DATASTRUCTURES_QTCLUSTER_H
std::set< AASequence > annotations_
Set of annotations of the cluster.
Definition: QTCluster.h:117
DoubleReal max_distance_
Maximum distance of a point that can still belong to the cluster.
Definition: QTCluster.h:98
void setInvalid()
Definition: QTCluster.h:184
A representation of a QT cluster used for feature grouping.
Definition: QTCluster.h:77
NeighborMap neighbors_
Neighbors of the cluster center, sorted by distance, for different input maps.
Definition: QTCluster.h:95
DoubleReal quality_
Quality of the cluster.
Definition: QTCluster.h:104
NeighborMap getNeighbors()
Definition: QTCluster.h:188
OpenMSBoost::unordered_map< Size, std::multimap< DoubleReal, GridFeature * > > NeighborMap
Mapping: input map -&gt; distance to center (ordered!) -&gt; neighboring point.
Definition: QTCluster.h:85
GridFeature * center_point_
Pointer to the cluster center.
Definition: QTCluster.h:88
Representation of a feature in a hash grid.
Definition: GridFeature.h:50
bool use_IDs_
Keep track of peptide IDs and use them for matching?
Definition: QTCluster.h:110
bool changed_
Has the cluster changed (if yes, quality needs to be recomputed)?
Definition: QTCluster.h:107
Size num_maps_
Number of input maps.
Definition: QTCluster.h:101
bool isInvalid()
Definition: QTCluster.h:186
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
bool valid_
Definition: QTCluster.h:134

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:20 using doxygen 1.8.5