OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
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 
119  mol::AtomHandleList GetUnknownAtoms(mol::ResidueHandle res);
120 
123  virtual bool IsResidueComplete(const mol::ResidueHandle& residue);
124 
125  CompoundLibPtr GetCompoundLib() const { return compound_lib_; }
126 
127 private:
128  CompoundLibPtr compound_lib_;
129  CompoundPtr last_compound_;
130  mol::ResidueHandle last_residue_;
131  bool unknown_atoms_;
133  bool HasUnknownAtoms(mol::ResidueHandle res);
134 
135  void LookupCompound(const mol::ResidueHandle& rh);
137  void ReorderAtoms(mol::ResidueHandle residue, CompoundPtr compound);
138 
139  mol::AtomHandle LocateAtom(const mol::AtomHandleList& ahl, int ordinal);
140 
141  void AssignBackBoneTorsionsToResidue(mol::ResidueHandle residue);
142 
143 };
144 
145 typedef boost::shared_ptr<RuleBasedBuilder> RuleBasedBuilderPtr;
146 
147 }}
148 
149 #endif
150