Open Babel  3.0
chains.h
Go to the documentation of this file.
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-2006 by Geoffrey R. Hutchison
6 Some portions Copyright (C) 2008 by Tim Vandermeersch
7 
8 This file is part of the Open Babel project.
9 For more information, see <http://openbabel.org/>
10 
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation version 2 of the License.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 ***********************************************************************/
20 
21 #ifndef OB_CHAINS_H
22 #define OB_CHAINS_H
23 
24 #define MaxMonoAtom 20
25 #define MaxMonoBond 20
26 
27 #include <openbabel/babelconfig.h>
28 #include <vector>
29 
30 namespace OpenBabel
31 {
32 
33  class OBAtom;
34  class OBMol;
35 
37  // implementation in chains.cpp
38  struct Template;
39  typedef struct Template Template;
40 
49  class OBAPI OBChainsParser
50  {
51  public:
52 
53  OBChainsParser(void);
54  ~OBChainsParser(void);
55 
62  bool PerceiveChains(OBMol &mol, bool nukeSingleResidue = false);
63 
64  private: // internal methods
65 
67 
68 
75  bool DetermineHetAtoms(OBMol &);
77 
79 
80 
89  bool DetermineConnectedChains(OBMol &);
98  unsigned int RecurseChain(OBMol &mol, unsigned int i, int c);
100 
102 
103 
110  bool DeterminePeptideBackbone(OBMol &);
121  void ConstrainBackbone(OBMol &mol, Template *templ, int tmax);
125  bool MatchConstraint(OBAtom *atom, int mask);
130  bool Match2Constraints(Template *templ, OBAtom *na, OBAtom *nb);
135  bool Match3Constraints(Template *templ, OBAtom *na, OBAtom *nb, OBAtom *nc);
140  bool Match4Constraints(Template *templ, OBAtom *na, OBAtom *nb, OBAtom *nc, OBAtom *nd);
150  void TracePeptideChain(OBMol &mol, unsigned int i, int r);
152 
154 
155 
161  bool DeterminePeptideSidechains(OBMol &);
173  int IdentifyResidue(void *tree, OBMol &mol, unsigned int seed, int resno); // ByteCode *
181  void AssignResidue(OBMol &mol, int r, int c, int i);
183 
185 
186 
190  bool DetermineHydrogens(OBMol &);
192 
194 
195 
201  void SetResidueInformation(OBMol &, bool nukeSingleResidue);
203 
205 
206 
213  bool DetermineNucleicBackbone(OBMol &);
221  void TraceNucleicChain(OBMol &, unsigned int i, int r);
228  bool DetermineNucleicSidechains(OBMol &);
230 
235  void SetupMol(OBMol &);
239  void ClearResidueInformation(OBMol &mol);
243  void CleanupMol();
250  void DefineMonomer(void **tree, int resid, const char *smiles); // ByteCode **
255  int IdentifyElement(char *ptr);
261  const char *ParseSmiles(const char *smiles, int prev);
265  void DumpState();
266 
267  void *PDecisionTree;
268  void *NDecisionTree;
269 
270  int ResMonoAtom[MaxMonoAtom];
271  int ResMonoBond[MaxMonoBond];
272 
273  std::vector<unsigned short> bitmasks;
274  std::vector<bool> visits;
275  std::vector<unsigned char> resids;
276  std::vector<unsigned char> flags;
277  std::vector<bool> hetflags;
278  std::vector<int> atomids;
279  std::vector<short> resnos;
280  std::vector<short> sernos;
281  std::vector<char> hcounts;
282  std::vector<char> chains;
283  };
284 
287 
288 }
289 #endif // OB_CHAINS_H
290 
OBChainsParser chainsparser
Global OBChainsParser for detecting macromolecular chains and residues.
Definition: chains.h:286
#define MaxMonoAtom
Definition: chains.h:24
Molecule Class.
Definition: mol.h:118
struct Template Template
Structure template for atomic patterns in residues for OBChainsParser.
Definition: chains.h:39
#define MaxMonoBond
Definition: chains.h:25
Perceives peptide or nucleotide chains and residues in an OBMol.
Definition: chains.h:49
Global namespace for all Open Babel code.
Definition: alias.h:22
Atom class.
Definition: atom.h:71