New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose replaceAtomWithQueryAtom to Python #7380
Conversation
Code/GraphMol/Wrap/Queries.cpp
Outdated
@@ -144,6 +144,12 @@ Ret *PropQueryWithTol(const std::string &propname, const ExplicitBitVect &v, | |||
return res; | |||
} | |||
|
|||
namespace { | |||
Atom *replaceAtomWithQueryAtomHelper(ROMol &mol, Atom &atom) { | |||
return QueryOps::replaceAtomWithQueryAtom(static_cast<RWMol *>(&mol), &atom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be useful to make a note that replaceAtomWithQueryAtom copies the atom. I'm not sure this is actually documented anywhere.
Code/GraphMol/Wrap/Queries.cpp
Outdated
|
||
std::string docString = R"DOC(Changes the given atom in the molecule to | ||
a query atom and returns the atom which can then be modified, for example | ||
with additional query contstraints added.)DOC"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contstraints => constraints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing propery -> property btw!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small doc suggestions
@@ -1099,6 +1100,8 @@ inline bool isAtomDummy(const Atom *a) { | |||
namespace QueryOps { | |||
RDKIT_GRAPHMOL_EXPORT void completeMolQueries( | |||
RWMol *mol, unsigned int magicVal = 0xDEADBEEF); | |||
// Replaces the given atom in the molecule with a QueryAtom that is otherwise | |||
// a copy of the given atom. Returns a pointer to that atom. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// a copy of the given atom. Returns a pointer to that atom. | |
// a copy of the given atom. Returns a pointer to that atom. | |
// if the atom already has a query, nothing will be changed |
Code/GraphMol/Wrap/Queries.cpp
Outdated
std::string docString = R"DOC(Changes the given atom in the molecule to | ||
a query atom and returns the atom which can then be modified, for example | ||
with additional query constraints added. The new atom is otherwise a copy | ||
of the old.)DOC"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of the old.)DOC"; | |
of the old. | |
If the atom already has a query, nothing will be changed)DOC"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reference Issue
No issue
What does this implement/fix? Explain your changes.
Exposes the QueryOps::replaceAtomWithQueryAtom to Python. At present it's available in C++ and Java/C# but not Python.
Any other comments?
As usual, the Boost::Python has been done by analogy and clueless experimentation. One day, perhaps I'll understand what I'm doing.
At the same time, fixes a recurring typo on docstrings.