BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
UCK.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_STRUCTURE_UCK_H
6 #define BALL_STRUCTURE_UCK_H
7 
8 #ifndef BALL_DATATYPE_STRING_H
9  #include <BALL/DATATYPE/string.h>
10 #endif
11 
12 #include <vector>
13 
14 namespace BALL
15 {
16  class Molecule;
17 
23  {
24  public:
25 
28  typedef std::vector<std::pair<Size, Size> > PairVector;
29  typedef std::vector<std::vector<Size> > SizeVector;
31 
32  /* default constructor
33  */
34  UCK();
35 
36  /* constructor
37  */
38  UCK(const Molecule& mol, Size d=3);
39 
40  /* constructor added originally in CADDSuite
41  */
42  UCK(const Molecule& mol, bool ignore_hydrogens, Size d=3);
43 
44  /* copy constructor
45  */
46  UCK(UCK& uck);
47 
48  /* destructor
49  */
50  virtual ~UCK();
51 
52  /* print Uck to std::out
53  */
54  void printUCK(std::ostream& outstr);
55 
56  Size getDepth();
57 
58  const String& getFormula() const;
59 
60  const String& getUCK() const;
61 
62  const String& getId() const;
63 
64  float getWeight();
65 
66  private:
67 
68  /* variation of UCK-Algorithm:
69  * delete one occurance of the current label from the lambda string
70  * this reduces the length of the constructed string
71  */
72  String eraseDoubleLabels(const Size d, String x, String label);
73 
74  /* computes the uck
75  */
76  void makeUCK(const Molecule& m);
77 
78  /* construct graph-representation of the molecule read
79  */
80  void getGraph(std::vector<String>& v, PairVector& e, const Molecule& mol);
81 
82  /* Floyd's Algorithm
83  * find shortest paths between all pairs of nodes
84  */
85  void makePathMatrix(const PairVector& e, SizeVector& sp, const Size e_size);
86 
87  /* compute concatenated strings [lambda(a)nlambda(b)] for every pair of nodes
88  */
89  void makePairs(const std::vector<String>& lambda_map, std::vector<String>& pairs, const std::vector<vector<Size> >& sp);
90 
91  /* compute lambda-map
92  */
93  String lambda(String lambda_d, const PairVector& e, const std::vector<String>& v, Size pos, Size d);
94 
95  /* construct final UCK as follows:
96  * chemical_formula-lexicographically ordered collection of strings pair(a,b)
97  */
98  void createFinalString(const std::vector<String>& pairs);
99 
100  Size depth_;
101  String formula_;
102  String uck_str_;
103  String id_;
104  float weight_;
105  bool ignore_hydrogens_;
106  };
107 
108 }//namespace
109 #endif // BALL_STRUCTURE_UCK_H
std::vector< std::vector< Size > > SizeVector
Definition: UCK.h:29
Definition: UCK.h:22
std::vector< std::pair< Size, Size > > PairVector
Definition: UCK.h:28
#define BALL_EXPORT
Definition: COMMON/global.h:50