1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
14
// This library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
// --------------------------------------------------------------------------
24
// $Maintainer: Chris Bielow $
25
// $Authors: Chris Bielow $
26
// --------------------------------------------------------------------------
28
#include <OpenMS/CHEMISTRY/WeightWrapper.h>
32
WeightWrapper::WeightWrapper()
37
WeightWrapper::WeightWrapper(const WEIGHTMODE weight_mode)
38
:weight_mode_(weight_mode)
42
WeightWrapper::WeightWrapper(const WeightWrapper& source)
43
: weight_mode_(source.weight_mode_)
47
WeightWrapper::~WeightWrapper()
51
void WeightWrapper::setWeightMode(const WEIGHTMODE mode)
53
if (mode >= WeightWrapper::SIZE_OF_WEIGHTMODE) throw Exception::IllegalArgument(__FILE__, __LINE__, __PRETTY_FUNCTION__, "setWeightMode() received illegal 'mode' value!");
57
WeightWrapper::WEIGHTMODE WeightWrapper::getWeightMode() const
62
DoubleReal WeightWrapper::getWeight(const AASequence& aa) const
64
if (weight_mode_==WeightWrapper::MONO) return aa.getMonoWeight();
65
else return aa.getAverageWeight();
68
DoubleReal WeightWrapper::getWeight(const EmpiricalFormula& ef) const
70
if (weight_mode_==WeightWrapper::MONO) return ef.getMonoWeight();
71
else return ef.getAverageWeight();
75
DoubleReal WeightWrapper::getWeight(const Residue& r, Residue::ResidueType res_type) const
77
if (weight_mode_==WeightWrapper::MONO) return r.getMonoWeight(res_type);
78
else return r.getAverageWeight(res_type);