Open Babel  3.0
residue.h
Go to the documentation of this file.
1 /**********************************************************************
2 residue.h - Defines for residue properties, names, etc.
3 
4 Copyright (C) 2001, 2002 OpenEye Scientific Software, Inc.
5 Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison
6 
7 This file is part of the Open Babel project.
8 For more information, see <http://openbabel.org/>
9 
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation version 2 of the License.
13 
14 This program 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
17 GNU General Public License for more details.
18 ***********************************************************************/
19 
20 /**********************************************************************
21 Global arrays Residue, ElemDesc and function GetResidueNumber were
22 obtained in part or whole from RasMol2 by Roger Sayle.
23 ***********************************************************************/
24 
25 #ifndef OB_RESIDUE_H
26 #define OB_RESIDUE_H
27 
28 #include <openbabel/babelconfig.h>
29 
30 #ifndef EXTERN
31 # define EXTERN extern
32 #endif
33 
34 #include <vector>
35 #include <string>
36 
37 #include <openbabel/base.h>
38 
39 namespace OpenBabel {
40 
41  class OBAtom;
43  typedef std::vector<OBAtom*>::iterator OBAtomIterator;
44  class OBBond;
46  typedef std::vector<OBBond*>::iterator OBBondIterator;
47 
48  // Class OBResidue
49  // class introduction in residue.cpp
50  class OBAPI OBResidue : public OBBase
51  {
52  public:
53 
55  OBResidue(void);
57  OBResidue(const OBResidue &);
59  virtual ~OBResidue(void);
60 
61  OBResidue &operator=(const OBResidue &);
62 
64  void AddAtom(OBAtom *atom);
66  void InsertAtom(OBAtom *atom);
68  void RemoveAtom(OBAtom *atom);
73  bool Clear();
74 
79  void SetName(const std::string &resname);
81  void SetNum(const unsigned int resnum);
82  void SetNum(const std::string resnum);
84  void SetChain(const char chain);
86  void SetChainNum(const unsigned int chainnum);
89  void SetIdx(const unsigned int idx);
94  void SetInsertionCode(const char insertioncode);
95 
98  void SetAtomID(OBAtom *atom, const std::string &id);
99  void SetHetAtom(OBAtom *atom, bool hetatm);
101  void SetSerialNum(OBAtom *atom, unsigned int sernum);
102 
104  std::string GetName(void) const;
106  int GetNum(void);
107  std::string GetNumString(void);
109  unsigned int GetNumAtoms() const;
111  char GetChain(void) const;
113  unsigned int GetChainNum(void) const;
115  unsigned int GetIdx(void) const;
117  unsigned int GetResKey(void) const;
118 
120  std::vector<OBAtom*> GetAtoms(void) const;
123  std::vector<OBBond*> GetBonds(bool exterior= true)const;
124 
127  std::string GetAtomID(OBAtom *atom) const;
129  unsigned GetSerialNum(OBAtom *atom) const;
132  char GetInsertionCode(void) const;
133 
136  bool GetAminoAcidProperty(int) const;
139  bool GetAtomProperty(OBAtom *a, int) const;
142  bool GetResidueProperty(int) const;
143 
145  bool IsHetAtom(OBAtom *atom) const;
148  bool IsResidueType(int) const;
149 
151 
152  OBAtomIterator BeginAtoms() { return _atoms.begin(); }
155  OBAtomIterator EndAtoms() { return _atoms.end(); }
158  OBAtom *BeginAtom(std::vector<OBAtom*>::iterator &i);
161  OBAtom *NextAtom(std::vector<OBAtom*>::iterator &i);
163 
164  protected: // members
165 
166  unsigned int _idx;
167  char _chain;
168  unsigned int _aakey;
169  unsigned int _reskey;
170  std::string _resnum;
171  std::string _resname;
173 
174  std::vector<bool> _hetatm;
175  std::vector<std::string> _atomid;
176  std::vector<OBAtom*> _atoms;
177  std::vector<unsigned int> _sernum;
178  // Now in OBBase
179  // std::vector<OBGenericData*> _vdata; //!< Custom data
180  }; // OBResidue
181 
182 
184  // Global Definitions
186 
187 #define MAXSETNO 40
188 #define MAXELEM 29
189 #define MAXRES 54
190 
192  // Amino Acid Definitions
194 
195 #define AA_ALA (1<<1)
196 #define AA_GLY (1<<2)
197 #define AA_LEU (1<<3)
198 #define AA_SER (1<<4)
199 #define AA_VAL (1<<5)
200 #define AA_THR (1<<6)
201 #define AA_LYS (1<<7)
202 #define AA_ASP (1<<8)
203 #define AA_ILE (1<<9)
204 #define AA_ASN (1<<10)
205 #define AA_GLU (1<<11)
206 #define AA_PRO (1<<12)
207 #define AA_ARG (1<<13)
208 #define AA_PHE (1<<14)
209 #define AA_GLN (1<<15)
210 #define AA_TYR (1<<16)
211 #define AA_HIS (1<<17)
212 #define AA_CYS (1<<18)
213 #define AA_MET (1<<19)
214 #define AA_TRP (1<<20)
215 
217  // Amino Acid Property Definitions
219 #define IS_ACIDIC(x) ((x) & ((AA_ASP)|(AA_GLU)))
220 #define IS_ACYCLIC(x) ((x) & ((AA_ALA)|(AA_GLY)|(AA_LEU)|(AA_SER)| \
221  (AA_VAL)|(AA_THR)|(AA_LYS)|(AA_ASP)| \
222  (AA_ILE)|(AA_ASN)|(AA_GLU)|(AA_GLN)| \
223  (AA_CYS)|(AA_MET)))
224 #define IS_ALIPHATIC(x) ((x) & ((AA_ALA)|(AA_GLY)|(AA_ILE)|(AA_LEU)| \
225  (AA_VAL)))
226 #define IS_AROMATIC(x) ((x) & ((AA_HIS)|(AA_PHE)|(AA_TRP)|(AA_TYR)))
227 #define IS_BASIC(x) ((x) & ((AA_ARG)|(AA_HIS)|(AA_LYS)))
228 #define IS_BURIED(x) ((x) & ((AA_ALA)|(AA_CYS)|(AA_ILE)|(AA_LEU)| \
229  (AA_MET)|(AA_PHE)|(AA_TRP)|(AA_VAL)))
230 #define IS_CHARGED(x) ((x) & ((AA_ASP)|(AA_GLU)|(AA_ARG)|(AA_HIS)| \
231  (AA_LYS)))
232 #define IS_CYCLIC(x) ((x) & ((AA_HIS)|(AA_PHE)|(AA_PRO)|(AA_TRP)| \
233  (AA_TYR)))
234 #define IS_HYDROPHOBIC(x) ((x) & ((AA_ALA)|(AA_LEU)|(AA_VAL)|(AA_ILE)| \
235  (AA_PRO)|(AA_PHE)|(AA_MET)|(AA_TRP)))
236 #define IS_LARGE(x) ((x) & ((AA_ARG)|(AA_PHE)|(AA_GLN)|(AA_TYR)| \
237  (AA_HIS)|(AA_LEU)|(AA_LYS)|(AA_ILE)| \
238  (AA_GLU)|(AA_MET)|(AA_TRP)))
239 #define IS_MEDIUM(x) ((x) & ((AA_VAL)|(AA_THR)|(AA_ASP)|(AA_ASN)| \
240  (AA_PRO)|(AA_CYS)))
241 #define IS_NEGATIVE(x) ((x) & ((AA_ASP)|(AA_GLU)))
242 #define IS_NEUTRAL(x) ((x) & ((AA_ALA)|(AA_GLY)|(AA_LEU)|(AA_SER)| \
243  (AA_VAL)|(AA_THR)|(AA_PHE)|(AA_GLN)| \
244  (AA_TYR)|(AA_HIS)|(AA_CYS)|(AA_MET)| \
245  (AA_TRP)|(AA_ILE)|(AA_ASN)|(AA_PRO)))
246 #define IS_POLAR(x) ((x) & ((AA_ASP)|(AA_ILE)|(AA_ASN)|(AA_GLU)| \
247  (AA_SER)|(AA_THR)|(AA_ARG)|(AA_GLN)| \
248  (AA_CYS)|(AA_HIS)))
249 #define IS_POSITIVE(x) ((x) & ((AA_ARG)|(AA_HIS)|(AA_LYS)))
250 #define IS_SMALL(x) ((x) & ((AA_ALA)|(AA_GLY)|(AA_SER)))
251 #define IS_SURFACE(x) ((x) & ((AA_THR)|(AA_LYS)|(AA_ASP)|(AA_ILE)| \
252  (AA_ASN)|(AA_GLU)|(AA_PRO)|(AA_ARG)| \
253  (AA_GLY)|(AA_SER)|(AA_GLN)|(AA_TYR)| \
254  (AA_HIS)))
255 
257  namespace OBAminoAcidProperty
258  {
259  enum
260  {
261  ACIDIC = 0,
262  ACYCLIC = 1,
264  AROMATIC = 3,
265  BASIC = 4,
266  BURIED = 5,
267  CHARGED = 6,
268  CYCLIC = 7,
270  LARGE = 9,
271  MEDIUM = 10,
272  NEGATIVE = 11,
273  NEUTRAL = 12,
274  POLAR = 13,
275  POSITIVE = 14,
276  SMALL = 15,
277  SURFACE = 16
278  };
279  }
280 
282  namespace OBResidueAtomProperty
283  {
284  enum
285  {
288  BACKBONE = 2,
290  LIGAND = 4,
296  };
297  }
298 
300  // some of these are invalid or troublesome in scripting interfaces
301  // so they are removed by the #ifndef SWIG parts
302  // (otherwise ignore them for C++ use)
303  namespace OBResidueIndex
304  {
305  enum
306  {
307  ALA = 0,
308  GLY = 1,
309  LEU = 2,
310  SER = 3,
311  VAL = 4,
312 #ifndef SWIGPERL
313  THR = 5,
314 #endif
315  LYS = 6,
316  ASP = 7,
317  ILE = 8,
318  ASN = 9,
319  GLU = 10,
320  PRO = 11,
321  ARG = 12,
322  PHE = 13,
323  GLN = 14,
324  TYR = 15,
325  HIS = 16,
326  CYS = 17,
327  MET = 18,
328  TRP = 19,
329  ASX = 20,
330  GLX = 21,
331  PCA = 22,
332  HYP = 23,
333  A = 24,
334  C = 25,
335  G = 26,
336  T = 27,
337  U = 28,
338  UPLUS = 29,
339  I = 30,
340  _1MA = 32,
341  _5MC = 32,
342  OMC = 33,
343  _1MG = 34,
344  _2MG = 35,
345  M2G = 36,
346  _7MG = 37,
347  OMG = 38,
348  YG = 39,
349  H2U = 40,
350  _5MU = 41,
351  PSU = 42,
352  UNK = 43,
353  ACE = 44,
354  FOR = 45,
355  HOH = 46,
356  DOD = 47,
357  SO4 = 48,
358  PO4 = 49,
359  NAD = 50,
360  COA = 51,
361  NAP = 52,
362  NDP = 53
363  };
364  }
365 
367  namespace OBResidueProperty
368  {
369  enum
370  {
371  AMINO = 0,
373  COENZYME = 2,
374  ION = 3,
375  NUCLEO = 4,
376  PROTEIN = 5,
377  PURINE = 6,
379  SOLVENT = 8,
380  WATER = 9
381  };
382  }
383 
384 } // end namespace OpenBabel
385 
386 #endif
387 
Definition: residue.h:379
Definition: residue.h:317
Definition: residue.h:371
Definition: residue.h:270
Definition: residue.h:336
Definition: residue.h:351
Definition: residue.h:347
std::string _resnum
Residue number (i.e., in file) 23, 1B, etc.
Definition: residue.h:170
unsigned int _reskey
Residue key ID – see SetResidueKeys()
Definition: residue.h:169
Definition: residue.h:327
std::vector< unsigned int > _sernum
List of serial numbers.
Definition: residue.h:177
Definition: residue.h:307
Base classes to build a graph.
std::string _resname
Residue text name.
Definition: residue.h:171
Definition: residue.h:340
Definition: residue.h:356
Definition: residue.h:328
Definition: residue.h:349
Definition: residue.h:353
Definition: residue.h:319
Definition: residue.h:313
Definition: residue.h:321
const char * GetName(unsigned int atomic_number)
Definition: elements.cpp:96
Definition: residue.h:320
Definition: residue.h:326
char _insertioncode
PBB insertion code.
Definition: residue.h:172
Definition: residue.h:325
Definition: residue.h:339
Definition: residue.h:374
Definition: residue.h:376
Definition: residue.h:341
Definition: residue.h:346
std::vector< OBAtom * >::iterator OBAtomIterator
A standard iterator over a vector of atoms.
Definition: atom.h:48
Definition: residue.h:331
Definition: residue.h:309
Definition: residue.h:360
Definition: residue.h:265
std::vector< OBBond * >::iterator OBBondIterator
A standard iterator over a vector of bonds.
Definition: atom.h:46
Definition: residue.h:332
Definition: residue.h:311
Definition: residue.h:358
Definition: residue.h:276
std::vector< bool > _hetatm
Is a given atom a HETAM.
Definition: residue.h:174
Definition: residue.h:362
Definition: residue.h:308
Definition: residue.h:323
unsigned int _aakey
Amino Acid key ID – see SetResidueKeys()
Definition: residue.h:168
Definition: residue.h:377
Definition: residue.h:274
Definition: residue.h:348
Definition: residue.h:345
Definition: residue.h:315
Definition: residue.h:330
Definition: residue.h:324
Definition: residue.h:359
Definition: residue.h:329
char _chain
Chain ID.
Definition: residue.h:167
Definition: residue.h:316
Definition: residue.h:322
std::vector< OBAtom * > _atoms
List of OBAtom in this residue.
Definition: residue.h:176
Definition: residue.h:342
Definition: residue.h:355
Definition: residue.h:337
Definition: residue.h:310
Definition: residue.h:354
Definition: residue.h:335
OBAtomIterator EndAtoms()
Definition: residue.h:155
Definition: residue.h:350
Definition: residue.h:343
Definition: residue.h:375
Definition: residue.h:318
Definition: residue.h:352
Definition: residue.h:344
std::vector< std::string > _atomid
Residue atom text IDs.
Definition: residue.h:175
Definition: residue.h:338
Definition: residue.h:361
Base Class.
Definition: base.h:239
Definition: residue.h:334
Residue information.
Definition: residue.h:50
Definition: residue.h:357
Definition: residue.h:380
Definition: residue.h:333
unsigned int _idx
Residue index (i.e., internal index in an OBMol)
Definition: residue.h:166
Global namespace for all Open Babel code.
Definition: alias.h:22
Atom class.
Definition: atom.h:71