Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
ResidueDB.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-2013.
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: Andreas Bertsch $
32 // $Authors: Andreas Bertsch $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_CHEMISTRY_RESIDUEDB_H
36 #define OPENMS_CHEMISTRY_RESIDUEDB_H
37 
40 
41 #include <set>
42 
43 namespace OpenMS
44 {
45  // forward declarations
46  class ResidueModification;
47  class Residue;
48 
60  class OPENMS_DLLAPI ResidueDB
61  {
62 public:
63 
67  typedef std::set<Residue *>::iterator ResidueIterator;
68  typedef std::set<const Residue *>::const_iterator ResidueConstIterator;
70 
72  inline static ResidueDB * getInstance()
73  {
74  static ResidueDB * db_ = 0;
75  if (db_ == 0)
76  {
77  db_ = new ResidueDB;
78  }
79  return db_;
80  }
81 
85  virtual ~ResidueDB();
88 
92  Size getNumberOfResidues() const;
94 
95  Size getNumberOfModifiedResidues() const;
96 
98  const Residue * getResidue(const String & name) const;
99 
101  const Residue * getModifiedResidue(const String & name);
102 
104  const Residue * getModifiedResidue(const Residue * residue, const String & name);
105 
122  const std::set<const Residue *> getResidues(const String & residue_set = "All") const;
123 
125  const std::set<String> & getResidueSets() const;
126 
128  void setResidues(const String & filename);
129 
131  void addResidue(const Residue & residue);
133 
137  bool hasResidue(const String & name) const;
139 
141  bool hasResidue(const Residue * residue) const;
143 
147  inline ResidueIterator beginResidue() { return residues_.begin(); }
148 
149  inline ResidueIterator endResidue() { return residues_.end(); }
150 
151  inline ResidueConstIterator beginResidue() const { return const_residues_.begin(); }
152 
153  inline ResidueConstIterator endResidue() const { return const_residues_.end(); }
155 
156 protected:
157 
161  ResidueDB();
163 
165  ResidueDB(const ResidueDB & residue_db);
167 
171  ResidueDB & operator=(const ResidueDB & aa);
174 
176  void readResiduesFromFile_(const String & filename);
177 
179  Residue * parseResidue_(Map<String, String> & values);
180 
182  void clear_();
183 
185  void clearResidues_();
186 
188  void buildResidueNames_();
189 
190  void addResidue_(Residue * residue);
191 
193 
195 
196  std::set<Residue *> residues_;
197 
198  std::set<const Residue *> const_residues_;
199 
200  std::set<Residue *> modified_residues_;
201 
202  std::set<const Residue *> const_modified_residues_;
203 
205 
206  std::set<String> residue_sets_;
207  };
208 }
209 #endif
ResidueConstIterator beginResidue() const
Definition: ResidueDB.h:151
A more convenient string class.
Definition: String.h:56
Map< String, std::set< const Residue * > > residues_by_set_
Definition: ResidueDB.h:204
Representation of a residue.
Definition: Residue.h:64
std::set< const Residue * > const_residues_
Definition: ResidueDB.h:198
Map< String, Map< String, Residue * > > residue_mod_names_
Definition: ResidueDB.h:194
static ResidueDB * getInstance()
this member function serves as a replacement of the constructor
Definition: ResidueDB.h:72
std::set< Residue * > residues_
Definition: ResidueDB.h:196
std::set< const Residue * >::const_iterator ResidueConstIterator
Definition: ResidueDB.h:68
ResidueIterator endResidue()
Definition: ResidueDB.h:149
std::set< const Residue * > const_modified_residues_
Definition: ResidueDB.h:202
std::set< Residue * >::iterator ResidueIterator
Definition: ResidueDB.h:67
residue data base which holds residues
Definition: ResidueDB.h:60
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
std::set< String > residue_sets_
Definition: ResidueDB.h:206
ResidueConstIterator endResidue() const
Definition: ResidueDB.h:153
Map< String, Residue * > residue_names_
Definition: ResidueDB.h:192
std::set< Residue * > modified_residues_
Definition: ResidueDB.h:200
Map class based on the STL map (containing serveral convenience functions)
Definition: Map.h:50
ResidueIterator beginResidue()
Definition: ResidueDB.h:147

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:20 using doxygen 1.8.5