OpenStructure
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-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_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 {
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; }
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;
63  CompoundPtr compound, bool strict_hydrogens) const;
67  mol::AtomHandle LocateAtom(const mol::AtomHandleList&, int ordinal) const;
68 public:
69  Processor(bool bf, bool at, bool cn, bool aa, bool ch, ConopAction zo):
70  check_bond_feasibility_(bf), assign_torsions_(at), connect_(cn),
71  connect_aa_(aa), connect_hetatm_(ch), zero_occ_treatment_(zo) {}
72  Processor(): check_bond_feasibility_(false),
73  assign_torsions_(true), connect_(true), connect_aa_(true),
74  connect_hetatm_(true), zero_occ_treatment_(CONOP_SILENT) {}
75 
76  void SetConnect(bool connect) {
77  connect_ = connect;
78  }
79  bool GetConnect() const {
80  return connect_;
81  }
82 
83  void SetAssignTorsions(bool flag) {
84  assign_torsions_ = flag;
85  }
86  bool GetAssignTorsions() const {
87  return assign_torsions_;
88  }
89 
90  bool GetConnectAminoAcids() const {
91  return connect_aa_;
92  }
93  void SetConnectAminoAcids(bool c) {
94  connect_aa_ = c;
95  }
96 
97  bool GetConnectHetatm() const {
98  return connect_hetatm_;
99  }
100  void SetConnectHetatm(bool c) {
101  connect_hetatm_ = c;
102  }
103 
104  bool GetCheckBondFeasibility() const {
105  return check_bond_feasibility_;
106  }
107 
108  void SetCheckBondFeasibility(bool flag) {
109  check_bond_feasibility_ = flag;
110  }
111 
113  return zero_occ_treatment_;
114  }
116  zero_occ_treatment_ = action;
117  }
118 
119  virtual String ToString() const = 0;
120 protected:
122 private:
123  bool check_bond_feasibility_;
124  bool assign_torsions_;
125  bool connect_;
126  bool connect_aa_;
127  bool connect_hetatm_;
128  ConopAction zero_occ_treatment_;
129 };
130 
132 
134 
135 
137 String DLLEXPORT_OST_CONOP GuessAtomElement(const String& atom_name, bool hetatm,
138  int atom_count);
139 
142 
150  mol::ResidueHandle res,
151  mol::ResidueHandle next);
152 
154  const mol::AtomHandle&);
157  CompoundPtr compound,
158  bool strict_hydrogens=false);
159 }}
160 
161 #endif
virtual bool BeginProcessing(DiagnosticsPtr diags, mol::EntityHandle ent) const
Definition: processor.hh:53
void SetAssignTorsions(bool flag)
Definition: processor.hh:83
DiagnosticsPtr Process(mol::EntityHandle ent, bool log_diags=true) const
void ConnectAtomsOfResidue(mol::ResidueHandle residue, CompoundPtr compound, bool strict_hydrogens) const
void DistanceBasedConnect(mol::AtomHandle atom) const
bool GetConnect() const
Definition: processor.hh:79
String OptionsToString() const
void SetConnectAminoAcids(bool c)
Definition: processor.hh:93
void SetZeroOccTreatment(ConopAction action)
Definition: processor.hh:115
void SetConnectHetatm(bool c)
Definition: processor.hh:100
bool GetAssignTorsions() const
Definition: processor.hh:86
void SetCheckBondFeasibility(bool flag)
Definition: processor.hh:108
virtual ~Processor()
Definition: processor.hh:49
bool GetCheckBondFeasibility() const
Definition: processor.hh:104
void SetConnect(bool connect)
Definition: processor.hh:76
void FillResidueProps(mol::ResidueHandle residue, CompoundPtr compound) const
virtual ProcessorPtr Copy() const =0
bool HasUnknownAtoms(mol::ResidueHandle residue, CompoundPtr compound, bool strict_hydrogens) const
virtual void DoProcess(DiagnosticsPtr diags, mol::EntityHandle ent) const =0
ConopAction GetZeroOccTreatment() const
Definition: processor.hh:112
mol::AtomHandle LocateAtom(const mol::AtomHandleList &, int ordinal) const
virtual String ToString() const =0
static bool AreResiduesConsecutive(mol::ResidueHandle a, mol::ResidueHandle b)
void ReorderAtoms(mol::ResidueHandle residue, CompoundPtr compound, bool fix_element) const
Processor(bool bf, bool at, bool cn, bool aa, bool ch, ConopAction zo)
Definition: processor.hh:69
bool GetConnectHetatm() const
Definition: processor.hh:97
bool GetConnectAminoAcids() const
Definition: processor.hh:90
virtual bool EndProcessing(DiagnosticsPtr diags, mol::EntityHandle ent) const
Definition: processor.hh:55
void ConnectResidues(mol::ResidueHandle residue, mol::ResidueHandle next) const
Handle to atom datatype.
Definition: atom_handle.hh:37
linear chain of residues
Definition: chain_handle.hh:52
Protein or molecule.
#define DLLEXPORT_OST_CONOP
std::string String
Definition: base.hh:54
String DLLIMPORT GuessAtomElement(const String &atom_name, bool hetatm, int atom_count)
guess element of atom based on name and hetatm flag
@ CONOP_REMOVE
Definition: processor.hh:36
@ CONOP_REMOVE_RESIDUE
Definition: processor.hh:38
@ CONOP_REMOVE_ATOM
Definition: processor.hh:37
@ CONOP_SILENT
Definition: processor.hh:35
boost::shared_ptr< Compound > CompoundPtr
Definition: compound.hh:144
bool DLLIMPORT IsBondFeasible(const mol::AtomHandle &, const mol::AtomHandle &)
mol::AtomHandleList DLLIMPORT GetUnknownAtomsOfResidue(mol::ResidueHandle residue, CompoundPtr compound, bool strict_hydrogens=false)
mol::ChemClass DLLIMPORT GuessChemClass(mol::ResidueHandle res)
guess chemclass based on atoms of residue
boost::shared_ptr< Diagnostics > DiagnosticsPtr
Definition: diag.hh:111
String DLLIMPORT StringFromConopAction(ConopAction action)
boost::shared_ptr< Processor > ProcessorPtr
Definition: processor.hh:42
void DLLIMPORT AssignBackboneTorsions(mol::ChainHandle chain)
assigns phi/psi/omega to all residues marked peptide-linking of the chain
@ CHARMM_DIALECT
Definition: processor.hh:30
ConopAction DLLIMPORT ConopActionFromString(const String &name)
std::vector< AtomHandle > AtomHandleList
std::vector< ResidueHandle > ResidueHandleList
Definition: base.dox:1