-
Notifications
You must be signed in to change notification settings - Fork 845
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
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
} | ||
} | ||
|
||
struct queries_wrapper { | ||
static void wrap() { | ||
#define QADEF1(_funcname_) \ | ||
|
@@ -210,29 +216,29 @@ struct queries_wrapper { | |
|
||
python::def("HasPropQueryAtom", HasPropQueryAtom, | ||
(python::arg("propname"), python::arg("negate") = false), | ||
"Returns a QueryAtom that matches when the propery 'propname' " | ||
"Returns a QueryAtom that matches when the property 'propname' " | ||
"exists in the atom.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
||
python::def("HasPropQueryBond", HasPropQueryBond, | ||
(python::arg("propname"), python::arg("negate") = false), | ||
"Returns a QueryBond that matches when the propery 'propname' " | ||
"Returns a QueryBond that matches when the property 'propname' " | ||
"exists in the bond.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
||
python::def("HasIntPropWithValueQueryAtom", | ||
PropQueryWithTol<Atom, QueryAtom, int>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false, python::arg("tolerance") = 0), | ||
"Returns a QueryAtom that matches when the propery 'propname' " | ||
"Returns a QueryAtom that matches when the property 'propname' " | ||
"has the specified int value.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
||
python::def("HasBoolPropWithValueQueryAtom", | ||
PropQuery<Atom, QueryAtom, bool>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false), | ||
"Returns a QueryAtom that matches when the propery 'propname' " | ||
"Returns a QueryAtom that matches when the property 'propname' " | ||
"has the specified boolean" | ||
" value.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
@@ -241,7 +247,7 @@ struct queries_wrapper { | |
PropQuery<Atom, QueryAtom, std::string>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false), | ||
"Returns a QueryAtom that matches when the propery 'propname' " | ||
"Returns a QueryAtom that matches when the property 'propname' " | ||
"has the specified string " | ||
"value.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
@@ -250,7 +256,7 @@ struct queries_wrapper { | |
PropQueryWithTol<Atom, QueryAtom, double>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false, python::arg("tolerance") = 0.0), | ||
"Returns a QueryAtom that matches when the propery 'propname' " | ||
"Returns a QueryAtom that matches when the property 'propname' " | ||
"has the specified " | ||
"value +- tolerance", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
@@ -259,7 +265,7 @@ struct queries_wrapper { | |
PropQueryWithTol<Atom, QueryAtom>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false, python::arg("tolerance") = 0), | ||
"Returns a QueryAtom that matches when the propery 'propname' " | ||
"Returns a QueryAtom that matches when the property 'propname' " | ||
"has the specified explicit bit vector" | ||
" value. The Tolerance is the allowed Tanimoto difference", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
@@ -268,29 +274,29 @@ struct queries_wrapper { | |
// Bond Queries | ||
python::def("HasPropQueryBond", HasPropQueryBond, | ||
(python::arg("propname"), python::arg("negate") = false), | ||
"Returns a QueryBond that matches when the propery 'propname' " | ||
"Returns a QueryBond that matches when the property 'propname' " | ||
"exists in the bond.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
||
python::def("HasPropQueryBond", HasPropQueryBond, | ||
(python::arg("propname"), python::arg("negate") = false), | ||
"Returns a QueryBond that matches when the propery 'propname' " | ||
"Returns a QueryBond that matches when the property 'propname' " | ||
"exists in the bond.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
||
python::def("HasIntPropWithValueQueryBond", | ||
PropQueryWithTol<Bond, QueryBond, int>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false, python::arg("tolerance") = 0), | ||
"Returns a QueryBond that matches when the propery 'propname' " | ||
"Returns a QueryBond that matches when the property 'propname' " | ||
"has the specified int value.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
||
python::def("HasBoolPropWithValueQueryBond", | ||
PropQuery<Bond, QueryBond, bool>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false), | ||
"Returns a QueryBond that matches when the propery 'propname' " | ||
"Returns a QueryBond that matches when the property 'propname' " | ||
"has the specified boolean" | ||
" value.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
@@ -299,7 +305,7 @@ struct queries_wrapper { | |
PropQuery<Bond, QueryBond, std::string>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false), | ||
"Returns a QueryBond that matches when the propery 'propname' " | ||
"Returns a QueryBond that matches when the property 'propname' " | ||
"has the specified string " | ||
"value.", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
@@ -308,10 +314,17 @@ struct queries_wrapper { | |
PropQueryWithTol<Bond, QueryBond, double>, | ||
(python::arg("propname"), python::arg("val"), | ||
python::arg("negate") = false, python::arg("tolerance") = 0.0), | ||
"Returns a QueryBond that matches when the propery 'propname' " | ||
"Returns a QueryBond that matches when the property 'propname' " | ||
"has the specified " | ||
"value +- tolerance", | ||
python::return_value_policy<python::manage_new_object>()); | ||
|
||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for fixing propery -> property btw! |
||
python::def("ReplaceAtomWithQueryAtom", replaceAtomWithQueryAtomHelper, | ||
(python::arg("mol"), python::arg("atom")), docString.c_str(), | ||
python::return_value_policy<python::reference_existing_object>()); | ||
}; | ||
}; | ||
} // namespace RDKit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.