OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rule_based.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-2020 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_HH
20 #define OST_CONOP_RULE_BASED_HH
21 
22 #include <ost/mol/entity_handle.hh>
23 #include "compound_lib.hh"
24 #include "diag.hh"
25 #include "processor.hh"
26 
27 namespace ost { namespace conop {
28 
31  CompoundPtr compound);
32 
34 
35 typedef boost::shared_ptr<RuleBasedProcessor> RuleBasedProcessorPtr;
36 
38 public:
40  lib_(compound_lib), fix_element_(true), strict_hydrogens_(false),
41  unk_res_treatment_(CONOP_WARN), unk_atom_treatment_(CONOP_WARN)
42  {
43  _CheckLib();
44  }
45 
47  ConopAction ur, ConopAction ua, bool bf, bool at, bool cn,
48  bool aa, bool ch, ConopAction zo):
49  Processor(bf, at, cn, aa, ch, zo), lib_(compound_lib), fix_element_(fe),
50  strict_hydrogens_(sh), unk_res_treatment_(ur),
51  unk_atom_treatment_(ua)
52  {
53  _CheckLib();
54  }
55 
57  return unk_res_treatment_;
58  }
59 
61  return unk_atom_treatment_;
62  }
63 
64  bool GetFixElement() const {
65  return fix_element_;
66  }
67  void SetFixElement(bool flag) {
68  fix_element_ = flag;
69  }
70  bool GetStrictHydrogens() const {
71  return strict_hydrogens_;
72  }
73 
74  void SetStrictHydrogens(bool flag) {
75  strict_hydrogens_ = flag;
76  }
78  unk_res_treatment_ = action;
79  }
80 
82  unk_atom_treatment_ = action;
83  }
84  virtual ProcessorPtr Copy() const {
85  return ProcessorPtr(new RuleBasedProcessor(*this));
86  }
87 
88  virtual String ToString() const;
89 protected:
90  void ProcessUnkResidue(DiagnosticsPtr diags,
91  mol::ResidueHandle res,
92  mol::AtomHandleList& remaining) const;
93  void ProcessUnkAtoms(DiagnosticsPtr diags,
96  mol::AtomHandleList& remaining) const;
97  virtual void DoProcess(DiagnosticsPtr diags,
98  mol::EntityHandle ent) const;
99 private:
100  void _CheckLib() const;
101 
102  CompoundLibPtr lib_;
103  bool fix_element_;
104  bool strict_hydrogens_;
105  ConopAction unk_res_treatment_;
106  ConopAction unk_atom_treatment_;
107 };
108 
109 
110 
111 }}
112 #endif
113 
boost::shared_ptr< RuleBasedProcessor > RuleBasedProcessorPtr
Definition: rule_based.hh:33
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_CONOP
boost::shared_ptr< Processor > ProcessorPtr
Definition: processor.hh:42
Protein or molecule.
boost::shared_ptr< Diagnostics > DiagnosticsPtr
Definition: diag.hh:111
void SetStrictHydrogens(bool flag)
Definition: rule_based.hh:74
void SetUnkResidueTreatment(ConopAction action)
Definition: rule_based.hh:77
tuple compound_lib
Definition: init.py:184
boost::shared_ptr< CompoundLib > CompoundLibPtr
Definition: compound_lib.hh:32
boost::shared_ptr< Compound > CompoundPtr
Definition: compound.hh:134
ConopAction GetUnkAtomTreatment() const
Definition: rule_based.hh:60
mol::AtomHandleList DLLIMPORT GetUnknownAtoms(mol::ResidueHandle res, CompoundPtr compound)
returns all atoms not listed in the specifictaion of compound
bool GetStrictHydrogens() const
Definition: rule_based.hh:70
virtual ProcessorPtr Copy() const
Definition: rule_based.hh:84
RuleBasedProcessor(CompoundLibPtr compound_lib)
Definition: rule_based.hh:39
std::vector< AtomHandle > AtomHandleList
ConopAction GetUnkResidueTreatment() const
Definition: rule_based.hh:56
RuleBasedProcessor(CompoundLibPtr compound_lib, bool fe, bool sh, ConopAction ur, ConopAction ua, bool bf, bool at, bool cn, bool aa, bool ch, ConopAction zo)
Definition: rule_based.hh:46
void SetUnkAtomTreatment(ConopAction action)
Definition: rule_based.hh:81
void SetFixElement(bool flag)
Definition: rule_based.hh:67