Commit Graph

64 Commits

Author SHA1 Message Date
Paolo Tosco
e4f4644a89 - Expose multicolor highlights to MinimalLib (#7787) 2024-09-03 21:03:40 +02:00
Paolo Tosco
752e9e8182 JSMol, where the underlying RWMol is stored as a unique_ptr, is now complemented by JSMolShared, where the underlying RWMol is stored as ROMOL_SPTR; both classes inherit from JSMolBase (#7744)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-08-23 13:49:00 +02:00
Paolo Tosco
6ad31c6e8a expose two additional boolean flags for mol creation to MinimalLib (CFFI, JS), assignChiralTypesFromMolParity and makeDummiesQueries, both defaulting to false (#7743)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-08-23 05:13:34 +02:00
Paolo Tosco
1bd39b2ad2 only test InChI functionality if it was built into JS MinimalLib (#7706)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-08-13 06:02:49 +02:00
Paolo Tosco
a0da0b16d4 - fix misformatted molblock and make sure unit test is actually executed (#7647)
- consolidate two neighboring if clauses into one

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-07-23 08:37:44 +02:00
Paolo Tosco
50aea5cf62 Fix issues arising from useMolBlockWedging and the new atropisomer kekulization code (#7540)
* - When depictions are made using the useMolBlockWedging flag, make sure that kekulization is done after original wedging has been applied to reduce the odds that bond wedges are placed on double bonds
- Refactored MinimalLib code to avoid code duplication
- get_molblock() should reapplyMolBlockWedging on a copy of the passed molecule rather than on the original
- Added unit tests

* Update Code/MinimalLib/jswrapper.cpp

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

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-06-20 19:32:41 +02:00
Syed Zayyan Masud
c2369f9041 Update MinimalLib for Function Exposure: runReactants (#7210) 2024-05-09 19:30:49 +02:00
Paolo Tosco
2bb8952d7b Added JSON parameters to MinimalLib get_(cx)?sm(ile|art)s() functions (#7194)
* - renamed getParamsFromJSON() to updateSmilesWriteParamsFromJSON() and moved it from the anonymous namespace to the RDKit namespace such that it is publicly available
- implemented updateCXSmilesFieldsAndRestoreBondDirOptionFromJSON()
- added CFFI and JS tests
- get_smiles(), get_smarts(), get_cxsmiles() and get_cxsmarts() are now available in MinimalLib in both CFFI and JS layers and they can be passed JSON parameters
- CFFI get_qmol() now returns NULL if it fails to generate a RWMol rather than returning the "Error!" const char[] string, for consistency with what get_mol() and get_rxn() do. This was documented in release notes

* suggestions

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-04-18 06:28:36 +02:00
Benoît Claveau
d54dd73d7b feat(minilib): expose the options parameter in get_inchi (#7240)
* feat(minilib): expose the options parameter in get_inchi

* feat(cffi): add parse_inchi_options to avoid duplicated code

---------

Co-authored-by: Benoît Claveau <benoit.claveau@iktos.com>
2024-03-16 06:05:44 +01:00
Paolo Tosco
a4c9ef9e56 Fix #7157 (#7166)
* - fix #7157
- add the assignCIPLabels flag to MinimalLib's mol_from_input()
- added cffi and JS tests
- refactored process_details(), process_mol_details() and process_rxn_details() to take a struct reference as parameter rather than a long list of parameters
- this also allowed to get rid of one of the ugly GET_JSON macros
- exposed panelWidth, panelHeight and noFreetype (the latter is useful for testing)
- made width and height to default to -1 in mol_to_svg since we now support flexicanvas

* added a bunch of assignments I'd forgotten in the deprecated process_mol_details() overload

* MSVC does not like inner functions

* updated docstrings

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-02-22 13:31:30 +01:00
Leonid Stolbov
4ab18ae0ea 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>
2023-12-04 20:31:49 +01:00
Paolo Tosco
08cc96336c Enable chemist-friendly depiction of R-groups (#6866)
* - added a convenience function to relabel R-groups in a chemist-friendly fashion
- exposed functionality to MinimalLib through a JSON option at molecule creation time
- added relevant unit tests

* changes in response to review

* added missing library

* fixed Python test

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-11-11 07:16:54 +01:00
Paolo Tosco
30d57ebcaa Implement MinimalLib get_mcs() version that returns JSON (#6812)
* - added StoreAll to parseMCSParametersJSON()
- added get_mcs() to MinimalLib which returns results as JSON
- added tests for get_mcs()

* added test

* changes in response to review

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-10-22 05:22:14 +02:00
Greg Landrum
036f75bca3 Removed some code duplication between Depictor.cpp and common.h (#6799)
* Revert "Revert "Removed some code duplication between Depictor.cpp and common.h (#6368)" (#6797)"

This reverts commit 824616c5b9.

* security blanket: add back tests of the current usage pattern

* - fixed bug in get_sss_json() (#6806)

- added unit test for the above

Co-authored-by: ptosco <paolo.tosco@novartis.com>

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-10-18 04:04:45 +02:00
Greg Landrum
824616c5b9 Revert "Removed some code duplication between Depictor.cpp and common.h (#6368)" (#6797)
This reverts commit ddfe708b37.
2023-10-11 06:42:27 +02:00
Paolo Tosco
ddfe708b37 Removed some code duplication between Depictor.cpp and common.h (#6368)
* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true)   to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications

* Fix chirality handling when the chiral atom is the first one in a SMARTS (#6730)

* Set _SmilesStart when parsing SMARTS.

* SmartsWriter should also invert first atoms, like SMILES.

* Update test cases now these SMILES match themselves as SMARTS.

* rerun bison

* cleanup a possible repeated define

* When an atom moves from the first to second position winding should flip in SMARTS (i.e. same as SMILES).

---------

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

* Some small cleanups from the UGM Hackathon (#6744)

* move definition of a couple global constants from a .h to a .cpp

* careful removal of some redundant atom PRECONDITIONS

* careful remove of some redundant ROMol PRECONDITIONS
a bit of additional cleanup

* optimization masquerading as modernization

* some more tidying

* a bit more atom cleanup

* change in response to review

* Fixes #6756 (#6780)

* update release notes and cmakelists for beta (#6788)

* move problematic functions to Chirality namespace

* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true)   to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications

* move problematic functions to Chirality namespace

* added missing dependency

* let's check what is going wrong

* CoordGen tests should not run if CoordGen support is not available in the build

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
Co-authored-by: John Mayfield <john@nextmovesoftware.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-10-11 06:41:37 +02:00
Paolo Tosco
1d9be05a08 fixes failing flexicanvas JS test (#6712) 2023-09-15 09:04:23 +02:00
Paolo Tosco
80eca32b76 - exposed to CFFI and JS MinimalLib functionality to capture RDKit logs with two modalities: (#6628)
1. tee: the log is captured in a buffer but also sent to the native output channel
  2. capture: the log is captured in a buffer without being sent to the native output channel
- removed duplicate logging_needs_init and needs_init atomic bool variables from cffiwrapper.cpp and consolidated them into a static LoggingFlag d_loggingNeedsInit class variable
- added relevant C and JS tests

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-08-22 17:06:43 +02:00
Paolo Tosco
867e647f83 Exposed partial sanitization options to MinimalLib (both JS and CFFI), namely: (#6519)
- setAromaticity (defaults to true)
- fastFindRings (defaults to true; only used when sanitize=false)
- assignStereo (defaults to true)
These options avoid doing unnecessary work when the molecule is only used for specific purposes (e.g., computing FPs or doing substructure searches)

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-07-14 07:59:05 +02:00
Paolo Tosco
e0c364bf00 get tests to work when building without exception support (i.e., legacy pure JS library) (#6487)
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-24 07:48:49 +02:00
Paolo Tosco
13a2c9ecb0 Deprecate JSMol::is_valid() and JSReaction::is_valid() and return nullptr instead (#6392)
* - deprecate JSMol::is_valid() and JSReaction::is_valid()
- methods returning JSMol and JSReaction objects now return nullptr upon failure rather than an invalid object

* changes in response to review

* unexposed JSReaction::is_valid given it was not exposed before this PR

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-08 05:28:46 +02:00
Paolo Tosco
312fa9a703 Optionally expose MCS to JS and extend optional compilation to JSReaction and JSSubstructLibrary (#6409)
* reverted all changes that did not really belong to this PR

* I had forgotten ChemReactions_static

* changes in response to review

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-07 12:35:55 +02:00
Paolo Tosco
f9f23a569c Enable using JSSubstructLibrary without pattern fps (#6431)
* - enable using JSSubstructLibrary with no fp by passing num_bits 0
- get rid of dynamic_cast which never looks great
- add unit tests for no-fingerprint JSSubstructLibrary

* change in response to review

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-07 06:41:45 +02:00
Paolo Tosco
96c8279207 JS: Implement in-place aromatisation/kekulisation and avoid undesired exception (#6407)
* - implemented in-place aromatisation/kekulisation
- avoid that attempting to aromatise a query mol throws an exception due calcImplicitValence() not having been called
- add unit tests for the above

* change in response to review

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-07 06:40:01 +02:00
Paolo Tosco
c996d88bcf Fixes some issues in the SubstructLibrary JS implementation (#6385)
* Fixes some issues in the SubstructLibrary JS implementation
- FastFindRings() was not being called
- a count_matches() overload was missing
- count_matches() was ignoring the numThreads parameter
- adding a PatternFingerprintMol created with a certain number of bits to the PatternHolder will *not* work: one needs to create the PatternHolder with the desired number of bits, and then call makeFingerprint
- improved tests to make sure the library actually behaves as expected

* added functionality to serialize/deserialize a JSSubstructLibrary and get matches as UInt32Array

* I had forgotten to run clang-format

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-05-25 17:09:35 +02:00
Paolo Tosco
9cbb31381d straightenDepiction should not consider 0-degree rotations as multiples of 60 (#6367)
* straightenDepiction should not consider 0-degree rotations as multiples of 60

* improved JS straightenDepiction test which was a bit silly

* changes in response to review

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-05-15 16:04:37 +02:00
Paolo Tosco
f43c96e442 - when allowRGroups and allowOptionalAttachments are true, bonds connecting R groups to the scaffold should match single or aromatic (#6306)
- added relevant unit tests

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-05-13 05:54:15 +02:00
Paolo Tosco
d5fa89c96e has_coords() now reports whether coords are 2D or 3D if present (#6297)
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-04-19 16:40:32 +02:00
Paolo Tosco
fb878bdbe4 exposed queryColour in MolDrawOptions (#6282)
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-04-14 04:52:59 +02:00
Paolo Tosco
f492e29430 MinimalLib: avoid that assignStereochemistry() fails when removeHs=true (#6134)
* avoid that assignStereochemistry() fails when removeHs=true

* changes in response to review

* Remove unused variable declarations

As suggested in the code review

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-03-01 08:58:48 +01:00
Paolo Tosco
3326a620a2 Stereochemistry-related SWIG updates (#6127)
* - expose [sg]etUseLegacyStereo()
- In MolToSmiles() doIsomericSmiles should default to true as in C++ and Python
- added missing parameters to MolToSmiles() and MolToMolBlock()
- added SmilesWriteParams MolToSmiles() overload
- added and updated Java tests

* - changes in response to review
- exposed the same functionality also in MinimalLib and CFFI and added tests

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-02-28 06:44:50 +01:00
Paolo Tosco
6e2a2c007d replace the broken, commented out test for legacy stereo with a test that works (#6046)
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-02-06 16:41:21 +01:00
Paolo Tosco
79037b767f Enable building MinimalLib as a plain JS file for usage in legacy/headless browsers (#5999)
* - fix indentation
- fix regex check (which currently always fails)

* wip

* - added clearMolBlockWedgingInfo()
- added invertMolBlockWedgingInfo()
- MinimalLib::generate_aligned_coords() now inverts stereochemistry if a rigid-body alignment transformation caused chiality inversion
- MinimalLib::generate_aligned_coords() now clears stereochemistry if coordinates changed
- added JSMol::clear_prop() to the already existing JSMol::get_prop() and JSMol::set_prop()
- renamed commonchem to rdkitjson in JS unit test
- added relevant unit tests

* fixed mistake in logic

* - added add_hs_in_place() and remove_hs_in_place() to the JS MinmalLib
- added relevant tests

* - removed check for existence of a property ahead of clearing it as it is not necessary; updated the clearProp docstring to reflect this
- updated the MolFileStereochem.h docstrings based on review comments and fixed a typo
- fixed two (legitimate) compiler warnings as get_molblock() and get_v3kmolblock() should return nullptr and not a pointer to an empty string; added tests for this as there was none
- in MinimalLib/common.h, moved the check of whether a molecule has undergone a flip around the Z axis to a function in the anonymous namespace
- in MinimalLib/common.h, added logic to preserve original wedging (and eventually invert it) also when alignOnly is set to false, in case the wedging is all within the constrained scaffold
- added thourough testing of the wedging logic on both CFFI and JS sides

* - added equality operator to CXXAtomIter and CXXBondIter classes such that they can used with implicit loop STL algorithms
- added relevant unit tests

* fix Windows build

* - enable building MinimalLib as a plain JS file for usage in legacy/headless browsers
- support alternative way to draw an ellipse on legacy canvas without ellipse support
- update tests.js to test both the standard and the legacy version of MinimalLib
- update demo.html to work with both versions of the library and automatically select one based on browser support of WebAssembly
- fix a regression in demo.html caused by a change in signature of generate_aligned_coords

* reverted most changes

* changes in response to review

* restored demo.html
added a comment to Dockerfile_legacy_browsers explaining how to test in a legacy browser

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-01-27 10:28:48 +01:00
Paolo Tosco
0cdb8dcd5e Molblock wedging improvements (#5981)
* - fix indentation
- fix regex check (which currently always fails)

* wip

* - added clearMolBlockWedgingInfo()
- added invertMolBlockWedgingInfo()
- MinimalLib::generate_aligned_coords() now inverts stereochemistry if a rigid-body alignment transformation caused chiality inversion
- MinimalLib::generate_aligned_coords() now clears stereochemistry if coordinates changed
- added JSMol::clear_prop() to the already existing JSMol::get_prop() and JSMol::set_prop()
- renamed commonchem to rdkitjson in JS unit test
- added relevant unit tests

* fixed mistake in logic

* - added add_hs_in_place() and remove_hs_in_place() to the JS MinmalLib
- added relevant tests

* - removed check for existence of a property ahead of clearing it as it is not necessary; updated the clearProp docstring to reflect this
- updated the MolFileStereochem.h docstrings based on review comments and fixed a typo
- fixed two (legitimate) compiler warnings as get_molblock() and get_v3kmolblock() should return nullptr and not a pointer to an empty string; added tests for this as there was none
- in MinimalLib/common.h, moved the check of whether a molecule has undergone a flip around the Z axis to a function in the anonymous namespace
- in MinimalLib/common.h, added logic to preserve original wedging (and eventually invert it) also when alignOnly is set to false, in case the wedging is all within the constrained scaffold
- added thourough testing of the wedging logic on both CFFI and JS sides

* - added equality operator to CXXAtomIter and CXXBondIter classes such that they can used with implicit loop STL algorithms
- added relevant unit tests

* fix Windows build

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-01-24 05:17:59 +01:00
Paolo Tosco
ba29fd86fd MinimalLib JS functions to add/remove Hs in place (#5984)
* - added add_hs_in_place() and remove_hs_in_place() to the JS MinmalLib
- added relevant tests

* changes in response to review

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-01-19 09:52:28 +01:00
Paolo Tosco
c94a47bbd3 Enable get_molblock(details_json) from MinimalLib (#5806)
* - enable get_molblock(details_json) from MinimalLib as it is already enabled in CFFI
- enable useMolBlockWedging on get_molblock() in both CFFI and JS MinimalLib
- add tests

* - expose also addChiralHs

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-11-29 17:37:34 +01:00
Paolo Tosco
af8c5a0e76 Expose getMolFrags in CFFI and MinimalLib (#5774) 2022-11-25 18:59:09 +01:00
Paolo Tosco
739b417dfe Enable additional parameters in prepareAndDrawMolecule() and expose them to CFFI/MinimalLib (#5731)
* - extend prepareAndDrawMolecule() with missing optional parameters already supported by prepareMolForDrawing()
- enable useMolBlockWedging, wedgeBonds, addChiralHs, forceCoords, wavyBonds in CFFI/MinimalLib
- add relevant CFFI and JS unit tests

* Replace AllProps with a smaller subset

* make sure we pickle properties Python-side

* changes in response to review

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-11-08 11:50:09 +01:00
Paolo Tosco
e319617243 - added missing #include that caused the emscripten build to break (#5729)
- removed details from get_maccs_fp calls since there are no adjustable parameters
- exposed get_maccs_fp to JS
- added tests and adjusted existing ones since some deprecated functions were removed and do not need testing anymore

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-11-07 04:41:58 +01:00
Greg Landrum
6372a7b201 Do deprecations for the 2023.03 release (#5675)
* remove SmilesParserParams::useLegacyStereo

* MinimalLib JS deprecations

* PandasTools deprecations

* update release notes
2022-11-01 13:29:58 +01:00
Paolo Tosco
893affdff0 Expose highlighAtomColors, highlighBondColors and highlightAtomRadii to CFFI and JS (#5657)
* expose highlighAtomColors, highlighBondColors and highlightAtomRadii to CFFI and JS

* removed comment

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-10-18 05:00:35 +02:00
Paolo Tosco
97bb4a7f37 Improvements to 2D depiction and alignment/RMSD calculation (#5598)
* update AvalonTools to version 2.0.1

* Improvements to 2D depiction and alignment/RMSD calculation
- Refactored the straightenDepiction code which is now much simpler and more readable and supports a minimizeRotation parameter
- added C++, Python and JS tests for the new minimizeRotation parameter
- refactored tests to use CalcRMS rather than an internal implementation to compute RMS deviations
- Removed duplicated code in CalcRMS() and getBestRMS() and made their APIs consistent with respect to supported parameters
  IMPORTANT NOTE: for backwards compatibility I set the CalcRMS() default for the  new symmetrizeConjugatedTerminalGroups
  to false as this parameter was not originally supported. @greg: I would be very much in favor of setting this to true instead
  if you agree, even though it might change results for existing scripts, as I think it is a much more sensible default.
- Improved documentation to clarify the difference between CalcRMS() and getBestRMS()
- Added unit tests for CalcRMS() as there was none previously
- Added tests for the additional CalcRMS() and getBestRMS() parameters
- Added a new getBestAlignmentTransform() function
- The CFFI function set_2d_coords_aligned() now returns the matching atoms similarly to the C++, Python and JS counterparts
  IMPORTANT NOTE: this required an API change for the additional char ** parameter used to return the match.
  Existing code using set_2d_coords_aligned() will fail to compile and will require a last NULL parameter to be added to compile again
- Removed duplicated code between CFFI set_2d_coords_aligned() and JS generate_aligned_coords()
- Added has_2d_coords() to the CFFI library
- generate_aligned_coords() now supports JSON parameters and the previous versions are deprecated
- set_2d_coords_aligned() and generate_aligned_coords() both support an alignOnly parameter (which defaults to false).
  If set to true, rather than re-generating a fresh 2D layout around templateMol, the existing coordinates (if any) are simply aligned
  to the provided templateMol. If the molecule has no coordinates, a set of 2D coordinates is generated independently of templateMol
  and then aligned to the provided templateMol
- avoid that when acceptFailure is false set_2d_coords_aligned() and generate_aligned_coords() overwrite existing coordinates

* - explicitly link testDepictor to MolAlign library

* - add MolAlign dependency to testDepictor (rather than to the catch test as in the previous commit)
- add a couple of tweaks

* suppress compiler warnings (1st pass)

* warnings: 2nd pass

* warnings: 3rd pass

* - alignOnly mode should also support allowRGroups

* - fixed C++ build
- added tests for allowRGroups+alignOnly combination

* changes in response to review

* added an entry to backward incompatible changes regarding set_2d_coords_aligned()

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-10-02 06:24:01 +02:00
Paolo Tosco
948f7d231a Expose reaction drawing and additional FPs in MinimalLib (#5277)
* - exposed reaction drawing in MinimalLib
- fixed a typo in the error message "JSON doesn't contain 'atoms' field, or it is not an array"
- replaced RapidJson HasMember() with FindMember() to avoid a duplicate lookup in case the member exists and can be accessed
- some cosmetic style changes (avoid multiple variable declarations on a single line, use curly bracket also for one-liner if clauses, use auto where possible)
- capitalized "greg Landrum" to "Greg Landrum" (well deserved)
- exposed other FPs in addition to Morgan and Pattern FPs in MinimalLib
- added relevant tests

* - update CXSMARTS test in MinimalLib

* Changes in response to review:
- exposed reaction drawing functionality to CFFI and added relevant tests
- refactored fingerprint code to use JSON details and deprecated the Morgan/pattern fingerprint functions that used multiple parameters
- all fingerprints are now exposed to both JS and CFFI with no code duplication
- fixed a potential crash bug in the CFFI library where calling get_morgan_fp(), get_rdkit_fp() or get_pattern_fp with a NULL mol_pkl would result in dereferencing a nullptr

* removed debugging printouts committed accidentally

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-09-06 14:27:10 +02:00
Hyeonki Hong
1e5e748b85 Add prop related method into JSMol (#5414)
* Add JSMol::get_prop() and JSMol::set_prop()

* Remove trailing space in MinimalLib test code

* Add JSMol::has_prop()

* Add JSMol::get_prop_list()

* Add test_prop to MinimalLib test case
2022-07-20 05:10:13 +02:00
Greg Landrum
d2a05ecef2 Add a global feature flag to enable the "new" stereo perception code (#5309)
* add a global feature flag to control use of the new chirality code

* expose that flag to minimallib

* add getters for allowNontetrahedralChilrality and useLegacyStereoPerception

* switch to using environment variables to store the values

* document that
correct the documentation about nontetrahedral stereo

* yay visual c++

* in response to review
2022-05-27 16:52:59 +02:00
Paolo Tosco
03318b323f Expose mappings of atom/bond indices abbreviated mol->original mol (#5300)
* - Abbreviations::applyMatches() sets the _abbreviationMapping molecule property to relate the atom indices in the molecule with abbreviations to the atom indices in the original molecule

* added support for bond index mappings

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-05-20 06:28:02 +02:00
Paolo Tosco
cbd9574522 modified the JS tests to comply with older nodejs versions (#5148)
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-03-31 19:27:11 +02:00
Paolo Tosco
67d8dd3dcd Add a couple of depiction helper functions and some JS bindings (#5115)
* - adds normalizeDepiction() and Python wrappers
- adds straightenDepiction() and Python wrappers
- adds an early check for R-labels to be in the accepted range to avoid throwing an exception later on
- adds a kekulize flag to process_details() to enable depicting molecules which fail to kekulize from JavaScript
- adds JavaScript functions to get fingerprints as Uint8Array
- adds JavaScript function to generate pickled molecule as Uint8Array
- adds JavaScript function to restore molecule from Uint8Array pickled
- adds has_coords() JavaScript function
- adds set_new_coords() to set JSMol coordinates in-place
- adds get_mol_copy() to obtain a JSMol copy

* fix build failures

* changes in response to review

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-03-22 14:18:30 +01:00
Greg Landrum
2ae44cd468 support flexicanvas in the MinimalLib (#5109) 2022-03-21 04:52:22 +01:00
Paolo Tosco
e967b2bf54 Expose get_smarts to JS (#4547)
* expose get_smarts to JS

* exposed get_cxsmarts()

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-09-23 04:37:13 +02:00