Skip to content
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

Merged
merged 4 commits into from May 7, 2024

Conversation

DavidACosgrove
Copy link
Collaborator

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.

@@ -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);
Copy link
Contributor

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.


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";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contstraints => constraints

Copy link
Contributor

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!

Copy link
Member

@greglandrum greglandrum left a 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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

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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
of the old.)DOC";
of the old.
If the atom already has a query, nothing will be changed)DOC";

@greglandrum greglandrum added this to the 2024_03_3 milestone Apr 30, 2024
Copy link
Member

@greglandrum greglandrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@greglandrum greglandrum merged commit f48c874 into rdkit:master May 7, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants