Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
QTClusterFinder.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-2017.
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 #ifndef OPENMS_ANALYSIS_MAPMATCHING_QTCLUSTERFINDER_H
36 #define OPENMS_ANALYSIS_MAPMATCHING_QTCLUSTERFINDER_H
37 
44 
45 #include <boost/unordered_map.hpp>
46 
47 #include <list>
48 #include <vector>
49 #include <set>
50 #include <utility> // for pair<>
51 
52 namespace OpenMS
53 {
54 
104  class OPENMS_DLLAPI QTClusterFinder :
105  public BaseGroupFinder
106  {
107 private:
108 
110  typedef OpenMSBoost::unordered_map<
111  std::pair<OpenMS::GridFeature*, OpenMS::GridFeature*>,
112  double> PairDistances;
113 
115  typedef OpenMSBoost::unordered_map<
116  OpenMS::GridFeature*, std::vector<QTCluster*> > ElementMapping;
117 
119 
122 
124  bool use_IDs_;
125 
127  double max_diff_rt_;
128 
130  double max_diff_mz_;
131 
134 
137 
139  std::set<OpenMS::GridFeature*> already_used_;
140 
144  double getDistance_(const OpenMS::GridFeature* left, const
145  OpenMS::GridFeature* right);
146 
148  void setParameters_(double max_intensity, double max_mz);
149 
151  void makeConsensusFeature_(std::list<QTCluster>& clustering,
152  ConsensusFeature& feature,
153  ElementMapping& element_mapping, Grid&);
154 
156  void computeClustering_(Grid& grid, std::list<QTCluster>& clustering);
157 
159  template <typename MapType>
160  void run_(const std::vector<MapType>& input_maps, ConsensusMap& result_map);
161 
163  template <typename MapType>
164  void run_internal_(const std::vector<MapType>& input_maps,
165  ConsensusMap& result_map, bool do_progress);
166 
168  void addClusterElements_(int x, int y, const Grid& grid, QTCluster& cluster,
169  const OpenMS::GridFeature* center_feature);
170 
171 protected:
172 
173  enum
174  {
177  };
178 
179 public:
180 
182  QTClusterFinder();
183 
185  virtual ~QTClusterFinder();
186 
188  static const String getProductName()
189  {
190  return "qt";
191  }
192 
200  void run(const std::vector<ConsensusMap>& input_maps,
201  ConsensusMap& result_map);
202 
210  void run(const std::vector<FeatureMap>& input_maps,
211  ConsensusMap& result_map);
212 
215  {
216  return new QTClusterFinder();
217  }
218  };
219 } // namespace OpenMS
220 
221 #endif /* OPENMS_ANALYSIS_MAPMATCHING_QTCLUSTERFINDER_H */
Container for (2-dimensional coordinate, value) pairs.
Definition: HashGrid.h:62
FeatureDistance feature_distance_
Feature distance functor.
Definition: QTClusterFinder.h:136
A functor class for the calculation of distances between features or consensus features.
Definition: FeatureDistance.h:90
A more convenient string class.
Definition: String.h:57
static BaseGroupFinder * create()
Returns an instance of this class.
Definition: QTClusterFinder.h:214
std::set< OpenMS::GridFeature * > already_used_
Set of features already used.
Definition: QTClusterFinder.h:139
A representation of a QT cluster used for feature grouping.
Definition: QTCluster.h:112
Retention time dimension id (0 if used as a const int)
Definition: Peak2D.h:76
bool use_IDs_
Consider peptide identifications for grouping?
Definition: QTClusterFinder.h:124
A container for consensus elements.
Definition: ConsensusMap.h:72
double max_diff_mz_
Maximum m/z difference.
Definition: QTClusterFinder.h:130
static const String getProductName()
Returns the name of the product.
Definition: QTClusterFinder.h:188
Mass-to-charge dimension id (1 if used as a const int)
Definition: Peak2D.h:77
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Size num_maps_
Number of input maps.
Definition: QTClusterFinder.h:121
HashGrid< OpenMS::GridFeature * > Grid
Definition: QTClusterFinder.h:118
double max_diff_rt_
Maximum RT difference.
Definition: QTClusterFinder.h:127
The base class of all element group finding algorithms.
Definition: BaseGroupFinder.h:62
OpenMSBoost::unordered_map< OpenMS::GridFeature *, std::vector< QTCluster * > > ElementMapping
Map to store which grid features are next to which clusters.
Definition: QTClusterFinder.h:116
Representation of a feature in a hash grid.
Definition: GridFeature.h:53
int nr_partitions_
Maximum m/z difference.
Definition: QTClusterFinder.h:133
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
OpenMSBoost::unordered_map< std::pair< OpenMS::GridFeature *, OpenMS::GridFeature * >, double > PairDistances
Distances between pairs of grid features.
Definition: QTClusterFinder.h:112
A variant of QT clustering for the detection of feature groups.
Definition: QTClusterFinder.h:104
A 2-dimensional consensus feature.
Definition: ConsensusFeature.h:65

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:03 using doxygen 1.8.13