OpenMS
FeatureFinderAlgorithm.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-2023.
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: Timo Sachsenberg $
32 // $Authors: $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
42 
43 namespace OpenMS
44 {
45 
46  // forward declaration
47  class FeatureFinder;
48  class FeatureMap;
49 
51  struct OPENMS_DLLAPI Summary
52  {
53  std::map<String, UInt> exception;
55  std::map<String, UInt> mz_model;
56  std::map<float, UInt> mz_stdev;
57  std::vector<UInt> charge;
58  double corr_mean, corr_max, corr_min; //boxplot for correlation
59 
61  Summary() :
62  no_exceptions(0),
63  corr_mean(0),
64  corr_max(0),
65  corr_min(1)
66  {}
67 
68  };
69 
75  public DefaultParamHandler
76  {
77 public:
79  typedef PeakMap MapType;
84 
87  DefaultParamHandler("FeatureFinderAlgorithm"),
88  map_(nullptr),
89  features_(nullptr),
90  ff_(nullptr)
91  {
92  }
93 
96  {
97  }
98 
100  static void registerChildren();
101 
103  virtual void run() = 0;
104 
110  virtual Param getDefaultParameters() const
111  {
112  return this->defaults_;
113  }
114 
116  void setData(const MapType& map, FeatureMap& features, FeatureFinder& ff)
117  {
118  map_ = &map;
119  features_ = &features;
120  ff_ = &ff;
121  }
122 
128  virtual void setSeeds(const FeatureMap& seeds)
129  {
130  if (!seeds.empty())
131  {
132  throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "The used feature detection algorithm does not support user-specified seed lists!");
133  }
134  }
135 
136 protected:
137 
139  const MapType* map_;
140 
143 
146 
147 private:
148 
151 
154 
155  };
156 }
157 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Param defaults_
Container for default parameters. This member should be filled in the constructor of derived classes!
Definition: DefaultParamHandler.h:172
A method or algorithm argument contains illegal values.
Definition: Exception.h:650
bool empty() const noexcept
Definition: ExposedVector.h:159
Abstract base class for FeatureFinder algorithms.
Definition: FeatureFinderAlgorithm.h:76
virtual void run()=0
Main method that implements the actual algorithm.
virtual void setSeeds(const FeatureMap &seeds)
Sets a reference to the calling FeatureFinder.
Definition: FeatureFinderAlgorithm.h:128
const MapType * map_
Input data pointer.
Definition: FeatureFinderAlgorithm.h:139
void setData(const MapType &map, FeatureMap &features, FeatureFinder &ff)
Sets a reference to the calling FeatureFinder.
Definition: FeatureFinderAlgorithm.h:116
~FeatureFinderAlgorithm() override
destructor
Definition: FeatureFinderAlgorithm.h:95
static void registerChildren()
register all derived classes here (see FeatureFinderAlgorithm_impl.h)
FeatureFinderAlgorithm(const FeatureFinderAlgorithm &)
Not implemented.
PeakMap MapType
Input map type.
Definition: FeatureFinderAlgorithm.h:79
FeatureFinderAlgorithm()
default constructor
Definition: FeatureFinderAlgorithm.h:86
FeatureFinderAlgorithm & operator=(const FeatureFinderAlgorithm &)
Not implemented.
virtual Param getDefaultParameters() const
Returns the default parameters. Reimplement.
Definition: FeatureFinderAlgorithm.h:110
FeatureMap * features_
Output data pointer.
Definition: FeatureFinderAlgorithm.h:142
MapType::IntensityType IntensityType
Intensity type of peaks.
Definition: FeatureFinderAlgorithm.h:83
FeatureFinder * ff_
Pointer to the calling FeatureFinder that is used to access the feature flags.
Definition: FeatureFinderAlgorithm.h:145
MapType::CoordinateType CoordinateType
Coordinate/Position type of peaks.
Definition: FeatureFinderAlgorithm.h:81
The main feature finder class.
Definition: FeatureFinder.h:59
A container for features.
Definition: FeatureMap.h:106
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:72
PeakType::CoordinateType CoordinateType
Coordinate type of peak positions.
Definition: MSExperiment.h:85
PeakType::IntensityType IntensityType
Intensity type of peaks.
Definition: MSExperiment.h:87
Management and storage of parameters / INI files.
Definition: Param.h:70
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
Summary of fitting results.
Definition: FeatureFinderAlgorithm.h:52
std::map< String, UInt > exception
count exceptions
Definition: FeatureFinderAlgorithm.h:53
std::map< float, UInt > mz_stdev
count used mz standard deviations
Definition: FeatureFinderAlgorithm.h:56
double corr_max
Definition: FeatureFinderAlgorithm.h:58
std::vector< UInt > charge
count used charges
Definition: FeatureFinderAlgorithm.h:57
std::map< String, UInt > mz_model
count used mz models
Definition: FeatureFinderAlgorithm.h:55
UInt no_exceptions
Definition: FeatureFinderAlgorithm.h:54
Summary()
Initial values.
Definition: FeatureFinderAlgorithm.h:61