~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to source/METADATA/Modification.C

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2012-11-12 15:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20121112155812-vr15wtg9b50cuesg
Tags: upstream-1.9.0
ImportĀ upstreamĀ versionĀ 1.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: C++; tab-width: 2; -*-
 
2
// vi: set ts=2:
 
3
//
 
4
// --------------------------------------------------------------------------
 
5
//                   OpenMS Mass Spectrometry Framework
 
6
// --------------------------------------------------------------------------
 
7
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
 
8
//
 
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.
 
13
//
 
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.
 
18
//
 
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
 
22
//
 
23
// --------------------------------------------------------------------------
 
24
// $Maintainer: Andreas Bertsch $
 
25
// $Authors: Marc Sturm $
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
#include <OpenMS/METADATA/Modification.h>
 
29
 
 
30
using namespace std;
 
31
 
 
32
namespace OpenMS
 
33
{
 
34
 
 
35
        const std::string Modification::NamesOfSpecificityType[] = {"AA","AA_AT_CTERM","AA_AT_NTERM","CTERM","NTERM"};
 
36
        
 
37
        Modification::Modification() :
 
38
                SampleTreatment("Modification"),
 
39
                reagent_name_(""),
 
40
                mass_(0.0),
 
41
                specificity_type_(AA),
 
42
                affected_amino_acids_("")
 
43
        {
 
44
                
 
45
        }
 
46
        
 
47
        Modification::Modification(const Modification& source):
 
48
                        SampleTreatment(source),
 
49
                        reagent_name_(source.reagent_name_),
 
50
                        mass_(source.mass_),
 
51
                        specificity_type_(source.specificity_type_),
 
52
                        affected_amino_acids_(source.affected_amino_acids_)
 
53
        {
 
54
 
 
55
        }
 
56
        
 
57
        Modification::~Modification()
 
58
        {
 
59
 
 
60
        }
 
61
        
 
62
        Modification& Modification::operator = (const Modification& source)
 
63
        {
 
64
          if (&source == this) return *this;
 
65
          
 
66
          SampleTreatment::operator=(source);
 
67
                reagent_name_ = source.reagent_name_;
 
68
                mass_ = source.mass_;
 
69
                specificity_type_ = source.specificity_type_;
 
70
                affected_amino_acids_ = source.affected_amino_acids_;
 
71
          
 
72
          return *this;
 
73
        }
 
74
 
 
75
  bool Modification::operator== (const SampleTreatment& rhs) const
 
76
  {
 
77
        if (type_!=rhs.getType()) return false;
 
78
        
 
79
        const Modification* tmp = dynamic_cast<const Modification*>(&rhs);
 
80
        return
 
81
                SampleTreatment::operator==(*tmp) &&
 
82
                        reagent_name_ == tmp->reagent_name_ &&
 
83
                        mass_ == tmp->mass_ &&
 
84
                        specificity_type_ == tmp->specificity_type_ &&
 
85
                        affected_amino_acids_ == tmp->affected_amino_acids_
 
86
                ;
 
87
  }
 
88
 
 
89
        SampleTreatment* Modification::clone() const
 
90
        {
 
91
                SampleTreatment* tmp = new Modification(*this);
 
92
                return tmp;
 
93
        }
 
94
        
 
95
        const String& Modification::getReagentName() const
 
96
        {
 
97
          return reagent_name_;
 
98
        }
 
99
        
 
100
        void Modification::setReagentName(const String& reagent_name)
 
101
        {
 
102
          reagent_name_ = reagent_name;
 
103
        }
 
104
        
 
105
        
 
106
        DoubleReal Modification::getMass() const
 
107
        {
 
108
          return mass_;
 
109
        }
 
110
        
 
111
        void Modification::setMass(DoubleReal mass)
 
112
        {
 
113
          mass_ = mass;
 
114
        }
 
115
        
 
116
        
 
117
        const Modification::SpecificityType& Modification::getSpecificityType() const
 
118
        {
 
119
          return specificity_type_;
 
120
        }
 
121
        
 
122
        void Modification::setSpecificityType(const Modification::SpecificityType& specificity_type)
 
123
        {
 
124
          specificity_type_ = specificity_type;
 
125
        }
 
126
        
 
127
        
 
128
        const String& Modification::getAffectedAminoAcids() const
 
129
        {
 
130
          return affected_amino_acids_;
 
131
        }
 
132
        
 
133
        void Modification::setAffectedAminoAcids(const String& affected_amino_acids)
 
134
        {
 
135
          affected_amino_acids_ = affected_amino_acids;
 
136
        }
 
137
        
 
138
}
 
139
 
 
140