RDKit
Open-source cheminformatics and machine learning.
TautomerQuery.h
Go to the documentation of this file.
1 //
2 // Created by Gareth Jones on 5/7/2020.
3 //
4 // Copyright 2020 Schrodinger, Inc
5 // @@ All Rights Reserved @@
6 // This file is part of the RDKit.
7 // The contents are covered by the terms of the BSD license
8 // which is included in the file license.txt, found at the root
9 // of the RDKit source tree.
10 
11 #include <RDGeneral/export.h>
12 
13 #ifndef RDKIT_TAUTOMERQUERY_H
14 #define RDKIT_TAUTOMERQUERY_H
15 
16 #include <GraphMol/ROMol.h>
17 #include <vector>
20 
21 
22 namespace RDKit {
23 
24 class RWMol;
25 
27  private:
28  // Tautomers of the query
29  const std::vector<ROMOL_SPTR> d_tautomers;
30  // Template query for substructure search
31  const ROMol *const d_templateMolecule;
32  // Tautomeric bonds and atoms
33  const std::vector<size_t> d_modifiedAtoms;
34  const std::vector<size_t> d_modifiedBonds;
35 
36  TautomerQuery(const std::vector<ROMOL_SPTR> &tautomers,
37  const ROMol *const templateMolecule,
38  const std::vector<size_t> &modifiedAtoms,
39  const std::vector<size_t> &modifiedBonds);
40 
41  // tests if a match to the template matches a specific tautomer
42  bool matchTautomer(const ROMol &mol, const ROMol &tautomer,
43  const std::vector<unsigned int> &match,
44  const SubstructMatchParameters &params) const;
45 
46  public:
47  // Factory to build TautomerQuery
48  // Caller owns the memory
50  const ROMol &molecule,
51  const std::string &tautomerTransformFile = std::string());
52 
53  // Substructure search
54  std::vector<MatchVectType> substructOf(
55  const ROMol &mol,
57  std::vector<ROMOL_SPTR> *matchingTautomers = nullptr) const;
58 
59  // SubstructureMatch
60  bool isSubstructOf(const ROMol &mol, const SubstructMatchParameters &params =
62 
63  // Query fingerprint
64  ExplicitBitVect *patternFingerprintTemplate(unsigned int fpSize = 2048U);
65 
66  // Static method to Fingerprint a target
68  unsigned int fpSize = 2048U);
69 
70  // accessors
71 
72  // pointer is owned by TautomerQuery
73  const ROMol & getTemplateMolecule() const { return *d_templateMolecule; }
74 
75  const std::vector<ROMOL_SPTR> getTautomers() const { return d_tautomers; }
76 
77  const std::vector<size_t> getModifiedAtoms() const { return d_modifiedAtoms; }
78 
79  const std::vector<size_t> getModifiedBonds() const { return d_modifiedBonds; }
80 
82 
83  friend class TautomerQueryMatcher;
84 };
85 
86 // so we can use the templates in Code/GraphMol/Substruct/SubstructMatch.h
87 RDKIT_TAUTOMERQUERY_EXPORT std::vector<MatchVectType> SubstructMatch(
88  const ROMol &mol, const TautomerQuery &query,
89  const SubstructMatchParameters &params);
90 
91 } // namespace RDKit
92 
93 #endif // RDKIT_TAUTOMERQUERY_H
Defines the primary molecule class ROMol as well as associated typedefs.
a class for bit vectors that are densely occupied
ExplicitBitVect * patternFingerprintTemplate(unsigned int fpSize=2048U)
static TautomerQuery * fromMol(const ROMol &molecule, const std::string &tautomerTransformFile=std::string())
bool isSubstructOf(const ROMol &mol, const SubstructMatchParameters &params=SubstructMatchParameters())
std::vector< MatchVectType > substructOf(const ROMol &mol, const SubstructMatchParameters &params=SubstructMatchParameters(), std::vector< ROMOL_SPTR > *matchingTautomers=nullptr) const
const ROMol & getTemplateMolecule() const
Definition: TautomerQuery.h:73
static ExplicitBitVect * patternFingerprintTarget(const ROMol &target, unsigned int fpSize=2048U)
const std::vector< ROMOL_SPTR > getTautomers() const
Definition: TautomerQuery.h:75
const std::vector< size_t > getModifiedBonds() const
Definition: TautomerQuery.h:79
const std::vector< size_t > getModifiedAtoms() const
Definition: TautomerQuery.h:77
#define RDKIT_TAUTOMERQUERY_EXPORT
Definition: export.h:775
Std stuff.
Definition: Abbreviations.h:17
RDKIT_SUBSTRUCTMATCH_EXPORT std::vector< MatchVectType > SubstructMatch(const ROMol &mol, const ROMol &query, const SubstructMatchParameters &params=SubstructMatchParameters())
Find a substructure match for a query in a molecule.