Some miscellaneous MinimalLib enhancements (#4169)

* - expose SubstructureLibrary to MinimalLib
- expose acceptFailure flag to MinimalLib generate_aligned_coords
- expose merge_query_hs functionality to MinimalLib
- expose kekulize flag to MinimalLib get_mol
- add relevant JS tests

* integrates previous commit

* changes in response to review

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
This commit is contained in:
Paolo Tosco
2021-05-29 06:23:08 +02:00
committed by GitHub
parent e1b5bc76b0
commit a908e616b3
7 changed files with 476 additions and 28 deletions

View File

@@ -88,6 +88,10 @@ std::string draw_to_canvas_with_highlights(JSMol &self, emscripten::val canvas,
return "";
}
JSMol *get_mol_no_details(const std::string &input) {
return get_mol(input, std::string());
}
} // namespace
using namespace emscripten;
@@ -138,6 +142,9 @@ EMSCRIPTEN_BINDINGS(RDKit_minimal) {
.function("generate_aligned_coords",
select_overload<std::string(const JSMol &, bool, bool)>(
&JSMol::generate_aligned_coords))
.function("generate_aligned_coords",
select_overload<std::string(const JSMol &, bool, bool, bool)>(
&JSMol::generate_aligned_coords))
.function("condense_abbreviations",
select_overload<std::string()>(&JSMol::condense_abbreviations))
.function("condense_abbreviations",
@@ -146,9 +153,34 @@ EMSCRIPTEN_BINDINGS(RDKit_minimal) {
.function("add_hs", &JSMol::add_hs)
.function("remove_hs", &JSMol::remove_hs);
class_<JSSubstructLibrary>("SubstructLibrary")
.constructor<>()
.constructor<unsigned int>()
.function("add_mol", &JSSubstructLibrary::add_mol)
.function("add_smiles", &JSSubstructLibrary::add_smiles)
.function("add_trusted_smiles", &JSSubstructLibrary::add_trusted_smiles)
.function("get_mol", &JSSubstructLibrary::get_mol, allow_raw_pointers())
.function(
"get_matches",
select_overload<std::string(const JSMol &, bool, int, int) const>(
&JSSubstructLibrary::get_matches))
.function("get_matches",
select_overload<std::string(const JSMol &, int) const>(
&JSSubstructLibrary::get_matches))
.function("get_matches",
select_overload<std::string(const JSMol &) const>(
&JSSubstructLibrary::get_matches))
.function("count_matches",
select_overload<unsigned int(const JSMol &, bool, int) const>(
&JSSubstructLibrary::count_matches))
.function("count_matches",
select_overload<unsigned int(const JSMol &) const>(
&JSSubstructLibrary::count_matches));
function("version", &version);
function("prefer_coordgen", &prefer_coordgen);
function("get_inchikey_for_inchi", &get_inchikey_for_inchi);
function("get_mol", &get_mol, allow_raw_pointers());
function("get_mol", &get_mol_no_details, allow_raw_pointers());
function("get_qmol", &get_qmol, allow_raw_pointers());
}