Extra explanation of getPosition() and getReagents(). (#8909)

This commit is contained in:
David Cosgrove
2025-11-01 05:18:08 +00:00
committed by GitHub
parent c4678568a9
commit b9b6078137
3 changed files with 21 additions and 9 deletions

View File

@@ -127,7 +127,8 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerateLibrary
const EnumerationParams &params = EnumerationParams());
EnumerateLibrary(const EnumerateLibrary &rhs);
//! Return the reagents used in the library
//! Return the reagents used in the library. This may be fewer reagents than
// the input as it is only those compatible with the reaction.
const EnumerationTypes::BBS &getReagents() const { return m_bbs; }
//! Get the next product set

View File

@@ -122,7 +122,9 @@ class RDKIT_CHEMREACTIONS_EXPORT EnumerateLibraryBase {
/// Each result vector corresponds for a product template.
virtual std::vector<std::vector<std::string>> nextSmiles();
//! Get the current position into the reagent vectors
//! Get the current position into the reagent vectors as returned by
/// getReagents. It is not necessarily the index into the input reagents
/// as it is only for the reagents compatible with the reaction.
/// Use getState/setState to save/restart the enumeration
/// from this position.
const EnumerationTypes::RGROUPS &getPosition() const;

View File

@@ -170,7 +170,10 @@ struct enumeration_wrapper {
"Inititialize the library from a binary string")
.def(
"GetPosition", &RDKit::EnumerateLibraryBase::getPosition,
"Returns the current enumeration position into the reagent vectors",
"Returns the current enumeration position into the reagent vectors, as"
" returned by GetReagents(). They do not necessarily refer to"
" the input reagent sets as they only refer to reagents compatible"
" with the reaction.",
python::return_internal_reference<
1, python::with_custodian_and_ward_postcall<0, 1>>(),
python::args("self"))
@@ -308,11 +311,14 @@ for result in itertools.islice(libary2, 1000):\n\
python::optional<const RDKit::EnumerationParams &>>(
python::args("self", "rxn", "reagents", "enumerator", "params")))
.def("GetReagents", &RDKit::EnumerateLibrary::getReagents,
"Return the reagents used in this library.",
python::return_internal_reference<
1, python::with_custodian_and_ward_postcall<0, 1>>(),
python::args("self"));
.def(
"GetReagents", &RDKit::EnumerateLibrary::getReagents,
"Return the reagents used in this library. These are the subset"
" of the input reagents that are compatible with the reaction so may"
" be smaller than the input reagent sets.",
python::return_internal_reference<
1, python::with_custodian_and_ward_postcall<0, 1>>(),
python::args("self"));
// iterator_wrappers<EnumerateLibrary>().wrap("EnumerateLibraryIterator");
@@ -342,7 +348,10 @@ for result in itertools.islice(libary2, 1000):\n\
"strategy.\n"
"Note that some strategies are effectively infinite.")
.def("GetPosition", &EnumerationStrategyBase::getPosition,
"Return the current indices into the arrays of reagents",
"Return the current indices into the arrays of reagents, as"
" returned by GetReagents(). They do not necessarily refer to"
" the input reagent sets as they only refer to reagents compatible"
" with the reaction.",
python::return_internal_reference<
1, python::with_custodian_and_ward_postcall<0, 1>>(),
python::args("self"))