Commit Graph

5424 Commits

Author SHA1 Message Date
David Cosgrove
48c3c818da Reaction rendered badly with small canvas size (#8211)
* Remove forcing minFontSize to 12 for reactions.

* Add hash code test.
Run Clang-format.

* Typo

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-01-30 06:28:42 +01:00
Greg Landrum
1bce2e225c improve handling of esters, amides, etc. in the v2 tautomer hash (#8173)
* improve handling of esters, amides, etc. in the v2 tautomer hash

Fixes #8090

* cleanup

* extend that logic to aromatic systems

* documentation in response to review
2025-01-30 06:11:10 +01:00
Brian Kelley
21b79c13e2 Simple fix to allow aromatic CIS/TRANS SMARTS to match molecules (#8192) 2025-01-30 06:10:22 +01:00
David Cosgrove
1ddf5846d7 Move creation of 2D coords to before markUnspecifiedStereoAsUnknown. (#8179)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-01-30 06:09:19 +01:00
David Cosgrove
6a2e54e529 Making SynthonSearch respond to Ctrl-C (#8153) 2025-01-30 06:08:48 +01:00
David Cosgrove
ecb0c31ba3 Optimisations to fingerprint search of Synthon Space (#8152)
* First pass at approximate FP check.

* Tidy and Python wrapper.

* More tidying.

* Add addFP and subtractFP to binary file.

* Minor tidy.

* In splits code, check for duplicate fragmentations.

* Update test results.

* Tidy.

* Set configurable limit on number of fragments generated from query.

* Stash prior to trying counts fps.

* Stash count fps.

* Back to bit fingerprints again.

* Extra comment.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-01-30 06:02:40 +01:00
Greg Landrum
8e9e1d9574 some optimizations of triangle smoothing (#8190) 2025-01-30 05:54:56 +01:00
Greg Landrum
a0c25bec33 bump the inchi version to 1.07.2 (#8176)
* bump the inchi version
move to using the github distributions

* update cartridge behavior

* further fix

* typos!
2025-01-30 05:54:23 +01:00
Nic Zonta
1dd96a022d fix problems with template matching (#7975)
* fix compilation error

* wip

* undo change to CMakeLists

* add test

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2025-01-30 05:54:06 +01:00
Greg Landrum
9f1c93ddd5 some cmake cleanups (#8171)
* Fixes #8139

* Fixes #8138
2025-01-30 05:53:16 +01:00
Greg Landrum
d38a5a205a Fixes #8162 (#8164)
* remove extraneous printing

* Fixes #8162
2025-01-30 05:52:44 +01:00
Nikitas Rontsis
a9c6145a2d Conformer embedding timeout (#8110)
* Conformer embedding timeout

* Add README for patching

* Don't raise Exception but set EmbedFailureCauses on timeout.

* Fix

* Remove wrongly added README

* Debug segfault

* Improve logging of failures

* Fix pointer reference

* Don't use optional
2025-01-30 05:52:21 +01:00
Greg Landrum
2349866ed6 Fixes #6679 (#8163) 2025-01-30 05:52:04 +01:00
Hussein Faara
701395b9da remove no-op macros and dead code (pt 2) (#8035)
* remove no-op macros and dead code (pt 2)

* test failures due to whitespace changes?

* actually run the testFeatures tests

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2025-01-30 05:51:09 +01:00
Richard Gowers
2090717371 fix SetPositions when using strided numpy array (#8150)
* fix SetPositions when using strided numpy array

previously SetPositions assumed that the provided numpy array used contiguous-C stride patterns

* cast to a const pointer to avoid compiler warning
2025-01-30 05:50:54 +01:00
Eisuke Kawashima
977cc9ac11 fix: apply modernize-use-nullptr (#8134)
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-01-30 05:50:36 +01:00
Ricardo Rodriguez
7eb5b422f9 Fix leaks in MIF wrappers (#8143)
* fix leaks in wrappers

* decref on not-sequence obj or bad seq size

* PySequence in DistGeom wrappers
2025-01-30 05:50:20 +01:00
Ricardo Rodriguez
2a5dd00288 fix (#8144) 2025-01-30 05:49:58 +01:00
tadhurst-cdd
b475bc62a5 relax two tolerances for ARM64 builds (#8148) 2025-01-30 05:49:08 +01:00
tadhurst-cdd
bcef6669fa Fix for removing bad stereo indications from Atropisomer parsing (#7984)
* Fix for removing bad stereo indications

* removed one unneed change

* removed mistaken change
2025-01-30 05:46:52 +01:00
Jeremy Monat
5f3f80a681 GetAtomsMatchingQuery: Tell where to find query options for (#8132)
* For GetAtomsMatchingQuery, note that "Atom query options are given in the rdkit.Chem.rdqueries module"

* wording change

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

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-01-30 05:46:34 +01:00
tadhurst-cdd
bbb9c2d04e Bad radical values are now ignored for MRV generation (#8130)
* Bad radical values are now ignored for MRV generation

* Update Code/GraphMol/MarvinParse/MarvinWriter.cpp

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

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-01-30 05:46:19 +01:00
David Cosgrove
9a1125c91f SynthonSpace search timeout (#8070)
* Add timeout to searches.

* Correct docstring.

* Include chrono header.

* Get it compiling with gcc.

* And then clang didn't like it...

* Revert to tmpnam as msktemp isn't available on Windows.

* Response to review.
Run time no longer saved in SearchResults.
Timeout check not tied to size of results.
Made the test timeout shorter.

* Fix the Python wrapper.

* Shamelessly steal the better timeout method from PR8110.

* suggested changes

* be more conservative about what does not time out

the CI machines can be surprisingly slow

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-01-30 05:45:57 +01:00
David Cosgrove
9fcaf3b271 Handle DOS files in SynthonSpaceSearch (#8075)
* Handle DOS files.

* Smaller test file.
Add DOS file to .gitattributes.

* Update Code/GraphMol/SynthonSpaceSearch/substructure_search_catch_tests.cpp

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-12-20 08:51:14 +01:00
Paolo Tosco
11ee676efd - 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-20 08:44:56 +01:00
Greg Landrum
0dfc28f656 allow specified chiral features to SSS match unspecified features (#8115) 2024-12-20 08:44:42 +01:00
greg landrum
7ba2b3773c fix a cherry-pick inconsistency 2024-12-19 10:13:18 +01:00
Paolo Tosco
f4d4a9fe19 normalizeDepiction() should always center coordinates on the coordinate centroid, irrespective of the canonicalize parameter (#8107)
* normalizeDepiction() should always center coordinates on the coordinate centroid, irrespective of the canonicalize parameter

* Update Code/GraphMol/Depictor/catch_tests.cpp

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

* fix catch test

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-12-19 10:00:40 +01:00
David Cosgrove
ba35526646 Use endian-aware read/write for length of string. (#8105)
* Use endian-aware read/write for length of string.

* Re-run clang-format.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-12-19 10:00:24 +01:00
David Cosgrove
ff1d6f8f8b SynthonSearch synth check (#8109)
* Catch errors when creating products.

* Extra python test.

* Fix formatting.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-12-19 10:00:07 +01:00
David Cosgrove
50ff4ff4c0 Handle DOS files in SynthonSpaceSearch (#8075)
* Handle DOS files.

* Smaller test file.
Add DOS file to .gitattributes.

* Update Code/GraphMol/SynthonSpaceSearch/substructure_search_catch_tests.cpp

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-12-19 10:00:01 +01:00
Nikitas Rontsis
6a764dc32a Avoid unnecessary matching (#8111) 2024-12-19 09:56:57 +01:00
David Cosgrove
26fa79b89a Fix empty results bug. (#8099)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-12-19 09:55:19 +01:00
Greg Landrum
644296fe13 Add Molecular Interaction Fields (#7993)
* Add RealValueVect.

* Add UniformRealValueGrid3D

* Add Molecular Interaction Fields (MIFs)

* line endings

* cherry-pick f1bc94a4c8

* format

* Adapt tests for python3.

* Adapt RealValueVector pickling for python3.

* Speed-up of MIF calculations.

* Bugfix in MIFDescriptors.cpp.

* all tests pass

* clean up some memory leaks

* update copyrights

* rename

* rename the library

* complete the rename

* lost file

* another forgotten file

* cleanup

* clang-tidy

* clang-tidy

* windows DLL builds work

* python wrapper and tests cleanup

* convert to catch2 testing

* switch RealValueVect to use std::vector

* remove obsolete friend

* - Replace explicit loops with stdlib implicit equivalents
- Replace explicit types with auto where possible
- Avoid unnecessary copy operations where possible
- Replace raw pointers with exception-safe unique_ptr
- Replace C-style #define with constexpr
- Replace C-style casts with C++ casts
- Replace C-style arrays with std::vector
- Avoid code duplication with templated operators
- Replace VdWaals class taking multiple atom type definitions and force-field name as string parameter with force-field-specific classes deriving from an abstract VdWaals class
- Replace x,y,z doubles with Point3D class where possible
- Removed unused (and untested) DistanceToClosestAtom class
- Renamed some variables and functions for better clarity
- Converted tabs to spaces
- Made the mol parameter in cube read/write functions optional for convenience
- Made the Python wrappers more pythonic (e.g., avoid C++-style passing objects as parameters which are modified in place)
- Implemented alternative Python class constructors using boost::python::make_constructor rather than with external non-class functions
- The Python wrappers taking a sequence of Point3D now take a sequence of sequences, such that the output of Conformer.GetPositions() can be passed
- Made the Python wrapper sequence parsing more robust
- Removed duplicated code from Python wrappers

* - avoid an unnecessary copy

* progress

* works

* more cleanup

* all tests pass

* changes in response to review

---------

Co-authored-by: dfhahn <dfhahn@users.noreply.github.com>
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-12-19 09:54:52 +01:00
David Cosgrove
86b5335770 Allow fragments of aromatic rings to match in RascalMCES (#8088)
* Allow fragments of aromatic rings to match.

* Use existing code for checking bond is in ring.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-12-19 09:54:23 +01:00
Paolo Tosco
802f9d2991 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-12-19 09:53:20 +01:00
greg landrum
b0f48e8c9e Revert "Fix #8027 (#8031)"
This reverts commit 7b2c9dfa58.
2024-12-19 09:36:58 +01:00
David Cosgrove
4773d1ba61 Synthon search fp bug (#8086)
* Fix bug - connector patterns weren't being matched to the synthon connector patterns.

* Tiny tweak.

* Typo in comment.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-12-19 08:57:46 +01:00
Greg Landrum
160991375c fixes #8060 (#8087)
* fixes #8060

* check the new stereo code too
2024-12-19 08:57:28 +01:00
Paolo Tosco
429008e561 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-19 08:56:13 +01:00
Paolo Tosco
7851770f99 avoid that map::at() throws an exception in case atomColourPalette includes neither 6 nor -1 (#8085)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-12-19 08:55:01 +01:00
Ricardo Rodriguez
3095fccb53 Fixes #8065 (#8066)
* add test + fix

* simplification

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

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-12-19 08:54:49 +01:00
David Cosgrove
1b79e6014c Resolve clashing atom labels in 2D drawing (#8074)
* Move atom labels round if they clash.

* Tidy.

* Re-work orientation logic.
Remove virtual fns from AtomSymbol.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-12-19 08:54:33 +01:00
Brian Kelley
79fa3a1fc8 Fix #4570 Segfault on Property Getters/Setters (#8042)
* Fix #4570 Segfault on Property Getters/Setters

* Revert regression, response to review

* Remove print statement
2024-12-19 08:53:39 +01:00
Paolo Tosco
7b2c9dfa58 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-12-19 08:52:04 +01:00
David Cosgrove
b76122b510 Synthon fingerprint search (#8025)
* First pass at splitting molecule.

* Interim commit.  Reading libraries from file in original format.

* Basic search seems to be working.

* Pattern fingerprint screening.

* Connector region heuristic.

* Fixed triazole (aromatic/non-aromatic connectors).

* Fix search with non-split parent query, where query is substructure of a single reagent.

* Remove duplicate hits by reaction/reagents used.

* Implement largest fragment heuristic.

* Extra test files.

* Read/write binary file.
Program for conversion from text format to binary format.

* Remove empty reagent sets on reading, probably due to synthon number counting from 1 rather than 0.

* Tidy SSSearch functions.

* Stash pending major surgery for triazole bug.

* Revert to using unique_ptr.
Correct use of reagent order.

* Function to summarise Hyperspace.

* Delay building hits till end and put cutoff on number.

* Earlier bale-out in getHitReagents.

* Streamline checkConnectorRegions.

* Remove free functions for search.

* Correct name of Python test.

* First stage of Python wrappers.

* Rename namespace.

* Parameters object.

* Mysterious windows export thing.

* Fix bug - not matching number of connectors in fragment and synthon.

* Back like it was.  The connector count wasn't the problem.

* Put the substructure results into their own class.

* gcc 14 didn't like my use of std::reduce.
Update expected test results.

* Remove write statement.

* Tidy.

* Tidy.

* Enable random sample of hits.

* Test that complex SMARTS works.
Update Python wrappers.

* Rename Hyperspace to SynthonSpace.

* More renaming.
Python test.

* Enable Python test.
Remove write.

* Plug memory leak.

* Response to Greg's initial look.

* More response to Greg's initial look.

* get the windows DLL builds working

* Do away with mutable.
Purge a few more uses of reagent in favour of synthon.
Remove the c++ exe for converting text to binary databases.

* Better Synthon c'tor.

* More feedback from Greg.

* Tidy the Python wrapper.

* Remove tags from catch tests.

* Don't allow copying of SubstructureResults.

* Revert to allow copying of SubstructureResults.  The Python wrapper needs it.

* Refinements based on CLion/clangd suggestions.

* Allow for map numbers in connectors in space file.

* Refactor to make the searcher a separate class from the space.

* Transfer Greg's review suggestions from Hyperspace merge.

* First cut of fingerprint searcher.

* Python wrapper.
Some tidying.

* Better random selection.

* Fix bug in preparing frags for fingerprints.
Re-factor.

* Minor-refactor.

* Sort hits by similarity if available.

* Option for a few different fingerprint types.  Pending a better solution.

* Write fingerprints to binary file.

* Use any fingerprint generator for similarity searching.  No Python wrapper yet.

* Python wrapper.

* Change random selection to use distribution weighted by number of hits in each reaction.

* Lots of suggestions from CLion/clang.

* Use boost discrete_distribution for cross-platform consistency.

* Tidy test up.

* Try boost rng as well.

* uniform_int_distribution to boost also.

* Small tidy.

* Method to write enumerated library.

* Windows export thing.

* Windows export thing.

* Allow for commas in tab-separated fields.

* win64 dll builds now work

* More aliphatic synthon, aromatic product joy.

* Force ring finding if it hasn't been done.

* Fingerprint hits not being sorted if maxHits reached.

* Remove debugging write.  Doh!

* Response to review of SynthonSpace2.

* Missed one.

* Add test file.

* Hand merge Greg's #8050.

* Discard nodiscard.

* Move include of export.h inside include guards.

* Response to review.

* Fix memory leaks.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-11-29 13:20:15 +01:00
Greg Landrum
1e9ec2f381 Fixed #7986 (#7987)
* Fixed #7986

* get builds working on linux

* try again

* oops, use std::uint32_t
2024-11-29 10:43:56 +01:00
greg landrum
1d2fb5c5b5 Revert "Expose propertyFlags to CFFI and MinimalLib (#7960)"
This reverts commit 6f33d827aa.
2024-11-28 08:49:49 +01:00
greg landrum
b669cf2c4b Revert "implemented JSON parsers for SanitizeFlags and RemoveHsParameters for CFFI and MinimalLib (#8000)"
This reverts commit 5d1ab5d6b7.
2024-11-28 08:48:54 +01:00
greg landrum
603de6caab Revert "Expose molzip functionality to MinimalLib (#7959)"
This reverts commit 1086ba089b.
2024-11-28 08:46:41 +01:00