OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
processor.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_PROCESSOR_HH
20 #define OST_CONOP_PROCESSOR_HH
21 
22 #include <ost/mol/entity_handle.hh>
23 #include "module_config.hh"
24 #include "diag.hh"
25 #include "compound.hh"
26 namespace ost { namespace conop {
27 
28 typedef enum {
31 } Dialect;
32 
40 };
41 
42 class Processor;
43 typedef boost::shared_ptr<Processor> ProcessorPtr;
44 // the base class for all options
46 public:
47  DiagnosticsPtr Process(mol::EntityHandle ent, bool log_diags=true) const;
48  virtual ProcessorPtr Copy() const = 0;
49  virtual ~Processor() {}
50 protected:
51  virtual void DoProcess(DiagnosticsPtr diags,
52  mol::EntityHandle ent) const = 0;
53  virtual bool BeginProcessing(DiagnosticsPtr diags,
54  mol::EntityHandle ent) const { return true; }
55  virtual bool EndProcessing(DiagnosticsPtr diags,
56  mol::EntityHandle ent) const { return true; }
57  bool HasUnknownAtoms(mol::ResidueHandle residue, CompoundPtr compound,
58  bool strict_hydrogens) const;
59  void ReorderAtoms(mol::ResidueHandle residue, CompoundPtr compound,
60  bool fix_element) const;
61  void FillResidueProps(mol::ResidueHandle residue, CompoundPtr compound) const;
62  void ConnectAtomsOfResidue(mol::ResidueHandle residue,
63  CompoundPtr compound, bool strict_hydrogens) const;
64  void ConnectResidues(mol::ResidueHandle residue, mol::ResidueHandle next) const;
65  static bool AreResiduesConsecutive(mol::ResidueHandle a, mol::ResidueHandle b);
66  void DistanceBasedConnect(mol::AtomHandle atom) const;
67  mol::AtomHandle LocateAtom(const mol::AtomHandleList&, int ordinal) const;
68 public:
69  Processor(bool bf, bool at, bool cn, bool aa, ConopAction zo): check_bond_feasibility_(bf),
70  assign_torsions_(at), connect_(cn), connect_aa_(aa),
71  zero_occ_treatment_(zo) {}
72  Processor(): check_bond_feasibility_(false),
73  assign_torsions_(true), connect_(true), connect_aa_(true),
74  zero_occ_treatment_(CONOP_SILENT) {}
75  void SetConnect(bool connect) {
76  connect_ = connect;
77  }
78 
79  bool GetConnect() const {
80  return connect_;
81  }
82  void SetAssignTorsions(bool flag) {
83  assign_torsions_ = flag;
84  }
85  bool GetAssignTorsions() const {
86  return assign_torsions_;
87  }
88 
89  bool GetConnectAminoAcids() const {
90  return connect_aa_;
91  }
92  void SetConnectAminoAcids(bool c) {
93  connect_aa_ = c;
94  }
95  bool GetCheckBondFeasibility() const {
96  return check_bond_feasibility_;
97  }
98 
99 
100  void SetCheckBondFeasibility(bool flag) {
101  check_bond_feasibility_ = flag;
102  }
103 
104 
106  return zero_occ_treatment_;
107  }
108 
110  zero_occ_treatment_ = action;
111  }
112  virtual String ToString() const = 0;
113 protected:
114  String OptionsToString() const;
115 private:
116  bool check_bond_feasibility_;
117  bool assign_torsions_;
118  bool connect_;
119  bool connect_aa_;
120  ConopAction zero_occ_treatment_;
121 };
122 
124 
126 
127 
129 String DLLEXPORT_OST_CONOP GuessAtomElement(const String& atom_name, bool hetatm,
130  int atom_count);
131 
134 
142  mol::ResidueHandle res,
143  mol::ResidueHandle next);
144 
146  const mol::AtomHandle&);
149  CompoundPtr compound,
150  bool strict_hydrogens=false);
151 }}
152 
153 #endif