OpenStructure
heuristic_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_HEURISTIC_BUILDER_HH
20 #define OST_CONOP_HEURISTIC_BUILDER_HH
21 
22 #include <set>
23 #include <map>
24 
25 #include <ost/mol/chem_class.hh>
26 
27 #include "builder.hh"
28 
29 namespace ost { namespace conop {
30 
31 namespace detail {
32 
33 // internally used class
35 public:
36  typedef std::pair<String,String> NamePair;
37  typedef std::multiset<NamePair> PairSet;
38  struct TorsionEntry {
39  String a[4];
41  };
42  typedef std::vector<TorsionEntry> TorsionEntryList;
43 
44 public:
45  ConnResEntry(const String& rname="", char single='\0',
47  int Check(const String& name1, const String& name2) const;
48  bool HasAtom(const String& name);
49  void AddAtom(const String& atom) { required_atoms_.push_back(atom); }
50  void AddConn(const String& n1, const String& n2);
51  void AddTors(const String& a1, const String& a2,
52  const String& a3, const String& a4, const String& name);
53  void SetPrev(const String& n);
54  const String& GetPrev() const;
55  void SetNext(const String& n);
56  const String& GetNext() const;
57  TorsionEntryList GetTorsionList() const;
58  char GetOneLetterCode() const {return abbrev_;}
59  mol::ChemClass GetChemClass() const { return chem_class_; }
60 
61  std::vector<String> GetReqAtoms() const { return required_atoms_;}
62 private:
63  mol::ResidueKey rkey_;
64  char abbrev_;
65  mol::ChemClass chem_class_;
66  PairSet pset_;
67  String prev_;
68  String next_;
69  std::vector<String> required_atoms_;
70  TorsionEntryList torsion_entry_list_;
71 };
72 
73 typedef std::map<mol::ResidueKey,ConnResEntry> ConnResEntryMap;
74 
75 } // ns
76 
78 public:
80  virtual ~HeuristicBuilder();
81 
82  virtual void AssignTorsions(mol::ChainHandle ch);
83 
85  //
86  // This does not make any assumption on the correctness of internal or external
87  // coordinates. Only the atom names and residue need to be known.
88  virtual void ConnectAtomsOfResidue(mol::ResidueHandle rh);
89 
90  virtual bool IsResidueComplete(const mol::ResidueHandle& rh);
91 // virtual char GetOneLetterCode(const mol::ResidueKey& residue) const;
92 
94  virtual void ConnectResidueToPrev(mol::ResidueHandle rh,
95  mol::ResidueHandle prev);
97  virtual void AssignTorsionsToResidue(mol::ResidueHandle residue);
98 
99  virtual void FillResidueProps(mol::ResidueHandle residue);
100 
102  virtual void ConnectResidueToNext(mol::ResidueHandle rh,
103  mol::ResidueHandle next);
104 
106  // Retrieve connectiviy information based on residue key. The returned
107  // \c pair->second is true, if an entry has been found and and false otherwise.
108  std::pair<detail::ConnResEntry,bool> LookupResEntry(const mol::ResidueKey& key);
109 
110  virtual void FillAtomProps(mol::AtomHandle atom);
111 protected:
112  void ConnectivityFromAtomNames(const mol::ResidueHandle& res,
113  detail::ConnResEntry& centry,
114  mol::AtomHandleList& unknown_atoms);
115 private:
117 };
118 
119 
120 }} // ns
121 
122 #endif