residue.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 residue.h - Defines for residue properties, names, etc.
00003  
00004 Copyright (C) 2001, 2002  OpenEye Scientific Software, Inc.
00005 Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison
00006  
00007 This file is part of the Open Babel project.
00008 For more information, see <http://openbabel.sourceforge.net/>
00009  
00010 This program is free software; you can redistribute it and/or modify
00011 it under the terms of the GNU General Public License as published by
00012 the Free Software Foundation version 2 of the License.
00013  
00014 This program 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
00017 GNU General Public License for more details.
00018 ***********************************************************************/
00019 
00020 /**********************************************************************
00021 Global arrays Residue, ElemDesc and function GetResidueNumber were
00022 obtained in part or whole from RasMol2 by Roger Sayle.
00023 ***********************************************************************/
00024 
00025 #ifndef OB_RESIDUE_H
00026 #define OB_RESIDUE_H
00027 
00028 #include <openbabel/babelconfig.h>
00029 
00030 #ifndef EXTERN
00031 #  define EXTERN extern
00032 #endif
00033 
00034 #include <vector>
00035 #include <string>
00036 
00037 #include <openbabel/base.h>
00038 
00039 namespace OpenBabel {
00040 
00041   class OBAtom;
00043   typedef std::vector<OBAtom*>::iterator OBAtomIterator;
00044   class OBBond;
00046   typedef std::vector<OBBond*>::iterator OBBondIterator;
00047 
00048   // Class OBResidue
00049   // class introduction in residue.cpp
00050  class OBAPI OBResidue : public OBBase
00051   {
00052   public:
00053 
00055     OBResidue(void);
00057     OBResidue(const OBResidue &);
00059     virtual ~OBResidue(void);
00060 
00061     OBResidue &operator=(const OBResidue &);
00062 
00064     void    AddAtom(OBAtom *atom);
00066     void    InsertAtom(OBAtom *atom);
00068     void    RemoveAtom(OBAtom *atom);
00073     bool    Clear();
00074 
00079     void    SetName(const std::string &resname);
00081     void    SetNum(const unsigned int resnum);
00083     void    SetChain(const char chain);
00085     void    SetChainNum(const unsigned int chainnum);
00088     void    SetIdx(const unsigned int idx);
00089 
00092     void    SetAtomID(OBAtom *atom, const std::string &id);
00093     void    SetHetAtom(OBAtom *atom, bool hetatm);
00095     void    SetSerialNum(OBAtom *atom, unsigned int sernum);
00096 
00098     std::string    GetName(void)                  const;
00100     unsigned int   GetNum(void)                   const;
00102     unsigned int   GetNumAtoms()                  const;
00104     char           GetChain(void)                 const;
00106     unsigned int   GetChainNum(void)              const;
00108     unsigned int   GetIdx(void)                   const;
00110     unsigned int   GetResKey(void)                const;
00111 
00113     std::vector<OBAtom*> GetAtoms(void)           const;
00116     std::vector<OBBond*> GetBonds(bool exterior= true)const;
00117 
00120     std::string    GetAtomID(OBAtom *atom)        const;
00122     unsigned       GetSerialNum(OBAtom *atom)     const;
00123 
00126     bool           GetAminoAcidProperty(int)      const;
00129     bool           GetAtomProperty(OBAtom *a, int) const;
00132     bool           GetResidueProperty(int)        const;
00133 
00135     bool           IsHetAtom(OBAtom *atom)        const;
00138     bool           IsResidueType(int)             const;
00139 
00141 
00142 
00143     OBAtomIterator BeginAtoms()   { return _atoms.begin(); }
00145     OBAtomIterator EndAtoms()     { return _atoms.end();   }
00148     OBAtom *BeginAtom(std::vector<OBAtom*>::iterator &i);
00151     OBAtom *NextAtom(std::vector<OBAtom*>::iterator &i);
00153 
00154   protected: // members
00155 
00156     unsigned int              _idx;   
00157     char                      _chain; 
00158     unsigned int              _aakey; 
00159     unsigned int              _reskey;
00160     unsigned int              _resnum;
00161     std::string               _resname;
00162 
00163     std::vector<bool>         _hetatm;
00164     std::vector<std::string>  _atomid;
00165     std::vector<OBAtom*>      _atoms; 
00166     std::vector<unsigned int> _sernum;
00167     // Now in OBBase
00168     //    std::vector<OBGenericData*> _vdata; //!< Custom data
00169   }; // OBResidue
00170 
00172   typedef std::vector<OBResidue*>::iterator OBResidueIterator;
00173 
00175   // Global Definitions
00177 
00178 #define MAXSETNO 40
00179 #define MAXELEM  1024
00180 #define MINELEM  29
00181 #define MAXRES   100
00182 #define MINRES   54
00183 
00185   // Amino Acid Definitions
00187 
00188 #define AA_ALA (1<<1)
00189 #define AA_GLY (1<<2)
00190 #define AA_LEU (1<<3)
00191 #define AA_SER (1<<4)
00192 #define AA_VAL (1<<5)
00193 #define AA_THR (1<<6)
00194 #define AA_LYS (1<<7)
00195 #define AA_ASP (1<<8)
00196 #define AA_ILE (1<<9)
00197 #define AA_ASN (1<<10)
00198 #define AA_GLU (1<<11)
00199 #define AA_PRO (1<<12)
00200 #define AA_ARG (1<<13)
00201 #define AA_PHE (1<<14)
00202 #define AA_GLN (1<<15)
00203 #define AA_TYR (1<<16)
00204 #define AA_HIS (1<<17)
00205 #define AA_CYS (1<<18)
00206 #define AA_MET (1<<19)
00207 #define AA_TRP (1<<20)
00208 
00210   // Amino Acid Property Definitions
00212 #define IS_ACIDIC(x)      ((x) & ((AA_ASP)|(AA_GLU)))
00213 #define IS_ACYCLIC(x)     ((x) & ((AA_ALA)|(AA_GLY)|(AA_LEU)|(AA_SER)|  \
00214                                   (AA_VAL)|(AA_THR)|(AA_LYS)|(AA_ASP)|  \
00215                                   (AA_ILE)|(AA_ASN)|(AA_GLU)|(AA_GLN)|  \
00216                                   (AA_CYS)|(AA_MET)))
00217 #define IS_ALIPHATIC(x)   ((x) & ((AA_ALA)|(AA_GLY)|(AA_ILE)|(AA_LEU)|  \
00218                                   (AA_VAL)))
00219 #define IS_AROMATIC(x)    ((x) & ((AA_HIS)|(AA_PHE)|(AA_TRP)|(AA_TYR)))
00220 #define IS_BASIC(x)       ((x) & ((AA_ARG)|(AA_HIS)|(AA_LYS)))
00221 #define IS_BURIED(x)      ((x) & ((AA_ALA)|(AA_CYS)|(AA_ILE)|(AA_LEU)|  \
00222                                   (AA_MET)|(AA_PHE)|(AA_TRP)|(AA_VAL)))
00223 #define IS_CHARGED(x)     ((x) & ((AA_ASP)|(AA_GLU)|(AA_ARG)|(AA_HIS)|  \
00224                                   (AA_LYS)))
00225 #define IS_CYCLIC(x)      ((x) & ((AA_HIS)|(AA_PHE)|(AA_PRO)|(AA_TRP)|  \
00226                                   (AA_TYR)))
00227 #define IS_HYDROPHOBIC(x) ((x) & ((AA_ALA)|(AA_LEU)|(AA_VAL)|(AA_ILE)|  \
00228                                   (AA_PRO)|(AA_PHE)|(AA_MET)|(AA_TRP)))
00229 #define IS_LARGE(x)       ((x) & ((AA_ARG)|(AA_PHE)|(AA_GLN)|(AA_TYR)|  \
00230                                   (AA_HIS)|(AA_LEU)|(AA_LYS)|(AA_ILE)|  \
00231                                   (AA_GLU)|(AA_MET)|(AA_TRP)))
00232 #define IS_MEDIUM(x)      ((x) & ((AA_VAL)|(AA_THR)|(AA_ASP)|(AA_ASN)|  \
00233                                   (AA_PRO)|(AA_CYS)))
00234 #define IS_NEGATIVE(x)    ((x) & ((AA_ASP)|(AA_GLU)))
00235 #define IS_NEUTRAL(x)     ((x) & ((AA_ALA)|(AA_GLY)|(AA_LEU)|(AA_SER)|  \
00236                                   (AA_VAL)|(AA_THR)|(AA_PHE)|(AA_GLN)|  \
00237                                   (AA_TYR)|(AA_HIS)|(AA_CYS)|(AA_MET)|  \
00238                                   (AA_TRP)|(AA_ILE)|(AA_ASN)|(AA_PRO)))
00239 #define IS_POLAR(x)       ((x) & ((AA_ASP)|(AA_ILE)|(AA_ASN)|(AA_GLU)|  \
00240                                   (AA_SER)|(AA_THR)|(AA_ARG)|(AA_GLN)|  \
00241                                   (AA_CYS)|(AA_HIS)))
00242 #define IS_POSITIVE(x)    ((x) & ((AA_ARG)|(AA_HIS)|(AA_LYS)))
00243 #define IS_SMALL(x)       ((x) & ((AA_ALA)|(AA_GLY)|(AA_SER)))
00244 #define IS_SURFACE(x)     ((x) & ((AA_THR)|(AA_LYS)|(AA_ASP)|(AA_ILE)|  \
00245                                   (AA_ASN)|(AA_GLU)|(AA_PRO)|(AA_ARG)|  \
00246                                   (AA_GLY)|(AA_SER)|(AA_GLN)|(AA_TYR)|  \
00247                                   (AA_HIS)))
00248 
00250   namespace OBAminoAcidProperty
00251   {
00252         enum
00253     {
00254       ACIDIC      =  0,
00255       ACYCLIC     =  1,
00256       ALIPHATIC   =  2,
00257       AROMATIC    =  3,
00258       BASIC       =  4,
00259       BURIED      =  5,
00260       CHARGED     =  6,
00261       CYCLIC      =  7,
00262       HYDROPHOBIC =  8,
00263       LARGE       =  9,
00264       MEDIUM      = 10,
00265       NEGATIVE    = 11,
00266       NEUTRAL     = 12,
00267       POLAR       = 13,
00268       POSITIVE    = 14,
00269       SMALL       = 15,
00270       SURFACE     = 16,
00271     };
00272   }
00273 
00275   namespace OBResidueAtomProperty
00276   {
00277     enum
00278     {
00279       ALPHA_CARBON     = 0,
00280       AMINO_BACKBONE   = 1,
00281       BACKBONE         = 2,
00282       CYSTEINE_SULPHUR = 3,
00283       LIGAND           = 4,
00284       NUCLEIC_BACKBONE = 5,
00285       SHAPELY_BACKBONE = 6,
00286       SHAPELY_SPECIAL  = 7,
00287       SIDECHAIN        = 8,
00288       SUGAR_PHOSPHATE  = 9,
00289     };
00290   }
00291 
00293   // some of these are invalid or troublesome in scripting interfaces
00294   // so they are removed by the #ifndef SWIG parts
00295   // (otherwise ignore them for C++ use)
00296   namespace OBResidueIndex
00297   {
00298     enum
00299     {
00300       ALA   =  0,
00301       GLY   =  1,
00302       LEU   =  2,
00303       SER   =  3,
00304       VAL   =  4,
00305 #ifndef SWIGPERL
00306       THR   =  5,
00307 #endif
00308       LYS   =  6,
00309       ASP   =  7,
00310       ILE   =  8,
00311       ASN   =  9,
00312       GLU   = 10,
00313       PRO   = 11,
00314       ARG   = 12,
00315       PHE   = 13,
00316       GLN   = 14,
00317       TYR   = 15,
00318       HIS   = 16,
00319       CYS   = 17,
00320       MET   = 18,
00321       TRP   = 19,
00322       ASX   = 20,
00323       GLX   = 21,
00324       PCA   = 22,
00325       HYP   = 23,
00326       A     = 24,
00327       C     = 25,
00328       G     = 26,
00329       T     = 27,
00330       U     = 28,
00331       UPLUS = 29,
00332       I     = 30,
00333       _1MA  = 32,
00334       _5MC  = 32,
00335       OMC   = 33,
00336       _1MG  = 34,
00337       _2MG  = 35,
00338       M2G   = 36,
00339       _7MG  = 37,
00340       OMG   = 38,
00341       YG    = 39,
00342       H2U   = 40,
00343       _5MU  = 41,
00344       PSU   = 42,
00345       UNK   = 43,
00346       ACE   = 44,
00347       FOR   = 45,
00348       HOH   = 46,
00349       DOD   = 47,
00350       SO4   = 48,
00351       PO4   = 49,
00352       NAD   = 50,
00353       COA   = 51,
00354       NAP   = 52,
00355       NDP   = 53,
00356     };
00357   }
00358 
00360   namespace OBResidueProperty
00361   {
00362     enum
00363      {
00364       AMINO        = 0,
00365       AMINO_NUCLEO = 1,
00366       COENZYME     = 2,
00367       ION          = 3,
00368       NUCLEO       = 4,
00369       PROTEIN      = 5,
00370       PURINE       = 6,
00371       PYRIMIDINE   = 7,
00372       SOLVENT      = 8,
00373       WATER        = 9,
00374     };
00375   }
00376 
00378   // Global Variables
00380 
00381   EXTERN char Residue[MAXRES][4];
00382   EXTERN char ElemDesc[MAXELEM][4];
00383   EXTERN unsigned int ResNo;
00384   EXTERN unsigned int ElemNo;
00385 } // end namespace OpenBabel
00386 
00387 #endif
00388