chains.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 chains.h - Parse for macromolecule chains and residues
00003  
00004 Copyright (C) 1998-2001 by 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 #ifndef OB_CHAINS_H
00021 #define OB_CHAINS_H
00022 
00023 #define MaxMonoAtom 20
00024 #define MaxMonoBond 20
00025 
00026 namespace OpenBabel
00027 {
00028 
00029   class OBAtom;
00030   class OBMol;
00031 
00032   // Structure template for atomic patterns in residues for OBChainsParser
00033   // implementation in chains.cpp
00034   typedef struct Template Template;
00035 
00038   //
00043   class OBAPI OBChainsParser
00044     {
00045     public:
00046 
00047       OBChainsParser(void);
00048       ~OBChainsParser(void);
00049 
00054       bool PerceiveChains(OBMol &mol, bool nukeSingleResidue = false);
00055 
00056     private: // internal methods
00057 
00059       bool  DetermineHetAtoms(OBMol &);
00061       bool  DetermineConnectedChains(OBMol &);
00063       bool  DeterminePeptideBackbone(OBMol &);
00065       bool  DeterminePeptideSidechains(OBMol &);
00067       bool  DetermineNucleicBackbone(OBMol &);
00069       bool  DetermineNucleicSidechains(OBMol &);
00071       bool  DetermineHydrogens(OBMol &);
00072 
00074       void  SetupMol(OBMol &);
00075       void  SetResidueInformation(OBMol &, bool nukeSingleResidue);
00076       void  ClearResidueInformation(OBMol &);
00077       void  CleanupMol(void);
00078 
00079       void  AssignResidue(OBMol &, int, int, int);
00080       int   IdentifyResidue(void *, OBMol &, int, int); // ByteCode *
00081 
00082       void  DefineMonomer(void **, int, const char *); // ByteCode **
00083       int   IdentifyElement(const char *);
00084 
00085       bool  MatchConstraint(OBAtom *, int);
00086       bool  Match2Constraints(Template *, OBAtom *, OBAtom *);
00087       bool  Match3Constraints(Template *, OBAtom *, OBAtom *, OBAtom *);
00088       bool  Match4Constraints(Template *, OBAtom *, OBAtom *, OBAtom *, OBAtom *);
00089 
00090       void  ConstrainBackbone(OBMol &, Template *, int);
00091 
00092       int   RecurseChain(OBMol &, int, int);
00093       void  TraceNucleicChain(OBMol &, int, int);
00094       void  TracePeptideChain(OBMol &, int, int);
00095 
00096       const char *ParseSmiles(const char *, int);
00097 
00098     private: // members
00099 
00100       void *PDecisionTree; // ByteCode *
00101       void *NDecisionTree; // ByteCode *
00102 
00103       int   ResMonoAtom[MaxMonoAtom];
00104       int   ResMonoBond[MaxMonoBond];
00105 
00106       unsigned short *bitmasks; 
00107       bool           *visits;   
00108       unsigned char  *resids;
00109       unsigned char  *flags;
00110       bool           *hetflags;
00111       int            *atomids;
00112       short          *resnos;
00113       short          *sernos;   
00114       char           *hcounts;
00115       char           *chains;
00116     };
00117 
00118 }
00119 #endif // OB_CHAINS_H
00120