Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
FeatureDistance.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: Clemens Groepl, Hendrik Weisser, Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_MAPMATCHING_FEATUREDISTANCE_H
36 #define OPENMS_ANALYSIS_MAPMATCHING_FEATUREDISTANCE_H
37 
40 
41 #include <limits>
42 
43 namespace OpenMS
44 {
90  class OPENMS_DLLAPI FeatureDistance :
91  public DefaultParamHandler
92  {
93 public:
95  static const double infinity;
96 
103  FeatureDistance(double max_intensity = 1.0,
104  bool force_constraints = false);
105 
107  virtual ~FeatureDistance();
108 
110  FeatureDistance & operator=(const FeatureDistance & other);
111 
119  std::pair<bool, double> operator()(const BaseFeature & left,
120  const BaseFeature & right);
121 
122 protected:
123 
126  {
128 
129  DistanceParams_(const String & what, const Param & global)
130  {
131  Param param = global.copy("distance_" + what + ":", true);
132  if (what == "MZ")
133  {
134  max_diff_ppm = (param.getValue("unit") == "ppm");
135  }
136  else
137  {
138  max_diff_ppm = false;
139  }
140 
141  max_difference = param.getValue("max_difference");
142  exponent = param.getValue("exponent");
143  weight = param.getValue("weight");
144  norm_factor = 1 / max_difference;
145 
146  relevant = (weight != 0.0) && (exponent != 0.0);
147  if (!relevant)
148  {
149  weight = 0.0;
150  }
151  }
152 
153  double max_difference, exponent, weight, norm_factor;
154  bool max_diff_ppm, relevant;
155  };
156 
158  void updateMembers_();
159 
161  inline double distance_(double diff, const DistanceParams_ & params) const;
162 
164  DistanceParams_ params_rt_, params_mz_, params_intensity_;
165 
168 
171 
174 
177 
180  };
181 
182 } // namespace OpenMS
183 
184 #endif // OPENMS_ANALYSIS_MAPMATCHING_FEATUREDISTANCE_H
A functor class for the calculation of distances between features or consensus features.
Definition: FeatureDistance.h:90
Structure for storing distance parameters.
Definition: FeatureDistance.h:125
A more convenient string class.
Definition: String.h:57
double weight
Definition: FeatureDistance.h:153
DistanceParams_()
Definition: FeatureDistance.h:127
double max_intensity_
Maximum intensity of features (for normalization)
Definition: FeatureDistance.h:170
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
A basic LC-MS feature.
Definition: BaseFeature.h:56
DistanceParams_(const String &what, const Param &global)
Definition: FeatureDistance.h:129
double total_weight_reciprocal_
Reciprocal value of the total weight in the distance function.
Definition: FeatureDistance.h:167
const DataValue & getValue(const String &key) const
Returns a value of a parameter.
Param copy(const String &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
DistanceParams_ params_rt_
Storage of parameters for the individual distance components.
Definition: FeatureDistance.h:164
static const double infinity
Value to return if max. difference is exceeded or if charge states don&#39;t match.
Definition: FeatureDistance.h:95
Management and storage of parameters / INI files.
Definition: Param.h:75
bool force_constraints_
Always return infinity if "max. difference" constraints are not met?
Definition: FeatureDistance.h:176
bool ignore_charge_
Compute a distance even if charge states don&#39;t match?
Definition: FeatureDistance.h:173
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
bool log_transform_
Log-transform intensities when computing intensity distance?
Definition: FeatureDistance.h:179
bool relevant
Definition: FeatureDistance.h:154

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