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-2017.
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: Chris Bielow $
32 // $Authors: Clemens Groepl, Andreas Bertsch, Chris Bielow $
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 #include <set>
43 
44 namespace OpenMS
45 {
62  class OPENMS_DLLAPI IsotopeDistribution
63  {
64 public:
65 
67 
68  typedef std::vector<std::pair<Size, double> > ContainerType;
70  typedef ContainerType::iterator iterator;
71  typedef ContainerType::iterator Iterator;
72  typedef ContainerType::const_iterator const_iterator;
73  typedef ContainerType::const_iterator ConstIterator;
74 
75  typedef ContainerType::reverse_iterator reverse_iterator;
76  typedef ContainerType::reverse_iterator ReverseIterator;
77  typedef ContainerType::const_reverse_iterator const_reverse_iterator;
78  typedef ContainerType::const_reverse_iterator ConstReverseIterator;
80 
82 
83 
87 
89  explicit IsotopeDistribution(Size max_isotope);
90 
92  IsotopeDistribution(const IsotopeDistribution & isotope_distribution);
93 
95  virtual ~IsotopeDistribution();
97 
99 
100 
106  void setMaxIsotope(Size max_isotope);
107 
109  Size getMaxIsotope() const;
110 
112  void set(const ContainerType & distribution);
113 
115  const ContainerType & getContainer() const;
116 
118  Size getMax() const;
119 
121  Size getMin() const;
122 
124  Size size() const;
125 
127  void clear();
128 
135  void estimateFromPeptideWeight(double average_weight);
136 
146  void estimateFromPeptideWeightAndS(double average_weight, UInt S);
147 
154  void estimateFromRNAWeight(double average_weight);
155 
161  void estimateFromDNAWeight(double average_weight);
162 
168  void estimateFromWeightAndComp(double average_weight, double C, double H, double N, double O, double S, double P);
169 
184  void estimateFromWeightAndCompAndS(double average_weight, UInt S, double C, double H, double N, double O, double P);
185 
200  void estimateForFragmentFromPeptideWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
201 
221  void estimateForFragmentFromPeptideWeightAndS(double average_weight_precursor, UInt S_precursor, double average_weight_fragment, UInt S_fragment, const std::set<UInt>& precursor_isotopes);
222 
237  void estimateForFragmentFromRNAWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
238 
253  void estimateForFragmentFromDNAWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
254 
276  void estimateForFragmentFromWeightAndComp(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes, double C, double H, double N, double O, double S, double P);
277 
291  void calcFragmentIsotopeDist(const IsotopeDistribution& fragment_isotope_dist, const IsotopeDistribution& comp_fragment_isotope_dist, const std::set<UInt>& precursor_isotopes);
292 
298  void renormalize();
299 
308  void trimRight(double cutoff);
309 
318  void trimLeft(double cutoff);
320 
322 
323  IsotopeDistribution & operator=(const IsotopeDistribution & isotope_distribution);
325 
327  IsotopeDistribution operator+(const IsotopeDistribution & isotope_distribution) const;
328 
330  IsotopeDistribution & operator+=(const IsotopeDistribution & isotope_distribution);
331 
333  IsotopeDistribution operator*(Size factor) const;
334 
336  IsotopeDistribution & operator*=(Size factor);
337 
339  bool operator==(const IsotopeDistribution & isotope_distribution) const;
340 
342  bool operator!=(const IsotopeDistribution & isotope_distribution) const;
344 
346 
347  inline Iterator begin() { return distribution_.begin(); }
348 
349  inline Iterator end() { return distribution_.end(); }
350 
351  inline ConstIterator begin() const { return distribution_.begin(); }
352 
353  inline ConstIterator end() const { return distribution_.end(); }
354 
355  inline ReverseIterator rbegin() { return distribution_.rbegin(); }
356 
357  inline ReverseIterator rend() { return distribution_.rend(); }
358 
359  inline ConstReverseIterator rbegin() const { return distribution_.rbegin(); }
360 
361  inline ConstReverseIterator rend() const { return distribution_.rend(); }
363 
364 protected:
365 
367  void convolve_(ContainerType & result, const ContainerType & left, const ContainerType & right) const;
368 
370  void convolvePow_(ContainerType & result, const ContainerType & input, Size factor) const;
371 
373  void convolveSquare_(ContainerType & result, const ContainerType & input) const;
374 
381  void calcFragmentIsotopeDist_(ContainerType& result, const ContainerType& fragment_isotope_dist, const ContainerType& comp_fragment_isotope_dist, const std::set<UInt>& precursor_isotopes);
382 
384  ContainerType fillGaps_(const ContainerType& id) const;
385 
388 
390  ContainerType distribution_;
391  };
392 
393 } // namespace OpenMS
394 
395 #endif // OPENMS_CHEMISTRY_ISOTOPEDISTRIBUTION_H
ContainerType::iterator Iterator
Definition: IsotopeDistribution.h:71
ContainerType::reverse_iterator reverse_iterator
Definition: IsotopeDistribution.h:75
ReverseIterator rbegin()
Definition: IsotopeDistribution.h:355
Iterator end()
Definition: IsotopeDistribution.h:349
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
Isotope distribution class.
Definition: IsotopeDistribution.h:62
ContainerType::iterator iterator
Definition: IsotopeDistribution.h:70
Size max_isotope_
maximal isotopes which is used to calculate the distribution
Definition: IsotopeDistribution.h:387
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
ReverseIterator rend()
Definition: IsotopeDistribution.h:357
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
ContainerType::reverse_iterator ReverseIterator
Definition: IsotopeDistribution.h:76
ContainerType::const_reverse_iterator const_reverse_iterator
Definition: IsotopeDistribution.h:77
Iterator begin()
Definition: IsotopeDistribution.h:347
ConstReverseIterator rbegin() const
Definition: IsotopeDistribution.h:359
DPosition< D, TCoordinateType > operator*(DPosition< D, TCoordinateType > position, typename DPosition< D, TCoordinateType >::CoordinateType scalar)
Scalar multiplication (a bit inefficient)
Definition: DPosition.h:421
ConstReverseIterator rend() const
Definition: IsotopeDistribution.h:361
ContainerType::const_iterator const_iterator
Definition: IsotopeDistribution.h:72
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
ConstIterator begin() const
Definition: IsotopeDistribution.h:351
ContainerType distribution_
stores the isotope distribution
Definition: IsotopeDistribution.h:390
ConstIterator end() const
Definition: IsotopeDistribution.h:353
std::vector< std::pair< Size, double > > ContainerType
container type, first holds the weight of the isotope, second the probability
Definition: IsotopeDistribution.h:69
ContainerType::const_iterator ConstIterator
Definition: IsotopeDistribution.h:73
ContainerType::const_reverse_iterator ConstReverseIterator
Definition: IsotopeDistribution.h:78

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:01 using doxygen 1.8.13