13#ifndef RDKIT_TAUTOMERQUERY_H
14#define RDKIT_TAUTOMERQUERY_H
22#ifdef RDK_USE_BOOST_SERIALIZATION
24#include <boost/serialization/vector.hpp>
25#include <boost/serialization/shared_ptr.hpp>
26#include <boost/serialization/split_member.hpp>
39 std::vector<ROMOL_SPTR> d_tautomers;
41 std::unique_ptr<const ROMol> d_templateMolecule;
43 std::vector<size_t> d_modifiedAtoms;
44 std::vector<size_t> d_modifiedBonds;
47 bool matchTautomer(
const ROMol &mol,
const ROMol &tautomer,
48 const std::vector<unsigned int> &match,
53 const ROMol *
const templateMolecule,
54 std::vector<size_t> modifiedAtoms,
55 std::vector<size_t> modifiedBonds);
59 : d_templateMolecule(other.d_templateMolecule
60 ? new
ROMol(*other.d_templateMolecule)
62 d_modifiedAtoms(other.d_modifiedAtoms),
63 d_modifiedBonds(other.d_modifiedBonds) {
64 PRECONDITION(other.d_templateMolecule !=
nullptr,
"Null template");
65 for (
auto taut : other.d_tautomers) {
67 d_tautomers.push_back(boost::make_shared<ROMol>(*taut));
76 const ROMol &molecule,
77 const std::string &tautomerTransformFile = std::string());
83 std::vector<ROMOL_SPTR> *matchingTautomers =
nullptr)
const;
91 unsigned int fpSize = 2048U)
const;
94 unsigned int fpSize = 2048U);
101 const std::vector<ROMOL_SPTR>
getTautomers()
const {
return d_tautomers; }
116 friend class TautomerQueryMatcher;
118#ifdef RDK_USE_BOOST_SERIALIZATION
119 template <
class Archive>
120 void save(Archive &ar,
const unsigned int version)
const {
122 std::vector<std::string> pkls;
123 for (
const auto &taut : d_tautomers) {
125 MolPickler::pickleMol(*taut, pkl, PicklerOps::AllProps);
130 MolPickler::pickleMol(*d_templateMolecule, molpkl, PicklerOps::AllProps);
132 ar << d_modifiedAtoms;
133 ar << d_modifiedBonds;
136 template <
class Archive>
137 void load(Archive &ar,
const unsigned int version) {
140 std::vector<std::string> pkls;
143 for (
const auto &pkl : pkls) {
144 d_tautomers.push_back(ROMOL_SPTR(
new ROMol(pkl)));
148 d_templateMolecule.reset(
new ROMol(molpkl));
150 ar >> d_modifiedAtoms;
151 ar >> d_modifiedBonds;
153 BOOST_SERIALIZATION_SPLIT_MEMBER()
#define RDUNUSED_PARAM(x)
#define PRECONDITION(expr, mess)
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) const
std::string serialize() const
returns a string with a serialized (pickled) representation
TautomerQuery(const TautomerQuery &other)
Copy constructor performs a deep copy.
const std::vector< size_t > getModifiedAtoms() const
const ROMol & getTemplateMolecule() const
const std::vector< size_t > getModifiedBonds() const
TautomerQuery(const std::string &pickle)
bool isSubstructOf(const ROMol &mol, const SubstructMatchParameters ¶ms=SubstructMatchParameters())
void initFromString(const std::string &text)
initializes from a string pickle
const std::vector< ROMOL_SPTR > getTautomers() const
TautomerQuery(std::vector< ROMOL_SPTR > tautomers, const ROMol *const templateMolecule, std::vector< size_t > modifiedAtoms, std::vector< size_t > modifiedBonds)
void initFromStream(std::istream &ss)
initializes from a stream pickle
static ExplicitBitVect * patternFingerprintTarget(const ROMol &target, unsigned int fpSize=2048U)
void toStream(std::ostream &ss) const
serializes (pickles) to a stream
static TautomerQuery * fromMol(const ROMol &molecule, const std::string &tautomerTransformFile=std::string())
std::vector< MatchVectType > substructOf(const ROMol &mol, const SubstructMatchParameters ¶ms=SubstructMatchParameters(), std::vector< ROMOL_SPTR > *matchingTautomers=nullptr) const
#define RDKIT_TAUTOMERQUERY_EXPORT
RDKIT_SUBSTRUCTMATCH_EXPORT std::vector< MatchVectType > SubstructMatch(const ROMol &mol, const ROMol &query, const SubstructMatchParameters ¶ms=SubstructMatchParameters())
Find a substructure match for a query in a molecule.
RDKIT_TAUTOMERQUERY_EXPORT bool TautomerQueryCanSerialize()