Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
IsotopeDistribution.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-2015.
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: Clemens Groepl, Andreas Bertsch $
32 // $Authors: Clemens Groepl, Andreas Bertsch $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_CHEMISTRY_ISOTOPEDISTRIBUTION_H
36 #define OPENMS_CHEMISTRY_ISOTOPEDISTRIBUTION_H
37 
38 #include <OpenMS/CONCEPT/Types.h>
39 
40 #include <utility>
41 #include <vector>
42 
43 namespace OpenMS
44 {
61  class OPENMS_DLLAPI IsotopeDistribution
62  {
63 public:
64 
66 
67  typedef std::vector<std::pair<Size, double> > ContainerType;
69  typedef ContainerType::iterator iterator;
70  typedef ContainerType::iterator Iterator;
71  typedef ContainerType::const_iterator const_iterator;
72  typedef ContainerType::const_iterator ConstIterator;
74 
76 
77 
81 
83  explicit IsotopeDistribution(Size max_isotope);
84 
86  IsotopeDistribution(const IsotopeDistribution & isotope_distribution);
87 
89  virtual ~IsotopeDistribution();
91 
93 
94 
100  void setMaxIsotope(Size max_isotope);
101 
103  Size getMaxIsotope() const;
104 
106  void set(const ContainerType & distribution);
107 
109  const ContainerType & getContainer() const;
110 
112  Size getMax() const;
113 
115  Size getMin() const;
116 
118  Size size() const;
119 
121  void clear();
122 
129  void estimateFromPeptideWeight(double average_weight);
130 
136  void renormalize();
137 
146  void trimRight(double cutoff);
147 
156  void trimLeft(double cutoff);
158 
160 
161  IsotopeDistribution & operator=(const IsotopeDistribution & isotope_distribution);
163 
165  IsotopeDistribution operator+(const IsotopeDistribution & isotope_distribution) const;
166 
168  IsotopeDistribution & operator+=(const IsotopeDistribution & isotope_distribution);
169 
171  IsotopeDistribution operator*(Size factor) const;
172 
174  IsotopeDistribution & operator*=(Size factor);
175 
177  bool operator==(const IsotopeDistribution & isotope_distribution) const;
178 
180  bool operator!=(const IsotopeDistribution & isotope_distribution) const;
182 
184 
185  inline Iterator begin() { return distribution_.begin(); }
186 
187  inline Iterator end() { return distribution_.end(); }
188 
189  inline ConstIterator begin() const { return distribution_.begin(); }
190 
191  inline ConstIterator end() const { return distribution_.end(); }
193 
194 protected:
195 
197  void convolve_(ContainerType & result, const ContainerType & left, const ContainerType & right) const;
198 
200  void convolvePow_(ContainerType & result, const ContainerType & input, Size factor) const;
201 
203  void convolveSquare_(ContainerType & result, const ContainerType & input) const;
204 
207 
210  };
211 
212 } // namespace OpenMS
213 
214 #endif // OPENMS_CHEMISTRY_ISOTOPEDISTRIBUTION_H
ConstIterator end() const
Definition: IsotopeDistribution.h:191
ConstIterator begin() const
Definition: IsotopeDistribution.h:189
ContainerType::iterator Iterator
Definition: IsotopeDistribution.h:70
Iterator end()
Definition: IsotopeDistribution.h:187
Isotope distribution class.
Definition: IsotopeDistribution.h:61
ContainerType::iterator iterator
Definition: IsotopeDistribution.h:69
Size max_isotope_
maximal isotopes which is used to calculate the distribution
Definition: IsotopeDistribution.h:206
Iterator begin()
Definition: IsotopeDistribution.h:185
DPosition< D, TCoordinateType > operator*(DPosition< D, TCoordinateType > position, typename DPosition< D, TCoordinateType >::CoordinateType scalar)
Scalar multiplication (a bit inefficient)
Definition: DPosition.h:421
ContainerType::const_iterator const_iterator
Definition: IsotopeDistribution.h:71
ContainerType distribution_
stores the isotope distribution
Definition: IsotopeDistribution.h:209
std::vector< std::pair< Size, double > > ContainerType
container type, first holds the weight of the isotope, second the probability
Definition: IsotopeDistribution.h:68
ContainerType::const_iterator ConstIterator
Definition: IsotopeDistribution.h:72

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:39 using doxygen 1.8.5