Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
ConsensusFeature.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-2013.
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: Erhan Kenar $
32 // $Authors: $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_KERNEL_CONSENSUSFEATURE_H
36 #define OPENMS_KERNEL_CONSENSUSFEATURE_H
37 
42 
43 #include <set>
44 
45 namespace OpenMS
46 {
59  class OPENMS_DLLAPI ConsensusFeature :
60  public BaseFeature
61  {
62 public:
64 
65  typedef std::set<FeatureHandle, FeatureHandle::IndexLess> HandleSetType;
66  typedef HandleSetType::const_iterator const_iterator;
67  typedef HandleSetType::iterator iterator;
68  typedef HandleSetType::const_reverse_iterator const_reverse_iterator;
69  typedef HandleSetType::reverse_iterator reverse_iterator;
71 
73  struct SizeLess :
74  std::binary_function<ConsensusFeature, ConsensusFeature, bool>
75  {
76  inline bool operator()(ConsensusFeature const & left, ConsensusFeature const & right) const
77  {
78  return left.size() < right.size();
79  }
80 
81  inline bool operator()(ConsensusFeature const & left, UInt64 const & right) const
82  {
83  return left.size() < right;
84  }
85 
86  inline bool operator()(UInt64 const & left, ConsensusFeature const & right) const
87  {
88  return left < right.size();
89  }
90 
91  inline bool operator()(const UInt64 & left, const UInt64 & right) const
92  {
93  return left < right;
94  }
95 
96  };
97 
99  struct MapsLess :
100  std::binary_function<ConsensusFeature, ConsensusFeature, bool>
101  {
102  inline bool operator()(ConsensusFeature const & left, ConsensusFeature const & right) const
103  {
104  return std::lexicographical_compare(left.begin(), left.end(), right.begin(), right.end(), FeatureHandle::IndexLess());
105  }
106 
107  };
108 
110  struct Ratio
111  {
113  {
114  }
115 
116  Ratio(const Ratio & rhs)
117  {
118  ratio_value_ = rhs.ratio_value_;
119  denominator_ref_ = rhs.denominator_ref_;
120  numerator_ref_ = rhs.numerator_ref_;
121  description_ = rhs.description_;
122  }
123 
124  virtual ~Ratio()
125  {
126  }
127 
128  Ratio & operator=(const Ratio & rhs)
129  {
130  if (&rhs != this)
131  {
132  ratio_value_ = rhs.ratio_value_;
133  denominator_ref_ = rhs.denominator_ref_;
134  numerator_ref_ = rhs.numerator_ref_;
135  description_ = rhs.description_;
136  }
137  return *this;
138  }
139 
143  std::vector<String> description_;
144  //TODO ratio cv info
145  };
146 
148 
151 
153  ConsensusFeature(const ConsensusFeature & rhs);
154 
156  explicit ConsensusFeature(const BaseFeature & feature);
157 
164  ConsensusFeature(UInt64 map_index, const Peak2D & element, UInt64 element_index);
165 
172  ConsensusFeature(UInt64 map_index, const BaseFeature & element);
173 
175  ConsensusFeature & operator=(const ConsensusFeature & rhs);
176 
178  virtual ~ConsensusFeature();
180 
181 
183 
184 
188  void insert(const ConsensusFeature & cf);
189 
196  void insert(const FeatureHandle & handle);
197 
199  void insert(const HandleSetType & handle_set);
200 
207  void insert(UInt64 map_index, const Peak2D & element, UInt64 element_index);
208 
215  void insert(UInt64 map_index, const BaseFeature & element);
216 
218  const HandleSetType & getFeatures() const;
220 
222 
223  DRange<2> getPositionRange() const;
226  DRange<1> getIntensityRange() const;
227 
229 
239  void computeConsensus();
240 
250  void computeMonoisotopicConsensus();
251 
265  void computeDechargeConsensus(const FeatureMap<> & fm, bool intensity_weighted_averaging = false);
266 
274  void addRatio(const Ratio & r);
275 
283  void setRatios(std::vector<Ratio> & rs);
284 
288  std::vector<Ratio> getRatios() const;
289 
293  std::vector<Ratio> & getRatios();
294 
296 
297  Size size() const;
298 
299  const_iterator begin() const;
300 
301  iterator begin();
302 
303  const_iterator end() const;
304 
305  iterator end();
306 
307  const_reverse_iterator rbegin() const;
308 
309  reverse_iterator rbegin();
310 
311  const_reverse_iterator rend() const;
312 
313  reverse_iterator rend();
314 
315  void clear();
316 
317  bool empty() const;
319 
320  private:
322  std::vector<Ratio> ratios_;
323 
324  };
325 
327  OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const ConsensusFeature & cons);
328 
329 } // namespace OpenMS
330 
331 #endif // OPENMS_KERNEL_CONSENSUSFEATURE_H
virtual ~Ratio()
Definition: ConsensusFeature.h:124
A more convenient string class.
Definition: String.h:56
HandleSetType::const_reverse_iterator const_reverse_iterator
Definition: ConsensusFeature.h:68
A 2-dimensional raw data point or peak.
Definition: Peak2D.h:55
Compare by size(), the number of consensus elements.
Definition: ConsensusFeature.h:73
bool operator()(const UInt64 &left, const UInt64 &right) const
Definition: ConsensusFeature.h:91
const_iterator end() const
std::ostream & operator<<(std::ostream &os, const ItraqQuantifier::ItraqQuantifierStats &stats)
Compare by the sets of consensus elements (lexicographically)
Definition: ConsensusFeature.h:99
Comparator by map and unique id.
Definition: FeatureHandle.h:200
HandleSetType handles_
Definition: ConsensusFeature.h:321
A basic LC-MS feature.
Definition: BaseFeature.h:55
String numerator_ref_
Definition: ConsensusFeature.h:142
Ratio(const Ratio &rhs)
Definition: ConsensusFeature.h:116
std::vector< Ratio > ratios_
Definition: ConsensusFeature.h:322
const_iterator begin() const
std::set< FeatureHandle, FeatureHandle::IndexLess > HandleSetType
Type definitions.
Definition: ConsensusFeature.h:65
bool operator()(ConsensusFeature const &left, ConsensusFeature const &right) const
Definition: ConsensusFeature.h:102
slim struct to feed the need for systematically storing of ratios (
Definition: ConsensusFeature.h:110
Ratio & operator=(const Ratio &rhs)
Definition: ConsensusFeature.h:128
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:75
std::vector< String > description_
Definition: ConsensusFeature.h:143
bool operator()(UInt64 const &left, ConsensusFeature const &right) const
Definition: ConsensusFeature.h:86
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
bool operator()(ConsensusFeature const &left, ConsensusFeature const &right) const
Definition: ConsensusFeature.h:76
Representation of a Peak2D, RichPeak2D or Feature .
Definition: FeatureHandle.h:54
HandleSetType::iterator iterator
Definition: ConsensusFeature.h:67
HandleSetType::const_iterator const_iterator
Definition: ConsensusFeature.h:66
String denominator_ref_
Definition: ConsensusFeature.h:141
HandleSetType::reverse_iterator reverse_iterator
Definition: ConsensusFeature.h:69
DoubleReal ratio_value_
Definition: ConsensusFeature.h:140
Ratio()
Definition: ConsensusFeature.h:112
A 2-dimensional consensus feature.
Definition: ConsensusFeature.h:59
bool operator()(ConsensusFeature const &left, UInt64 const &right) const
Definition: ConsensusFeature.h:81

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:12 using doxygen 1.8.5