minilib functions exposure: mmpa (#6902)

* MMPA functions exposure

* Minilib exposure: mmp

* minilib: mmpa - test added

* minilib: mmpa - failing test added

* - MolList should return null when the corresponding ROMOL_SPTR is a nullptr
- changed first into cores
- changed second into sidechains
- renamed some functions and constants

* - made JSMolList::at() and JSMolList::pop() robust against attempting to dereference null ROMOL_SPTR
- added tests for the above

* Update Code/MinimalLib/minilib.h

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>

* changes after review

* Update Code/MinimalLib/minilib.cpp

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
This commit is contained in:
Leonid Stolbov
2023-12-04 22:31:49 +03:00
committed by GitHub
parent 9e2bfca876
commit 4ab18ae0ea
5 changed files with 157 additions and 7 deletions

View File

@@ -372,6 +372,17 @@ emscripten::val get_avalon_fp_as_uint8array(const JSMol &self) {
}
#endif
#ifdef RDK_BUILD_MINIMAL_LIB_MMPA
emscripten::val get_mmpa_frags_helper(const JSMol &self, unsigned int minCuts,
unsigned int maxCuts,
unsigned int maxCutBonds) {
auto obj = emscripten::val::object();
auto pairs = self.get_mmpa_frags(minCuts, maxCuts, maxCutBonds);
obj.set("cores", pairs.first);
obj.set("sidechains", pairs.second);
return obj;
}
#endif
} // namespace
using namespace emscripten;
@@ -564,7 +575,13 @@ EMSCRIPTEN_BINDINGS(RDKit_minimal) {
.function("get_num_atoms",
select_overload<unsigned int() const>(&JSMol::get_num_atoms))
.function("get_num_bonds", &JSMol::get_num_bonds)
;
#ifdef RDK_BUILD_MINIMAL_LIB_MMPA
.function("get_mmpa_frags",
select_overload<emscripten::val(const JSMol &, unsigned int,
unsigned int, unsigned int)>(
get_mmpa_frags_helper))
#endif
;
class_<JSMolList>("MolList")
.constructor<>()