| 1 | /********************************************************************** | 
| 2 | chains.h - Parse for macromolecule chains and residues | 
| 3 |  | 
| 4 | Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc. | 
| 5 | Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison | 
| 6 |  | 
| 7 | This file is part of the Open Babel project. | 
| 8 | For more information, see <http://openbabel.sourceforge.net/> | 
| 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 | #ifndef OB_CHAINS_H | 
| 21 | #define OB_CHAINS_H | 
| 22 |  | 
| 23 | #define MaxMonoAtom 20 | 
| 24 | #define MaxMonoBond 20 | 
| 25 |  | 
| 26 | namespace OpenBabel | 
| 27 | { | 
| 28 |  | 
| 29 | class OBAtom; | 
| 30 | class OBMol; | 
| 31 |  | 
| 32 | //! Structure for atomic patterns (templates) in residues for OBChainsParser | 
| 33 | typedef struct | 
| 34 | { | 
| 35 | int flag; | 
| 36 | short elem, count; | 
| 37 | int n1, n2, n3, n4; | 
| 38 | } | 
| 39 | Template; | 
| 40 |  | 
| 41 | //! \brief Perceives peptide or nucleotide chains and residues in an OBMol | 
| 42 | class OBAPI OBChainsParser | 
| 43 | { | 
| 44 | public: | 
| 45 |  | 
| 46 | OBChainsParser(void); | 
| 47 | ~OBChainsParser(void); | 
| 48 |  | 
| 49 | bool PerceiveChains(OBMol &, bool nukeSingleResidue = false); | 
| 50 |  | 
| 51 | private: // methods | 
| 52 |  | 
| 53 | bool  DetermineHetAtoms(OBMol &); | 
| 54 | bool  DetermineConnectedChains(OBMol &); | 
| 55 | bool  DeterminePeptideBackbone(OBMol &); | 
| 56 | bool  DeterminePeptideSidechains(OBMol &); | 
| 57 | bool  DetermineNucleicBackbone(OBMol &); | 
| 58 | bool  DetermineNucleicSidechains(OBMol &); | 
| 59 | bool  DetermineHydrogens(OBMol &); | 
| 60 |  | 
| 61 | void  SetupMol(OBMol &); | 
| 62 | void  SetResidueInformation(OBMol &, bool nukeSingleResidue); | 
| 63 | void  ClearResidueInformation(OBMol &); | 
| 64 | void  CleanupMol(void); | 
| 65 |  | 
| 66 | void  AssignResidue(OBMol &, int, int, int); | 
| 67 | int   IdentifyResidue(void *, OBMol &, int, int); // ByteCode * | 
| 68 |  | 
| 69 | void  DefineMonomer(void **, int, char *); // ByteCode ** | 
| 70 | int   IdentifyElement(char *); | 
| 71 |  | 
| 72 | bool  MatchConstraint(OBAtom *, int); | 
| 73 | bool  Match2Constraints(Template *, OBAtom *, OBAtom *); | 
| 74 | bool  Match3Constraints(Template *, OBAtom *, OBAtom *, OBAtom *); | 
| 75 | bool  Match4Constraints(Template *, OBAtom *, OBAtom *, OBAtom *, OBAtom *); | 
| 76 |  | 
| 77 | void  ConstrainBackbone(OBMol &, Template *, int); | 
| 78 |  | 
| 79 | int   RecurseChain(OBMol &, int, int); | 
| 80 | void  TraceNucleicChain(OBMol &, int, int); | 
| 81 | void  TracePeptideChain(OBMol &, int, int); | 
| 82 |  | 
| 83 | char *ParseSmiles(char *, int); | 
| 84 |  | 
| 85 | private: // members | 
| 86 |  | 
| 87 | void *PDecisionTree; // ByteCode * | 
| 88 | void *NDecisionTree; // ByteCode * | 
| 89 |  | 
| 90 | int   ResMonoAtom[MaxMonoAtom]; | 
| 91 | int   ResMonoBond[MaxMonoBond]; | 
| 92 |  | 
| 93 | unsigned short *bitmasks; | 
| 94 | unsigned char  *resids; | 
| 95 | unsigned char  *flags; | 
| 96 | bool           *hetflags; | 
| 97 | short          *atomids; | 
| 98 | short          *resnos; | 
| 99 | short          *sernos; | 
| 100 | char           *hcounts; | 
| 101 | char           *chains; | 
| 102 | }; | 
| 103 |  | 
| 104 | } | 
| 105 | #endif // OB_CHAINS_H | 
| 106 |  | 
| 107 | //! \file chains.h | 
| 108 | //! \brief Parse for macromolecule chains and residues. |