| OpenMS 2.5.0

BaseFeature.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: Hendrik Weisser $
32 // $Authors: Hendrik Weisser, Chris Bielow $
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 #include <OpenMS/KERNEL/RichPeak2D.h>
38 #include <OpenMS/METADATA/PeptideIdentification.h>
39
40 namespace OpenMS
41 {
42
43 class PeptideIdentification;
44
56 class OPENMS_DLLAPI BaseFeature :
57 public RichPeak2D
58 {
59 public:
61
62 typedef float QualityType;
65 typedef Int ChargeType;
67 typedef float WidthType;
68
70 enum AnnotationState
71 {
72 FEATURE_ID_NONE,
73 FEATURE_ID_SINGLE,
74 FEATURE_ID_MULTIPLE_SAME,
75 FEATURE_ID_MULTIPLE_DIVERGENT,
76 SIZE_OF_ANNOTATIONSTATE
77 };
78
79 static const std::string NamesOfAnnotationState[SIZE_OF_ANNOTATIONSTATE];
80
82
86 BaseFeature();
88
90 BaseFeature(const BaseFeature& feature) = default;
91
93 BaseFeature(BaseFeature&& feature) = default;
94
96 BaseFeature(const BaseFeature& rhs, UInt64 map_index);
97
99 explicit BaseFeature(const Peak2D& point);
100
102 explicit BaseFeature(const RichPeak2D& point);
103
105 ~BaseFeature() override;
107
109
110 QualityType getQuality() const;
113 void setQuality(QualityType q);
115 struct QualityLess :
116 std::binary_function<BaseFeature, BaseFeature, bool>
117 {
118 bool operator()(const BaseFeature& left, const BaseFeature& right) const
119 {
120 return left.getQuality() < right.getQuality();
121 }
122
123 bool operator()(const BaseFeature& left, const QualityType& right) const
124 {
125 return left.getQuality() < right;
126 }
127
128 bool operator()(const QualityType& left, const BaseFeature& right) const
129 {
130 return left < right.getQuality();
131 }
132
133 bool operator()(const QualityType& left, const QualityType& right) const
134 {
135 return left < right;
136 }
137
138 };
140
142 WidthType getWidth() const;
144 void setWidth(WidthType fwhm);
145
147 const ChargeType& getCharge() const;
148
150 void setCharge(const ChargeType& ch);
151
153 BaseFeature& operator=(const BaseFeature& rhs) = default;
154
156 BaseFeature& operator=(BaseFeature&& rhs) & = default;
157
159 bool operator==(const BaseFeature& rhs) const;
160
162 bool operator!=(const BaseFeature& rhs) const;
163
165 const std::vector<PeptideIdentification>& getPeptideIdentifications() const;
166
168 std::vector<PeptideIdentification>& getPeptideIdentifications();
169
171 void setPeptideIdentifications(const std::vector<PeptideIdentification>& peptides);
172
174 AnnotationState getAnnotationState() const;
175
176 protected:
177
179 QualityType quality_;
180
182 ChargeType charge_;
183
185 WidthType width_;
186
188 std::vector<PeptideIdentification> peptides_;
189 };
190
191 } // namespace OpenMS
192
OpenMS::BaseFeature::QualityLess::operator()
bool operator()(const QualityType &left, const QualityType &right) const
Definition: BaseFeature.h:133
OpenMS::BaseFeature::FEATURE_ID_MULTIPLE_SAME
Definition: BaseFeature.h:74
OpenMS::Peak2D
A 2-dimensional raw data point or peak.
Definition: Peak2D.h:54
OpenMS::UInt64
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:77
OpenMS::BaseFeature::getQuality
QualityType getQuality() const
Non-mutable access to the overall quality.
OpenMS::BaseFeature::QualityLess::operator()
bool operator()(const BaseFeature &left, const QualityType &right) const
Definition: BaseFeature.h:123
OpenMS::BaseFeature::QualityLess::operator()
bool operator()(const QualityType &left, const BaseFeature &right) const
Definition: BaseFeature.h:128
OpenMS::BaseFeature::width_
WidthType width_
Width (FWHM) for the feature. The default value is 0.0, a feature finding algorithm can compute this ...
Definition: BaseFeature.h:185
KDTree::operator!=
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
OpenMS::RichPeak2D
A 2-dimensional raw data point or peak with meta information.
Definition: RichPeak2D.h:52
OpenMS::BaseFeature::FEATURE_ID_MULTIPLE_DIVERGENT
Definition: BaseFeature.h:75
OpenMS::BaseFeature::FEATURE_ID_SINGLE
Definition: BaseFeature.h:73
RichPeak2D.h
PeptideIdentification.h
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::BaseFeature::FEATURE_ID_NONE
Definition: BaseFeature.h:72
OpenMS::BaseFeature::charge_
ChargeType charge_
Charge of the peptide represented by this feature. The default value is 0, which represents an unknow...
Definition: BaseFeature.h:182
float
int
OpenMS::BaseFeature::ChargeType
Int ChargeType
Type of charge values.
Definition: BaseFeature.h:65
OpenMS::BaseFeature::peptides_
std::vector< PeptideIdentification > peptides_
Peptide PeptideIdentifications belonging to the feature.
Definition: BaseFeature.h:188
OpenMS::BaseFeature::WidthType
float WidthType
Type of feature width/FWHM (RT)
Definition: BaseFeature.h:67
OpenMS::BaseFeature::QualityLess
Compare by quality.
Definition: BaseFeature.h:115
OpenMS::BaseFeature::quality_
QualityType quality_
Overall quality measure of the feature.
Definition: BaseFeature.h:179
OpenMS::BaseFeature::QualityLess::operator()
bool operator()(const BaseFeature &left, const BaseFeature &right) const
Definition: BaseFeature.h:118
OpenMS::BaseFeature::AnnotationState
AnnotationState
state of identification, use getIDState() to query it
Definition: BaseFeature.h:70
KDTree::operator==
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
OpenMS::BaseFeature
A basic LC-MS feature.
Definition: BaseFeature.h:56