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 
00034   typedef struct Template Template;
00035 
00037   //
00042   class OBAPI OBChainsParser
00043     {
00044     public:
00045 
00046       OBChainsParser(void);
00047       ~OBChainsParser(void);
00048 
00053       bool PerceiveChains(OBMol &mol, bool nukeSingleResidue = false);
00054 
00055     private: // internal methods
00056 
00057       bool  DetermineHetAtoms(OBMol &);
00058       bool  DetermineConnectedChains(OBMol &);
00059       bool  DeterminePeptideBackbone(OBMol &);
00060       bool  DeterminePeptideSidechains(OBMol &);
00061       bool  DetermineNucleicBackbone(OBMol &);
00062       bool  DetermineNucleicSidechains(OBMol &);
00063       bool  DetermineHydrogens(OBMol &);
00064 
00065       void  SetupMol(OBMol &);
00066       void  SetResidueInformation(OBMol &, bool nukeSingleResidue);
00067       void  ClearResidueInformation(OBMol &);
00068       void  CleanupMol(void);
00069 
00070       void  AssignResidue(OBMol &, int, int, int);
00071       int   IdentifyResidue(void *, OBMol &, int, int); // ByteCode *
00072 
00073       void  DefineMonomer(void **, int, char *); // ByteCode **
00074       int   IdentifyElement(char *);
00075 
00076       bool  MatchConstraint(OBAtom *, int);
00077       bool  Match2Constraints(Template *, OBAtom *, OBAtom *);
00078       bool  Match3Constraints(Template *, OBAtom *, OBAtom *, OBAtom *);
00079       bool  Match4Constraints(Template *, OBAtom *, OBAtom *, OBAtom *, OBAtom *);
00080 
00081       void  ConstrainBackbone(OBMol &, Template *, int);
00082 
00083       int   RecurseChain(OBMol &, int, int);
00084       void  TraceNucleicChain(OBMol &, int, int);
00085       void  TracePeptideChain(OBMol &, int, int);
00086 
00087       char *ParseSmiles(char *, int);
00088 
00089     private: // members
00090 
00091       void *PDecisionTree; // ByteCode *
00092       void *NDecisionTree; // ByteCode *
00093 
00094       int   ResMonoAtom[MaxMonoAtom];
00095       int   ResMonoBond[MaxMonoBond];
00096 
00097       unsigned short *bitmasks;
00098       unsigned char  *resids;
00099       unsigned char  *flags;
00100       bool           *hetflags;
00101       short          *atomids;
00102       short          *resnos;
00103       short          *sernos; 
00104       char           *hcounts;
00105       char           *chains;
00106     };
00107 
00108 }
00109 #endif // OB_CHAINS_H
00110