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 #pragma once
36 
37 #include <OpenMS/CONCEPT/Types.h>
38 
39 #include <utility>
40 #include <vector>
41 #include <set>
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;
73 
74  typedef ContainerType::reverse_iterator reverse_iterator;
75  typedef ContainerType::reverse_iterator ReverseIterator;
76  typedef ContainerType::const_reverse_iterator const_reverse_iterator;
77  typedef ContainerType::const_reverse_iterator ConstReverseIterator;
79 
81 
82 
86 
88  explicit IsotopeDistribution(Size max_isotope);
89 
91  IsotopeDistribution(const IsotopeDistribution & isotope_distribution);
92 
94  virtual ~IsotopeDistribution();
96 
98 
99 
105  void setMaxIsotope(Size max_isotope);
106 
108  Size getMaxIsotope() const;
109 
111  void set(const ContainerType & distribution);
112 
114  const ContainerType & getContainer() const;
115 
117  Size getMax() const;
118 
120  Size getMin() const;
121 
123  Size size() const;
124 
126  void clear();
127 
134  void estimateFromPeptideWeight(double average_weight);
135 
145  void estimateFromPeptideWeightAndS(double average_weight, UInt S);
146 
153  void estimateFromRNAWeight(double average_weight);
154 
160  void estimateFromDNAWeight(double average_weight);
161 
167  void estimateFromWeightAndComp(double average_weight, double C, double H, double N, double O, double S, double P);
168 
183  void estimateFromWeightAndCompAndS(double average_weight, UInt S, double C, double H, double N, double O, double P);
184 
199  void estimateForFragmentFromPeptideWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
200 
220  void estimateForFragmentFromPeptideWeightAndS(double average_weight_precursor, UInt S_precursor, double average_weight_fragment, UInt S_fragment, const std::set<UInt>& precursor_isotopes);
221 
236  void estimateForFragmentFromRNAWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
237 
252  void estimateForFragmentFromDNAWeight(double average_weight_precursor, double average_weight_fragment, const std::set<UInt>& precursor_isotopes);
253 
275  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);
276 
290  void calcFragmentIsotopeDist(const IsotopeDistribution& fragment_isotope_dist, const IsotopeDistribution& comp_fragment_isotope_dist, const std::set<UInt>& precursor_isotopes);
291 
297  void renormalize();
298 
307  void trimRight(double cutoff);
308 
317  void trimLeft(double cutoff);
319 
321 
322  IsotopeDistribution & operator=(const IsotopeDistribution & isotope_distribution);
324 
326  IsotopeDistribution operator+(const IsotopeDistribution & isotope_distribution) const;
327 
329  IsotopeDistribution & operator+=(const IsotopeDistribution & isotope_distribution);
330 
332  IsotopeDistribution operator*(Size factor) const;
333 
335  IsotopeDistribution & operator*=(Size factor);
336 
338  bool operator==(const IsotopeDistribution & isotope_distribution) const;
339 
341  bool operator!=(const IsotopeDistribution & isotope_distribution) const;
343 
345 
346  inline Iterator begin() { return distribution_.begin(); }
347 
348  inline Iterator end() { return distribution_.end(); }
349 
350  inline ConstIterator begin() const { return distribution_.begin(); }
351 
352  inline ConstIterator end() const { return distribution_.end(); }
353 
354  inline ReverseIterator rbegin() { return distribution_.rbegin(); }
355 
356  inline ReverseIterator rend() { return distribution_.rend(); }
357 
358  inline ConstReverseIterator rbegin() const { return distribution_.rbegin(); }
359 
360  inline ConstReverseIterator rend() const { return distribution_.rend(); }
362 
363 protected:
364 
366  void convolve_(ContainerType & result, const ContainerType & left, const ContainerType & right) const;
367 
369  void convolvePow_(ContainerType & result, const ContainerType & input, Size factor) const;
370 
372  void convolveSquare_(ContainerType & result, const ContainerType & input) const;
373 
380  void calcFragmentIsotopeDist_(ContainerType& result, const ContainerType& fragment_isotope_dist, const ContainerType& comp_fragment_isotope_dist, const std::set<UInt>& precursor_isotopes);
381 
383  ContainerType fillGaps_(const ContainerType& id) const;
384 
387 
390  };
391 
392 } // namespace OpenMS
393 
ContainerType::iterator Iterator
Definition: IsotopeDistribution.h:70
ContainerType::reverse_iterator reverse_iterator
Definition: IsotopeDistribution.h:74
ReverseIterator rbegin()
Definition: IsotopeDistribution.h:354
Iterator end()
Definition: IsotopeDistribution.h:348
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
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:386
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
ReverseIterator rend()
Definition: IsotopeDistribution.h:356
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
ContainerType::reverse_iterator ReverseIterator
Definition: IsotopeDistribution.h:75
ContainerType::const_reverse_iterator const_reverse_iterator
Definition: IsotopeDistribution.h:76
Iterator begin()
Definition: IsotopeDistribution.h:346
ConstReverseIterator rbegin() const
Definition: IsotopeDistribution.h:358
DPosition< D, TCoordinateType > operator*(DPosition< D, TCoordinateType > position, typename DPosition< D, TCoordinateType >::CoordinateType scalar)
Scalar multiplication (a bit inefficient)
Definition: DPosition.h:420
ConstReverseIterator rend() const
Definition: IsotopeDistribution.h:360
ContainerType::const_iterator const_iterator
Definition: IsotopeDistribution.h:71
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:127
ConstIterator begin() const
Definition: IsotopeDistribution.h:350
ContainerType distribution_
stores the isotope distribution
Definition: IsotopeDistribution.h:389
ConstIterator end() const
Definition: IsotopeDistribution.h:352
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
ContainerType::const_reverse_iterator ConstReverseIterator
Definition: IsotopeDistribution.h:77

OpenMS / TOPP release 2.3.0 Documentation generated on Wed Apr 18 2018 19:29:05 using doxygen 1.8.14