BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
molecularSimilarity.h
Go to the documentation of this file.
1 // ----------------------------------------------------
2 // $Maintainer: Marcel Schumann $
3 // $Authors: Marcel Schumann $
4 // ----------------------------------------------------
5 
6 // -*- Mode: C++; tab-width: 2; -*-
7 // vi: set ts=2:
8 //
9 
10 #ifndef BALL_STRUCTURE_MOLECULARSIMILARITY_H
11 #define BALL_STRUCTURE_MOLECULARSIMILARITY_H
12 
13 #ifndef BALL_COMMON_H
14 # include <BALL/common.h>
15 #endif
16 
18 #include <BALL/KERNEL/system.h>
19 
20 #ifdef BALL_HAS_OPENEYE
21  #include <oechem/mol.h>
22 #elif defined BALL_HAS_OPENBABEL
23  #include <openbabel/mol.h>
24 #endif
25 
26 
27 namespace BALL
28 {
30  {
31  public:
32 
33  MolecularSimilarity(String smarts_file);
34 
35  void generateFingerprints(System& molecules, vector<vector<Size> >& fingerprints);
36 
37  void generateFingerprints(const list<Molecule*>& molecules, vector<vector<Size> >& fingerprints);
38 
39  void generateFingerprint(Molecule& molecule, vector<Size>& fingerprint);
40 
41 
42  #ifdef BALL_HAS_OPENEYE
43  static OEChem::OEMol* createOEMol(const Molecule& mol, bool ignore_hydrogen=0);
44 
45  void generateCanSmile(const Molecule& molecule, String& cansmile, OEChem::OEMol** output_oemol=0, bool ignore_hydrogen=0);
46 
47  void generateFingerprint(OEChem::OEMol& mol, vector<Size>& fingerprint);
48  #elif defined BALL_HAS_OPENBABEL
49 
52  static OpenBabel::OBMol* createOBMol(const Molecule& mol, bool ignore_hydrogen=0, bool suppress_warning=0);
53 
55  static Molecule* createMolecule(OpenBabel::OBMol& obmol, bool ignore_hydrogen=0);
56 
57  void generateCanSmile(const Molecule& mol, String& cansmile, OpenBabel::OBMol** output_obmol=0, bool ignore_hydrogen=0);
58 
59  void generateFingerprint(OpenBabel::OBMol& mol, vector<Size>& fingerprint);
60  #endif
61 
62  #if (defined BALL_HAS_OPENEYE | defined BALL_HAS_OPENBABEL)
63 
65  void matchSmarts(const String& usmile, const String& smarts, Size& no_matches, Size max_matches=0);
66  #endif
67 
68  void generatePathFingerprint(Molecule& mol, vector<bool>& fingerprint);
69 
71  float calculateSimilarity(vector<bool>& fingerprint1, vector<bool>& fingerprint2);
72 
73  void filterRedundantMolecules(const list<Molecule*>& molecules, float similarity_threshold);
74 
75  void filterRedundantMolecules(System& molecules, float similarity_threshold);
76 
80  float calculateSimilarity(vector<Size>& fingerprint1, vector<Size>& fingerprint2, vector<float>* stddev);
81 
83  const vector<String>& getFunctionalGroupNames();
84 
85 
86  protected:
87 
88  vector<vector<Size> > fingerprints_;
89  vector<String> smarts_;
90  vector<String> smart_names_;
91 
93 
96  void generatePathHash_(vector<Size>& path, Size& hash);
97 
98  bool generatePathFingerprint_(const Atom* atom, std::vector<Size>& path, std::set<const Bond*>& path_bonds,
99  std::vector<bool>& fingerprint);
100 
101  };
102 }
103 
104 #endif
BALL_EXPORT MoleculeList molecules(const AtomContainer &fragment, bool selected_only=false)
vector< vector< Size > > fingerprints_
#define BALL_EXPORT
Definition: COMMON/global.h:50