Commit Graph

131 Commits

Author SHA1 Message Date
Paolo Tosco
a6654c4f8f Make sure that loggers can be enabled, disabled, captured and tee'd from MinimalLib (#7962)
* make sure that loggers can be enabled, disabled, captured and tee'd from MinimalLib without issues

* changes in response to review

* change in response to review

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-12-12 13:44:33 +01:00
Paolo Tosco
bd8289738d Fix #8027 (#8031)
* - Fix #8029
- avoid unnecessary rounding errors in the JSON writer
- remove a warning when compiling MinimalLib without SubstructLIbrary support

* changes in response to review

* changes in response to review

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-11-30 07:20:20 +01:00
Paolo Tosco
8c1bf34ed7 implemented JSON parsers for SanitizeFlags and RemoveHsParameters for CFFI and MinimalLib (#8000)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-11-16 05:16:25 +01:00
Paolo Tosco
9c63cf6c54 Expose molzip functionality to MinimalLib (#7959)
* Expose molzip functionality to MinimalLib

* changes from code review

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-11-12 17:16:14 +01:00
Paolo Tosco
b1d322555b Expose propertyFlags to CFFI and MinimalLib (#7960)
* - added property support to CFFI library
- added propertyFlags JSON parser
- added support for setting propertyFlags to MinimalLib

* added missing files

* fix SWIG builds

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-11-07 06:08:27 +01:00
Paolo Tosco
64061b6ca7 - remove deprecation warnings by switching MinimalLib to fingerprint generators (#7938)
- add missing Fingerprints dependency to MinimalLib CMakeLists.txt
- remove conditional RGroupDecomposition dependency in MinimalLib CMakeLists.txt, as it is always needed because of relabelMappedDummies()

wip

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-10-30 06:15:58 +01:00
Paolo Tosco
f66ad7e7c1 Replace awful enum reflection macros with Better Enums (#7913)
* - moved SMILES and RGroupDecomp JSON parsers to their own translation units
- added missing DLL export decorators that had been previously forgotten
- changed the signatures of MolToCXSmiles and updateCXSmilesFieldsFromJSON
to replace enum parameters with the underlying types
- updated ReleaseNotes.md

* make sure cxSmilesFields is only updated if the JSON string contains keys
belonging to the CXSmilesFields enum

* added missing copyright notices

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-10-25 08:17:07 +02:00
Paolo Tosco
39fbc8bfa1 expose preset color palettes to MinimalLib through JSON (#7853)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-10-10 14:30:42 +02:00
Greg Landrum
da6cd73168 Run clang-format across everything (#7849)
* run clang-format-18 across Code/*.cpp and Code/*.h

* run clang-format-18 across External
2024-09-26 13:39:02 +02:00
Paolo Tosco
786393beb1 Enable RGD highlights as in blog post (#7322)
* Code/GraphMol/Depictor/RDDepictor.h
- fixed typo in docstring
Code/GraphMol/RGroupDecomposition/RGroupCore.cpp
- added a missing const; formatting changes
Code/GraphMol/RGroupDecomposition/RGroupData.cpp, Code/GraphMol/RGroupDecomposition/RGroupData.h
- moved the code which merges disconnected R groups sharing the same attachment point into a single combined molecule to a private method, RGroupData::mergeIntoCombinedMol(). The method also includes logic to merge atom and bond highlights, if present.
- modernized a for loop
- isMolHydrogen is now a static function since it does not actually require any instance data
- implemented three static function to return the R group, Core and Mol labels, respectively
Code/GraphMol/RGroupDecomposition/RGroupDecomp.cpp, Code/GraphMol/RGroupDecomposition/RGroupDecomp.h
- implemented two private methods, RGroupDecomposition::labelAtomBondIndices() and RGroupDecomposition::setTargetAtomBondIndices(). The first method tags all atoms and bonds in the target molecule such that they can be tracked following core removal by RDKit::replaceCore(). The second method sets common_properties::_rgroupTargetAtoms and common_properties::_rgroupTargetBonds properties on core and R groups. These are vectors of atom and bond indices in the target molecule corresponding to core and R group atom/bonds, respectively, and can be used for color-coding the target molecule according to the R group decomposition it was subjected to, similarly to https://greglandrum.github.io/rdkit-blog/posts/2021-08-07-rgd-and-highlighting.html
Code/GraphMol/RGroupDecomposition/RGroupDecompData.cpp
- formatting changes and for loop modernization
Code/GraphMol/RGroupDecomposition/RGroupDecompParams.cpp, Code/GraphMol/RGroupDecomposition/RGroupDecompParams.h
- implemented updateRGroupDecompositionParametersFromJSON()
- added includeTargetMolInResults boolean parameter
Code/GraphMol/RGroupDecomposition/RGroupMatch.h
- implemented RGroupMatch::setTargetMoleculeForHighlights() and RGroupMatch::getTargetMoleculeForHighlights() methods to, respectively set and get the target molecule where R group decomposition can be color-coded with highlights. This molecule includes the explicit H atoms corresponding to extracted R groups, if any.
Code/GraphMol/RGroupDecomposition/Wrap/rdRGroupComposition.cpp
- use a std::unique_ptr to store the pointer to the C++ RGroupDecomposition instance
- fixed typos in docstrings
Code/GraphMol/RGroupDecomposition/Wrap/test_rgroups.py
- added test for the new includeTargetMolInResults parameter
Code/GraphMol/RGroupDecomposition/catch_rgd.cpp
- added test for the new includeTargetMolInResults parameter
Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp
- formatting changes
Code/GraphMol/RGroupDecomposition/testRGroupInternals.cpp
- do not use deprecated constant
Code/MinimalLib/CMakeLists.txt
- added RDK_BUILD_MINIMAL_LIB_RGROUPDECOMP CMake flag to optionally expose R group decomposition functionality into MinimalLib
Code/MinimalLib/common.h
- added makeDummiesQueries flag to mol_from_input() (defaults to false)
- implemented parse_highlight_multi_colors() function to parse multi-color atom and bond highlights
- enable multi-color atom and bond highlighting
Code/MinimalLib/demo/rgd_demo.html
- added HTML page showcasing the multi-color highlights similarly to https://greglandrum.github.io/rdkit-blog/posts/2021-08-07-rgd-and-highlighting.html
Code/MinimalLib/jswrapper.cpp
- removed checks for non-nullness of d_mol as d_mol cannot be directly accessed anymore
- replaced all instances of d_mol with get()
- implemented support for multi-color atom and bond highlights
- implemented optional support for R group decomposition
- added JSMol::copy() convenience method with same functionality as get_mol_copy() to duplicate a molecule
Code/MinimalLib/minilib.cpp, Code/MinimalLib/minilib.h
- replaced all occurrences of d_mol with get(), as d_mol is now private
- removed all occurrences of assert(d_mol) as non-nullness is checked at construction time and whenever get() is called
- JSMol is now split into two subbclasses, JSMolUnique and JSMolShared, which both inherit from the JSMol base class. JSMolUnique can be constructed from a RWMol* (as the old JSMol), while JSMolShared can be constructed from a ROMOL_SPTR. This avoids unnecessary copies when wrapping a ROMOL_SPTR (e.g., from subtructure library, JSMolList or R group decomposition) into a JSMol to pass it to JS. This also avoids that modifications done in the JS layer on a molecule stored in a MolList (e.g., adding a property) are not persisted because they are carried out on a volatile copy of the molecule rather than on the actual molecule.
Code/MinimalLib/tests/tests.js
- added a test for pesistence of modifications made to JSSharedMol
- added tests for RGD
- added test for JSMol::copy()
Code/RDGeneral/RDValue.h
- removed trailing comma from vector properties such that they can be deserialized as syntactically correct JSON
Code/RDGeneral/types.cpp, Code/RDGeneral/types.h
- added _rgroupTargetAtoms and _rgroupTargetBonds common_properties

* Code/GraphMol/Depictor/RDDepictor.h
- fixed typo in docstring
Code/GraphMol/RGroupDecomposition/RGroupCore.cpp
- added a missing const; formatting changes
Code/GraphMol/RGroupDecomposition/RGroupData.cpp, Code/GraphMol/RGroupDecomposition/RGroupData.h
- moved the code which merges disconnected R groups sharing the same attachment point into a single combined molecule to a private method, RGroupData::mergeIntoCombinedMol(). The method also includes logic to merge atom and bond highlights, if present.
- modernized a for loop
- isMolHydrogen is now a static function since it does not actually require any instance data
- implemented three static function to return the R group, Core and Mol labels, respectively
Code/GraphMol/RGroupDecomposition/RGroupDecomp.cpp, Code/GraphMol/RGroupDecomposition/RGroupDecomp.h
- implemented two private methods, RGroupDecomposition::labelAtomBondIndices() and RGroupDecomposition::setTargetAtomBondIndices(). The first method tags all atoms and bonds in the target molecule such that they can be tracked following core removal by RDKit::replaceCore(). The second method sets common_properties::_rgroupTargetAtoms and common_properties::_rgroupTargetBonds properties on core and R groups. These are vectors of atom and bond indices in the target molecule corresponding to core and R group atom/bonds, respectively, and can be used for color-coding the target molecule according to the R group decomposition it was subjected to, similarly to https://greglandrum.github.io/rdkit-blog/posts/2021-08-07-rgd-and-highlighting.html
Code/GraphMol/RGroupDecomposition/RGroupDecompData.cpp
- formatting changes and for loop modernization
Code/GraphMol/RGroupDecomposition/RGroupDecompParams.cpp, Code/GraphMol/RGroupDecomposition/RGroupDecompParams.h
- implemented updateRGroupDecompositionParametersFromJSON()
- added includeTargetMolInResults boolean parameter
Code/GraphMol/RGroupDecomposition/RGroupMatch.h
- implemented RGroupMatch::setTargetMoleculeForHighlights() and RGroupMatch::getTargetMoleculeForHighlights() methods to, respectively set and get the target molecule where R group decomposition can be color-coded with highlights. This molecule includes the explicit H atoms corresponding to extracted R groups, if any.
Code/GraphMol/RGroupDecomposition/Wrap/rdRGroupComposition.cpp
- use a std::unique_ptr to store the pointer to the C++ RGroupDecomposition instance
- fixed typos in docstrings
Code/GraphMol/RGroupDecomposition/Wrap/test_rgroups.py
- added test for the new includeTargetMolInResults parameter
Code/GraphMol/RGroupDecomposition/catch_rgd.cpp
- added test for the new includeTargetMolInResults parameter
Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp
- formatting changes
Code/GraphMol/RGroupDecomposition/testRGroupInternals.cpp
- do not use deprecated constant
Code/MinimalLib/CMakeLists.txt
- added RDK_BUILD_MINIMAL_LIB_RGROUPDECOMP CMake flag to optionally expose R group decomposition functionality into MinimalLib
Code/MinimalLib/common.h
- added makeDummiesQueries flag to mol_from_input() (defaults to false)
- implemented parse_highlight_multi_colors() function to parse multi-color atom and bond highlights
- enable multi-color atom and bond highlighting
Code/MinimalLib/demo/rgd_demo.html
- added HTML page showcasing the multi-color highlights similarly to https://greglandrum.github.io/rdkit-blog/posts/2021-08-07-rgd-and-highlighting.html
Code/MinimalLib/jswrapper.cpp
- removed checks for non-nullness of d_mol as d_mol cannot be directly accessed anymore
- replaced all instances of d_mol with get()
- implemented support for multi-color atom and bond highlights
- implemented optional support for R group decomposition
- JSMol is now split into two subbclasses, JSMol and JSMolShared, which both inherit from the JSMolBase class. While JSMol can be constructed from a RWMol* as usual, JSMolShared can be constructed from a ROMOL_SPTR. This avoids unnecessary copies when wrapping a ROMOL_SPTR (e.g., from subtructure library, JSMolList or R group decomposition) into a JSMol to pass it to JS. This also avoids that modifications done in the JS layer on a molecule stored in a MolList (e.g., adding a property) are not persisted because they are carried out on a volatile copy of the molecule rather than on the actual molecule.
- added JSMolBase::copy() convenience method with same functionality as get_mol_copy() to duplicate a molecule
Code/MinimalLib/minilib.cpp, Code/MinimalLib/minilib.h
- replaced all occurrences of d_mol with get(), as d_mol is now private
- removed all occurrences of assert(d_mol) as non-nullness is checked at construction time and whenever get() is called
Code/MinimalLib/tests/tests.js
- added a test for pesistence of modifications made to JSMolShared
- added tests for RGD
- added test for JSMolBase::copy()
Code/RDGeneral/RDValue.h
- removed trailing comma from vector properties such that they can be deserialized as syntactically correct JSON
Code/RDGeneral/types.cpp, Code/RDGeneral/types.h
- added _rgroupTargetAtoms and _rgroupTargetBonds common_properties

* added assignChiralTypesFromMolParity flag

* added test for makeDummiesQueries

* added CFFI tests

* reordered tests

* re-added piece of code that had gone accidentally lost while merging conflicts

* Removed CHECK_INVARIANT following code review

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-09-16 16:14:13 +02:00
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
3568879dae restore the ability to build RDKit_minimal.js after #7700 (#7734)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-08-21 04:52:44 +02:00
Greg Landrum
b1663052b8 Remove Descriptors as a dependency of many other RDKit libraries (#7700)
* move mol weight and formula calculators to MolOps and refactor them a bit.
The descriptors are still there and should remain.

* remove other unnecessary dependencies on Descriptors

* Update adapter.cpp

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

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2024-08-13 13:22:43 +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
Andrew Kane
5771d9c181 Add support for building the CFFI lib without InChI (#7698) 2024-08-10 21:16:58 +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
b5d4b54d20 - patch RapidJSON 1.1.0 release backporting a fix from the master branch to avoid a compilation error on newer compilers (fix #7485) (#7550)
- update MinimalLib Dockerfile to Debian Bookworm and patch RapidJSON in case someone wants to build an older release (fix #7530)

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-06-23 06:59:52 +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
a0f274c0f7 fixes typo in minilib: MolToCXSmiles should have read MolToSmiles (#7388)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-04-27 08:20:19 +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
Greg Landrum
9367e207d5 remove some warnings with -Wextra (#7339) 2024-04-11 11:01:59 +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
b8908f3117 - added a few optional configurable parameters to the MinimalLib Dockerfiles (all have defaults) (#7182)
- updated Boost to version 1.84.0
- removed obsolete ./emsdk update-tags which was triggering a warning during the build
- WORKDIR should always be absolute, so changed build to $RDBASE/build
- updated the Dockerfile_legacy_browsers help text

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-02-24 06:43:25 +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
tadhurst-cdd
d5d4d194ec atropisomer handling added (#6903)
* atropisomer handling added

* fixed non-used variables,  linking directives

* BOOST LIB start/stop fixes, linking fix

* Fixes for RDKIT CI errors

* minimalLib fix

* changed vector<enum> for java builds

* check for extra chars in CIP labeling

* removed wrong deprecated message

* fix ostrstream output error?

* restored _ChiralAtomRank to lowercase first letter

* changes for merged master

* Fixed catch label for new Catch package

* update expected psql results

* get swig wrappers building

* restore MolFileStereochem to FileParsers

* fix java wrapper for reapplyMolBlockWedging

* some suggestions

* move a couple functions out of Bond

* Merge branch 'master' into pr/atropisomers2

* merged master

* Renamed setStereoanyFromSquiggleBond

* atropisomers in cdxml, rationalize atrop wedging, stereoGroups in drawMol

* fix for CI build

* attempt to fix java build in CI

* attempt to fix java build in CI #2

* New routine to remove non-explicit  3D-geneated chirality

* changed to use pair for atrop atoms and related bonds

* Changes as per PR reviews

* PR review respnses

* PR review reponse - more

* Fix merge from master

* fixing java ci after merge

* Updated the help doc for atripisomers

* update the atropisomer docs

* improve the images

* add the source CXSMILES

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-12-22 04:58:18 +01:00
Greg Landrum
7a50df222f [WIP] get deprecation CI working (#7004)
* Compile time and runtime deprecation warnings

* Used [[deprecated]] attribute to mark deprecation on cpp side
* Used RDLog to escalate deprecation warnings to python
* deprecated non fingerprint generator fingerprint generation functions

* Address build errors

* suppress deprecation warnings in cpps and tests
* experiment with new SWIG versions in the mac azure pipeline

* More deprecation suppression

* revert mac java experiment

* Fix SWIG syntax errors

* Attempt to fix windows unit test

* Remove test because of logging behavior

* Change linux java build to SWIG 4.1

- removes the need for preprocessor interaction

* Change mac java build to SWIG 4.1

* try updating the CI buid

* lock cmake version

needed to find JNI correctly

* update compiler versions

needed for the boost

* Fix typo and unavailable version

* Fix version conflict

* update mac build

* get linux build working?

---------

Co-authored-by: Patrick Penner <patrick@ppenner.com>
2023-12-21 15:01:05 +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
Greg Landrum
8892fb160a Fix minimal build, allow building without boost::serialization (#6932)
* make sure that we can build without boost iostreams or seralization

adds some "private" variables on the python side to check for these compilation flags

* get out minimal cmake version correct

* get minimallib js building

installs an up-to-date cmake
also updates the version of boost being used for the minimallib
adds extra argument to allow the repo to be specified
2023-11-23 05:57:05 +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
Greg Landrum
f797113a16 cmake cleanup (#6814)
* add RDKIT_CFFI_STATIC option
minimallib cmake cleanup

* clean up a lot of boost::iostreams nonsense

* find_package(boost cleanup

* update the swig wrappers

* updates to psql

* get the Qt demo working again

* fix? coordgen

* only use std::regex in moldraw2d test

this is consistent with the other tests

* cleanup the serialization stuff too
2023-11-10 15:32: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
David Cosgrove
6f70dc2a7d Github6400 (#6553)
* Fix bug where large padding gave a legend font size of 0.
The padding is now implemented by making a smaller, offset drawing area within the width_ and height_, dimensions drawWidth_, drawHeight_.  The previous drawHeight_ has been replaced by molHeight_.

* Update test results.

* Update hash codes.

* Update test results.

* Update test results for no freetype.

* Update hash codes for no freetype.

* Update hash codes for freetype.

* Update hash codes for no freetype.

* Update hash codes for freetype.

* Update expected test results.

* Update hash codes.

* Fix contour plots not being lined up with atoms.

* Fix shrinkToFit.

* Update expected test result.

* Fix typo in test name.

* Update expected test result.

* Update expected test result.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-08-30 12:35:33 +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
9a3e9b3d9c - Add appropriate compiler flags such that MinimalLib builds also when using clang version >=15 (#6490)
- Use the nodejs version bundled with emscripten to run tests since the one in Ubuntu is ancient and does not support recent wasm features

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-24 07:47:50 +02:00
Paolo Tosco
758bf8cbce misc jswrapper.cpp cleanup (#6449)
- removed leftover, unused parse_morgan_fp_param() function
- remove leftover, unused deprecationMsgShown variable
- corrected error message which had a typo
- removed unused molArray variable
- removed DEPRECATED comment that had been forgotten

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-12 15:24:17 +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