OpenStructure
rule_based_builder.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_CONOP_RULE_BASED_BUILDER_HH
20 #define OST_CONOP_RULE_BASED_BUILDER_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 #include <set>
26 #include <map>
27 
28 #include "builder.hh"
29 #include "compound_lib.hh"
30 
31 namespace ost { namespace conop {
32 
41 public:
42  RuleBasedBuilder(const CompoundLibPtr& compound_lib)
43  : compound_lib_(compound_lib), last_compound_() {
44  }
45 
46  virtual void SetDialect(Dialect dialect) {
47  if (this->GetDialect()!=dialect) {
48  Builder::SetDialect(dialect);
49  last_compound_=CompoundPtr();
50  compound_lib_->ClearCache();
51  }
52  }
53 
55  virtual void FillAtomProps(mol::AtomHandle atom);
56 
57  virtual void CompleteAtoms(mol::ResidueHandle rh);
58 
69  virtual void CheckResidueCompleteness(const mol::ResidueHandle& rh);
70 
76  virtual mol::ResidueKey IdentifyResidue(const mol::ResidueHandle& rh);
77 
78 
79  virtual void ConnectAtomsOfResidue(mol::ResidueHandle rh);
80 
90  virtual void ConnectResidueToNext(mol::ResidueHandle rh,
91  mol::ResidueHandle next);
93  virtual void AssignTorsions(mol::ChainHandle ch);
94  virtual void AssignTorsionsToResidue(mol::ResidueHandle residue);
104  virtual bool OnUnknownAtom(mol::AtomHandle atom);
105 
110  virtual void OnMissingAtom(const mol::ResidueHandle& residue,
111  const String& atom_name) { }
112 
114  virtual void FillAtomProps(mol::AtomHandle atom, const AtomSpec& spec);
115 
117  virtual void FillResidueProps(mol::ResidueHandle residue);
118 
120  bool HasUnknownAtoms(mol::ResidueHandle res);
123  virtual bool IsResidueComplete(const mol::ResidueHandle& residue);
124 private:
125  CompoundLibPtr compound_lib_;
126  CompoundPtr last_compound_;
127  mol::ResidueHandle last_residue_;
128  bool unknown_atoms_;
129  void LookupCompound(const mol::ResidueHandle& rh);
131  void ReorderAtoms(mol::ResidueHandle residue, CompoundPtr compound);
132 
133  mol::AtomHandle LocateAtom(const mol::AtomHandleList& ahl, int ordinal);
134 
135  void AssignBackBoneTorsionsToResidue(mol::ResidueHandle residue);
136 
137 
138 };
139 
140 
141 
142 }}
143 
144 #endif
145