51 Commits

Author SHA1 Message Date
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
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
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
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
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
e4f4644a89 - Expose multicolor highlights to MinimalLib (#7787) 2024-09-03 21:03:40 +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
Andrew Kane
5771d9c181 Add support for building the CFFI lib without InChI (#7698) 2024-08-10 21:16:58 +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
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
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
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
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
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
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
Ric
58d135a874 Reformat C/C++ code ahead of 2023.03 release (#6295)
* format files

* format template files too
2023-04-28 04:42:35 +02:00
Paolo Tosco
2aa4fe743d - allowRGroups now also includes terminal query atoms matching hydrogen in additional to terminal dummy atoms (#6280)
- added relevant unit tests

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-04-12 06:26:54 +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
588b8816f3 another minor code cleanup (#6109)
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-02-20 12:52:38 +01:00
Paolo Tosco
b3e0e0763b minor code cleanup (#6101)
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-02-19 12:24:41 +01:00
Dan N
b98f79fc99 Remove and from C++ headers (#6003)
`and` is a C++ keyword, but it isn't supported by default on
some compilers (msvc). I'd like to disable it on _all_ platforms
in Schrodinger builds so that people don't accidentally post
code that fails on a single platform.

However, that means external headers need to use `&&` and `||`
instead of `and` and `or`, even in platform-specific code.
2023-01-25 13:44:24 +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
Greg Landrum
e0b7fc298a Support SubstanceGroups and StereoGroups in JSON (#5909)
* write stereogroups

* Parse stereogroups

* add parameters to python wrappers

* more tests

* write substancegroups

* parse SubstanceGroups

* Fix a crashing bug with null molecules

* more testing

* add some docs

* update expected cffi results

* oh, this is delightful syntax

* adapt minimallib and the cartridge tests
some small cleanups

* stupid padding

* update expected

* changes in response to review
2023-01-04 16:29:36 +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
Eloy Félix
72e524c775 add MACCS fp to the MinimalLib (#5707)
* add maccs fp to the minilib

* maccs fit in 21 bytes
2022-10-31 06:46:07 +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
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
Eisuke Kawashima
b9a5be5a2d miscellaneous updates (#4284)
* Remove accidentally tracked files and unset x flag

* Ignore ComicNeue

* Unify test tag to `reader`

* Trivial destructors

* Bump CMAKE_CXX_STANDARD to 14 (#4165)
2021-07-13 06:57:29 +02:00
Paolo Tosco
a908e616b3 Some miscellaneous MinimalLib enhancements (#4169)
* - expose SubstructureLibrary to MinimalLib
- expose acceptFailure flag to MinimalLib generate_aligned_coords
- expose merge_query_hs functionality to MinimalLib
- expose kekulize flag to MinimalLib get_mol
- add relevant JS tests

* integrates previous commit

* changes in response to review

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-05-29 06:23:08 +02:00
Paolo Tosco
e1b5bc76b0 proper .gitattributes to checkout with native endings and commit with LF endings (#4166)
Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-05-28 05:42:48 +02:00
Greg Landrum
f5a54af475 A collection of MolStandardize improvements (#4118)
* Swap to using a data structure for default normalization parameters

* bring the default fragment data into the code too

* cleanup

* add reionizer parameters via data

change fragment parse failures to ValueErrorExceptions

* tautomer parameters in the code

* got a little over-enthusiastic in that last cleanup

* use boost::flyweight to cache normalization and charge data params

* a bit more cleanup

* support reading params from JSON

* fragments from JSON
single-call for fragment removal

* add a one-liner for the canonical tautomer

* quick refactor

* Fixes #4115

* complete the parents

* docs

* move the definitions to a namespace and make them const

* see if switching to c++14 fixes the CI compile problems with g++ 5.5

* somewhat uglier way of solving the initalizer list problem
2021-05-19 09:11:23 +02:00
Paolo Tosco
106e9f7c37 Normalize line endings in source code files (#4104)
* set all source code files to have native line endings

* normalized all source code line endings

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-05-13 14:31:39 +02:00
Greg Landrum
3b068a1590 handle bad input more gracefully (#4100) 2021-05-11 07:24:44 +02:00
Greg Landrum
158fe71ff2 Add some MolStandardize functionality to the CFFI library (#4062)
* support CleanupParameters from JSON

* add standardization to cffi

* remove a bunch of repeated code from the new stuff
2021-04-22 05:23:25 +02:00