Commit Graph

158 Commits

Author SHA1 Message Date
Ricardo Rodriguez
f3dd424d28 make ringdecomposerlib a mandatory dependency (#9209) 2026-03-27 18:17:27 +01:00
Paolo Tosco
adf060c881 - implement #9194 (#9197)
- remove redundant #include
- avoid unnecessary copy of match
- expose SubstructMatchParams to JS MinimalLib
- add JS SubstructMatchParams test

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2026-03-26 05:00:42 +01:00
Yakov Pechersky
0986d22c58 Deterministic kekulize, independent of atom and bond order (#9125)
* Make kekulization deterministic

* Add tautomer order-independence regression (python)

* Adjust tautomer tests for deterministic kekulization

* Update graphmol wedged-bond kekulization checks

* SmilesParse: update aromatic bond index expectations

* SmilesParse: refresh cxsmilesTest expected files

* Depictor: update testDepictor expected MolBlocks

* Depictor: update depictorCatch expectations

* Depictor Wrap: update expected MolBlock for pyDepictor

* MarvinParse: update testMrvToMol expected outputs

* FileParsers: refresh testAtropisomers expected outputs

* FileParsers: update tests for deterministic kekulization

* MolDraw2D: refresh brittle bond assertions

* RascalMCES: update expected cluster size

* MinimalLib: make cffi wedging check order-independent

* documentation fix

* MinimalLib: update Kekulé bond table in aligned-coords test

* Hoist duplicated lambdas to TEST_CASE scope

* Remove unused originalWedges variable

* Remove redundant bounds check; clarify wedge-end preference

* Pre-sort allAtms by wedge-end + rank

* Use mol.atomNeighbors() for neighbor iteration

* Check inAllAtms before linear-scanning done

* Drop redundant optsV/wedgedOptsV sorts

* Remove unused Canon.h include

* Add canonical parameter to Kekulize; skip ranking during sanitization

* Test canonical re-kekulization preserves stereo across atom orderings

* MinimalLib: update Kekulé bond orders in invertedWedges

* Change Kekulize canonical default to false, expose in Python wrappers

* keep rank order, push_back

* Revert "RascalMCES: update expected cluster size"

This reverts commit a81bb39495.

* docstring change

* expose new flag to python wrapper

* document changes in ReleaseNotes.md

* revert minimallib test changes again

* canonical = true defaults

* Revert "revert minimallib test changes again"

This reverts commit 039e1d84da.

* Reapply "RascalMCES: update expected cluster size"

This reverts commit 7b83a7a3e8.

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2026-03-19 08:43:13 +01:00
Greg Landrum
e4f199389b swap zlib download to use github (#9123) 2026-02-19 12:12:36 +01:00
Paul Pillot
b952b740d3 Cannot build JS bindings with MCS option enabled. (#9110)
* Cannot push_back std::string to boost json array

`boost::json::array.push_back` expects a `value`

* prefer emplace_back to avoid casting

* Ensure every MINIMAL_LIB option is tested in CI

Also remove Chemdraw support from the compilation. This does not change the final size of the output (not exported anyways) but it reduces the compilation time by 1 min (-10% on my local machine)

* Expose MMPA with other options

* Fix MMPA compilation: Implicitly binding raw pointers is illegal

Applying same pattern as in `get_frags_helper`
2026-02-13 14:54:48 +01:00
Greg Landrum
c2e48f41d8 Stop writing so many atom properties to cxsmiles (#9002)
* fix a bug in copySelectedAtomsAndBonds()
we need to clear computed properties on the atoms here

* prune back the atom properties written to CXSMILES

* update minimallib tests
2025-12-13 04:35:57 +01:00
Greg Landrum
45681a1c04 Switch from using RapidJSON to Boost::JSON for MolInterchange (#8859)
* First pass at port

Mostly auto-converted using claude sonnet 4

Things are a bit slower in this initial port. Here's some timing data for molecules from SMILES (no coords) and from SDF (with coords)

# MASTER
## smiles
read: 50000 mols.
 9.260000s wall, 8.650000s user + 0.600000s system = 9.250000s CPU (99.9%)
serialize
 3.060000s wall, 2.400000s user + 0.660000s system = 3.060000s CPU (100.0%)
deserialize
 1.350000s wall, 1.250000s user + 0.090000s system = 1.340000s CPU (99.3%)

## SDF
read: 50000 mols.
 9.340000s wall, 8.930000s user + 0.400000s system = 9.330000s CPU (99.9%)
serialize
 6.630000s wall, 5.960000s user + 0.680000s system = 6.640000s CPU (100.2%)
deserialize
 1.450000s wall, 1.450000s user + 0.000000s system = 1.450000s CPU (100.0%)

# Boost::JSON
## smiles
read: 50000 mols.
 9.250000s wall, 8.830000s user + 0.420000s system = 9.250000s CPU (100.0%)
serialize
 4.770000s wall, 4.410000s user + 0.350000s system = 4.760000s CPU (99.8%)
deserialize
 2.320000s wall, 2.100000s user + 0.230000s system = 2.330000s CPU (100.4%)

## SDF
read: 50000 mols.
 9.500000s wall, 9.100000s user + 0.400000s system = 9.500000s CPU (100.0%)
serialize
 8.760000s wall, 8.330000s user + 0.420000s system = 8.750000s CPU (99.9%)
deserialize
 2.540000s wall, 2.330000s user + 0.210000s system = 2.540000s CPU (100.0%)

* some json parser optimization

* around the edges

* optimizations for the writer

* hopefully get things compiling

* convert the MinimalLib stuff to use boost::json

Again, a lot of the lifting here was done using Claude Sonnet 4 in VS Code Copilot

* fix Windows DLL build

* response to review

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

* better not to blindly accept suggestions

* fix the problems in MinimalLib

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
Co-authored-by: = <=>
2025-11-11 11:54:44 +01:00
Ricardo Rodriguez
7b7a8a4e17 Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-08 16:08:01 +02:00
Paolo Tosco
23ffd85f60 - fix #8481 (#8808)
- implement get_v2Kmolblock() in MinimalLib
- add the possibility to specify the MDL version preference as a get_molblock() forceMDLVersion JSON parameter, which is ignored by get_v3Kmolblock() and get_v2Kmolblock()
- changes in response to review

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-09-29 17:33:02 +02:00
Paolo Tosco
24b2039040 Implement returnDrawCoords JSON option in MinimalLib to return 2D drawing coordinates when SVG or canvas depictions are generated (#8815)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-09-29 09:36:06 +02:00
Paolo Tosco
053a0283f7 Patch RapidJSON to make sure it builds on all platforms (#8818)
* patch RapidJSON to make sure it builds on all platforms

* remove unnecessary sed command from Docker recipe

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-09-26 05:28:46 +02:00
Paolo Tosco
805294c27f - move MolDrawOptions JSON parsing code to a separate compilation unit (#8783)
- implement drawingExtentsInclude MolDrawOption taking as parameter DrawElement enum values
- add unit tests for drawingExtentsInclude option (C++, Python, CFFI)

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-09-23 09:27:13 +02:00
Paolo Tosco
5ed6c56cc8 Avoid code duplication through a templated function and improve JSON parsing of Boolean flags (#8773)
* - avoid code duplication through a templated function
- enable switching off boolean flags via JSON and not just on as before

* ran clang-format

* change in response to review

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-09-16 16:29:04 +02:00
Paolo Tosco
dd044522c1 - expose RDK_BUILD_MINIMAL_LIB_RGROUPDECOMP in Code/MinimalLib/CMakeLists.txt (#8729)
- explicitly wrap raw pointer into emscripten::val with allow_raw_pointers() policy

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-08-25 19:37:59 +02:00
paconius
1fe07a5eb7 Add option to draw all CIP codes in DrawMol.cpp (#8609)
* enable showAllCIPCodes in DrawMol code

* Made consistent with old behavior + add test

* Added python test

* Fixed FREETYPE=OFF tests

* Fixed FREETYPE=OFF tests

* Adjusted pytest

* Enabled JSON drawer option setting + new JSON test

* update JS docs
2025-07-24 16:46:15 +02:00
Paolo Tosco
9c7ffb33e9 Expose reading/writing PNG metadata to CFFI and MinimalLib (#8381)
* get SynthonSpace.cpp to build also when RDK_USE_BOOST_SERIALIZATION is
not defined

* test should not fail when RDK_USE_BOOST_SERIALIZATION is not defined

* - expose reading/writing PNG metadata to CFFI and MinimalLib
- add relevant CFFI and MinimalLib unit tests
- add RDK_USE_BOOST_PROGRAM_OPTIONS CMake option
- enable using standalone zlib in the absence of boost::iostreams for parsing PNG files
- enable linking against maeparser in the absence of boost::iostreams also on Windows
- enable building RDKit in the absence of boost::program_options

* add check for boost::program_options

* change size_t into std::uint64_t in SearchResults for consistency with doTheSearch() which uses std::uint64_t

* change size_t into std::uint64_t in SearchResults for consistency with
SynthonSpaceSearcher::doTheSearch()

* set CMake policy to allow YAeHMOP to require a version which is not
actually supported

* reverted External/YAeHMOP/CMakeLists.txt to master version

* check if Windows build will work

* fix build

* configure zlib install location

* build zlib dependency

* include zlib header directory

* explicitly set PropertyFlags.AllProps so the test does not fail on
static builds

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-07-23 17:10:38 +02:00
Paolo Tosco
f7a3bfe4e2 replace incorrect Freetype cmake flags with correct ones (#8543)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-05-25 14:55:55 +02:00
Paolo Tosco
6533bbfaa2 Add missing default values to docker-compose configuration (#8544)
* add missing default values to docker-compose configuration

* remove unnecessary network settings

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-05-24 07:29:06 +02:00
Paolo Tosco
f3cd17ba37 Explicitly construct an emscripten::val object with allow_raw_pointers() policy before setting a JS object key to a raw pointer value (#8555) 2025-05-23 17:29:41 +02:00
Paolo Tosco
73a7378ddb Avoid a large number of warnings when building MinimalLib with emscripten (#8545)
* - avoid a large number of warnings when building MinimalLib with emscripten, which does not support SHARED
- fix indentation in CoordGen CMakeLists.txt

* disable RDK_USE_BOOST_STACKTRACE on emscripten platform

* revert change done by mistake

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-05-22 05:08:01 +02:00
Paolo Tosco
e87dc6ee0f Consolidate MinimalLib Dockerfiles to avoid code duplication (#8412)
* Consolidate MinimalLib Dockerfiles to avoid code duplication
Remove Dockerfile_legacy_browsers since IE11 is not used anymore

* add project name to docker-compose YAML files

* add projectName to azure pipelines DockerCompose section

* updated scripts/build_rdkit.js and Dockerfiles to enable end-to-end
builds

* changes in response to review

* - remove unused docker-compose file
- update azure-pipelines.yml

* fix service dependency

* CI build should copy_from_local

* docs update, make it work for local builds, minimize git clone

* - changes in response to review
- added an option to build from the local source tree to
  scripts/build_rdkitjs.sh

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2025-04-28 08:57:30 +02:00
Paolo Tosco
1b9d0921b1 - do not free sslib until patternFpArray is still needed by the test (#8407)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-04-09 13:33:23 +02:00
Greg Landrum
32608ae0b4 Atoms bonded to metal atoms should always have their H counts explicit in SMILES (#8318)
* refactor the code to determine whether or not an atom is in brackets

* move the definition of isMetal to QueryOps

* atoms bound to metals in SMILES should always be in square brackets

Implementation and some test updates

needs confirmation that all of tests run

* basic tests pass

* java tests pass

* update js tests

* doc updates

* Update Code/GraphMol/catch_graphmol.cpp

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>

* Update Code/GraphMol/SmilesParse/test.cpp

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>

* finish fixing tests

* bump yaehmop version to allow compilation to work

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2025-03-29 07:26:03 +01:00
Greg Landrum
cfffa8db4d try adding a CI job to build the minimallib docker image (#8290)
* try adding a CI job to build the minimallib docker image

* update

* try simplification

* path

* path

* re-enable the other ci builds
remove the obsolete .yml file
2025-02-21 09:44:31 +01:00
Paolo Tosco
932208d46a revert default to JavaScript-based exceptions (#8270)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-02-14 13:16:05 +01:00
Paolo Tosco
cdeeb2c270 Restore functionality of the MinimalLib Dockerfile
- fetch boost sources from archives.boost.io
- build in /src rather than in /opt
- build freetype from source with -fwasm-exceptions support as the emscripten port on GitHub is outdated and archived
- build RDKit with -fwasm-exceptions support as performance is significantly better than with DISABLE_EXCEPTION_CATCHING=0

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-02-13 08:34:06 +01:00
Paolo Tosco
1cd5b24e43 - str_to_c() should initialize len to 0 even if memory allocation fails (#8112)
- str_to_c() should check the ptr returned by malloc for non-nullness before using it
- change has_coords() mol_pkl parameter to const
- use assert.equal in JS tests where possible

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-12-19 06:04:00 +01:00
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