00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // -------------------------------------------------------------------------- 00005 // OpenMS Mass Spectrometry Framework 00006 // -------------------------------------------------------------------------- 00007 // Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert 00008 // 00009 // This library is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License as published by the Free Software Foundation; either 00012 // version 2.1 of the License, or (at your option) any later version. 00013 // 00014 // This library is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with this library; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 // -------------------------------------------------------------------------- 00024 // $Maintainer: Clemens Groepl, Andreas Bertsch $ 00025 // -------------------------------------------------------------------------- 00026 00027 #ifndef OPENMS_CHEMISTRY_ISOTOPEDISTRIBUTION_H 00028 #define OPENMS_CHEMISTRY_ISOTOPEDISTRIBUTION_H 00029 00030 #include <OpenMS/CONCEPT/Types.h> 00031 00032 #include <utility> 00033 #include <vector> 00034 00035 namespace OpenMS 00036 { 00045 class IsotopeDistribution 00046 { 00047 public: 00048 00050 00051 00052 typedef std::vector<std::pair<UInt, double> > ContainerType; 00053 typedef ContainerType::iterator iterator; 00054 typedef ContainerType::iterator Iterator; 00055 typedef ContainerType::const_iterator const_iterator; 00056 typedef ContainerType::const_iterator ConstIterator; 00058 00060 00061 00064 IsotopeDistribution(); 00065 00067 IsotopeDistribution(UInt max_isotope); 00068 00070 IsotopeDistribution(const IsotopeDistribution& isotope_distribution); 00071 00073 virtual ~IsotopeDistribution(); 00075 00077 00078 00084 void setMaxIsotope(UInt max_isotope); 00085 00087 UInt getMaxIsotope() const; 00088 00090 void set(const ContainerType& distribution); 00091 00093 const ContainerType& getContainer() const; 00094 00096 UInt getMax() const; 00097 00099 UInt getMin() const; 00100 00102 UInt size() const; 00103 00105 void clear(); 00106 00113 void estimateFromPeptideWeight(double average_weight); 00114 00120 void renormalize(); 00121 00130 void trimRight(DoubleReal cutoff); 00131 00140 void trimLeft(DoubleReal cutoff); 00142 00144 00145 00146 IsotopeDistribution& operator = (const IsotopeDistribution& isotope_distribution); 00147 00149 IsotopeDistribution operator + (const IsotopeDistribution& isotope_distribution) const; 00150 00152 IsotopeDistribution& operator += (const IsotopeDistribution& isotope_distribution); 00153 00155 IsotopeDistribution operator * (UInt factor) const; 00156 00158 IsotopeDistribution& operator *= (UInt factor); 00159 00161 bool operator == (const IsotopeDistribution& isotope_distribution) const; 00162 00164 bool operator != (const IsotopeDistribution& isotope_distribution) const; 00166 00168 00169 inline Iterator begin() { return distribution_.begin(); } 00170 00171 inline Iterator end() { return distribution_.end(); } 00172 00173 inline ConstIterator begin() const { return distribution_.begin(); } 00174 00175 inline ConstIterator end() const { return distribution_.end(); } 00177 00178 protected: 00179 00181 void convolve_(ContainerType& result, const ContainerType& left, const ContainerType& right) const; 00182 00184 void convolvePow_(ContainerType& result, const ContainerType& input, UInt factor) const; 00185 00187 void convolveSquare_(ContainerType& result, const ContainerType& input) const; 00188 00190 UInt max_isotope_; 00191 00193 ContainerType distribution_; 00194 }; 00195 00196 } // namespace OpenMS 00197 00198 #endif // OPENMS_CHEMISTRY_ISOTOPEDISTRIBUTION_H
Generated Tue Apr 1 15:36:35 2008 -- using doxygen 1.5.4 | OpenMS / TOPP 1.1 |