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 
35  MolecularSimilarity(String smarts_file);
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
45 
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
BALL::SmartsMatcher
Definition: smartsMatcher.h:44
BALL::Molecule
Definition: molecule.h:29
BALL::System
Definition: KERNEL/system.h:38
BALL::Atom
Definition: atom.h:87
BALL::MolecularSimilarity::fingerprints_
vector< vector< Size > > fingerprints_
Definition: molecularSimilarity.h:84
BALL::String
Definition: string.h:56
BALL
Definition: constants.h:12
BALL::MolecularSimilarity::matcher_
SmartsMatcher matcher_
Definition: molecularSimilarity.h:88
BALL_SIZE_TYPE
common.h
BALL::molecules
BALL_EXPORT MoleculeList molecules(const AtomContainer &fragment, bool selected_only=false)
BALL::MolecularSimilarity
Definition: molecularSimilarity.h:31
smartsMatcher.h
BALL::MolecularSimilarity::smarts_
vector< String > smarts_
Definition: molecularSimilarity.h:85
BALL::MolecularSimilarity::smart_names_
vector< String > smart_names_
Definition: molecularSimilarity.h:86
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
system.h