BALL  1.5.0
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 
17 #ifndef BALL_CONFIG_CONFIG_H
18  #include <BALL/CONFIG/config.h>
19 #endif
20 
22 #include <BALL/KERNEL/system.h>
23 
24 #ifdef BALL_HAS_OPENBABEL
25  #include <openbabel/mol.h>
26 #endif
27 
28 
29 namespace BALL
30 {
32  {
33  public:
34 
36 
37  void generateFingerprints(System& molecules, vector<vector<Size> >& fingerprints);
38 
39  void generateFingerprints(const list<Molecule*>& molecules, vector<vector<Size> >& fingerprints);
40 
41  void generateFingerprint(Molecule& molecule, vector<Size>& fingerprint);
42 
43 
44  #ifdef BALL_HAS_OPENBABEL
49  static OpenBabel::OBMol* createOBMol(const Molecule& mol, bool ignore_hydrogen=0, bool suppress_warning=0);
50 
53  static Molecule* createMolecule(OpenBabel::OBMol& obmol, bool ignore_hydrogen=0);
54 
55  void generateCanSmile(const Molecule& mol, String& cansmile, OpenBabel::OBMol** output_obmol=0, bool ignore_hydrogen=0);
56 
61  void matchSmarts(const String& usmile, const String& smarts, Size& no_matches, Size max_matches=0);
62  #endif
63 
64  void generatePathFingerprint(Molecule& mol, vector<bool>& fingerprint);
65 
67  float calculateSimilarity(vector<bool>& fingerprint1, vector<bool>& fingerprint2);
68 
69  void filterRedundantMolecules(const list<Molecule*>& molecules, float similarity_threshold);
70 
71  void filterRedundantMolecules(System& molecules, float similarity_threshold);
72 
76  float calculateSimilarity(vector<Size>& fingerprint1, vector<Size>& fingerprint2, vector<float>* stddev);
77 
79  const vector<String>& getFunctionalGroupNames();
80 
81 
82  protected:
83 
84  vector<vector<Size> > fingerprints_;
85  vector<String> smarts_;
86  vector<String> smart_names_;
87 
89 
92  void generatePathHash_(vector<Size>& path, Size& hash);
93 
94  bool generatePathFingerprint_(const Atom* atom, std::vector<Size>& path, std::set<const Bond*>& path_bonds,
95  std::vector<bool>& fingerprint);
96 
97  };
98 }
99 
100 #endif
Definition: constants.h:13
BALL_EXPORT MoleculeList molecules(const AtomContainer &fragment, bool selected_only=false)
void generatePathFingerprint(Molecule &mol, vector< bool > &fingerprint)
void filterRedundantMolecules(const list< Molecule * > &molecules, float similarity_threshold)
vector< vector< Size > > fingerprints_
void generateFingerprints(const list< Molecule * > &molecules, vector< vector< Size > > &fingerprints)
void generatePathHash_(vector< Size > &path, Size &hash)
MolecularSimilarity(String smarts_file)
bool generatePathFingerprint_(const Atom *atom, std::vector< Size > &path, std::set< const Bond * > &path_bonds, std::vector< bool > &fingerprint)
void generateFingerprint(Molecule &molecule, vector< Size > &fingerprint)
float calculateSimilarity(vector< bool > &fingerprint1, vector< bool > &fingerprint2)
const vector< String > & getFunctionalGroupNames()
void filterRedundantMolecules(System &molecules, float similarity_threshold)
void generateFingerprints(System &molecules, vector< vector< Size > > &fingerprints)
float calculateSimilarity(vector< Size > &fingerprint1, vector< Size > &fingerprint2, vector< float > *stddev)
#define BALL_EXPORT
Definition: COMMON/global.h:50