| OpenMS 2.5.0

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-2020.
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
37 #include <OpenMS/KERNEL/StandardTypes.h>
38 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
39 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/FeatureFinder.h>
40 #include <OpenMS/KERNEL/MSExperiment.h>
41 #include <OpenMS/KERNEL/FeatureMap.h>
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;
54 UInt no_exceptions;
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
74 class FeatureFinderAlgorithm :
75 public DefaultParamHandler
76 {
77 public:
79 typedef PeakMap MapType;
81 typedef MapType::CoordinateType CoordinateType;
83 typedef MapType::IntensityType IntensityType;
84
86 FeatureFinderAlgorithm() :
87 DefaultParamHandler("FeatureFinderAlgorithm"),
88 map_(nullptr),
89 features_(nullptr),
90 ff_(nullptr)
91 {
92 }
93
95 ~FeatureFinderAlgorithm() override
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.size() != 0)
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
142 FeatureMap* features_;
143
145 FeatureFinder* ff_;
146
147 private:
148
150 FeatureFinderAlgorithm& operator=(const FeatureFinderAlgorithm&);
151
153 FeatureFinderAlgorithm(const FeatureFinderAlgorithm&);
154
155 };
156 }
157
OpenMS::DefaultParamHandler::defaults_
Param defaults_
Container for default parameters. This member should be filled in the constructor of derived classes!...
Definition: DefaultParamHandler.h:156
OpenMS::Summary::mz_model
std::map< String, UInt > mz_model
count used mz models
Definition: FeatureFinderAlgorithm.h:55
OpenMS::FeatureFinderAlgorithm::getDefaultParameters
virtual Param getDefaultParameters() const
Returns the default parameters. Reimplement.
Definition: FeatureFinderAlgorithm.h:110
OpenMS::FeatureFinderAlgorithm::IntensityType
MapType::IntensityType IntensityType
Intensity type of peaks.
Definition: FeatureFinderAlgorithm.h:83
OpenMS::FeatureFinderAlgorithm
Abstract base class for FeatureFinder algorithms.
Definition: FeatureFinderAlgorithm.h:74
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
OpenMS::FeatureFinderAlgorithm::MapType
PeakMap MapType
Input map type.
Definition: FeatureFinderAlgorithm.h:79
OpenMS::FeatureFinderAlgorithm::setSeeds
virtual void setSeeds(const FeatureMap &seeds)
Sets a reference to the calling FeatureFinder.
Definition: FeatureFinderAlgorithm.h:128
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::Summary::no_exceptions
UInt no_exceptions
Definition: FeatureFinderAlgorithm.h:54
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:95
OpenMS::Summary
Summary of fitting results.
Definition: FeatureFinderAlgorithm.h:51
StandardTypes.h
OpenMS::FeatureFinderAlgorithm::ff_
FeatureFinder * ff_
Pointer to the calling FeatureFinder that is used to access the feature flags.
Definition: FeatureFinderAlgorithm.h:145
OpenMS::Summary::charge
std::vector< UInt > charge
count used charges
Definition: FeatureFinderAlgorithm.h:57
FeatureFinder.h
FeatureMap.h
OpenMS::FeatureFinderAlgorithm::CoordinateType
MapType::CoordinateType CoordinateType
Coordinate/Position type of peaks.
Definition: FeatureFinderAlgorithm.h:81
OpenMS::Summary::corr_min
double corr_min
Definition: FeatureFinderAlgorithm.h:58
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
MSExperiment.h
OpenMS::FeatureFinderAlgorithm::map_
const MapType * map_
Input data pointer.
Definition: FeatureFinderAlgorithm.h:139
OpenMS::FeatureFinderAlgorithm::run
virtual void run()=0
Main method that implements the actual algorithm.
OpenMS::Summary::exception
std::map< String, UInt > exception
count exceptions
Definition: FeatureFinderAlgorithm.h:53
OpenMS::FeatureFinderAlgorithm::~FeatureFinderAlgorithm
~FeatureFinderAlgorithm() override
destructor
Definition: FeatureFinderAlgorithm.h:95
DefaultParamHandler.h
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::FeatureFinderAlgorithm::FeatureFinderAlgorithm
FeatureFinderAlgorithm()
default constructor
Definition: FeatureFinderAlgorithm.h:86
OpenMS::Exception::IllegalArgument
A method or algorithm argument contains illegal values.
Definition: Exception.h:648
double
float
OpenMS::Summary::mz_stdev
std::map< float, UInt > mz_stdev
count used mz standard deviations
Definition: FeatureFinderAlgorithm.h:56
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:73
OpenMS::FeatureFinderAlgorithm::features_
FeatureMap * features_
Output data pointer.
Definition: FeatureFinderAlgorithm.h:142
OpenMS::FeatureFinderAlgorithm::registerChildren
static void registerChildren()
register all derived classes here (see FeatureFinderAlgorithm_impl.h)
OpenMS::FeatureFinderAlgorithm::setData
void setData(const MapType &map, FeatureMap &features, FeatureFinder &ff)
Sets a reference to the calling FeatureFinder.
Definition: FeatureFinderAlgorithm.h:116
OpenMS::FeatureFinderAlgorithm::operator=
FeatureFinderAlgorithm & operator=(const FeatureFinderAlgorithm &)
Not implemented.
OpenMS::FeatureFinder
The main feature finder class.
Definition: FeatureFinder.h:56
OpenMS::Summary::Summary
Summary()
Initial values.
Definition: FeatureFinderAlgorithm.h:61