308 Commits

Author SHA1 Message Date
Greg Landrum
e35f7db009 Cleanup/get atoms and bonds (#9243) 2026-04-18 05:22:09 +02:00
Ricardo Rodriguez
d90a73aa6b Leak fixes for 2026.03.1 (#9198)
* fix mols leaked in tests

* own invariant generators

* clean up MorganFeatureAtomInvGenerator patterns

* address review suggestions
2026-03-25 05:56:26 +01:00
Greg Landrum
b4164ea2f2 Support serializing/deserializing FP generators to JSON (#9000) 2025-12-24 19:09:05 +01:00
Greg Landrum
9a4cca3967 Allow using generators for similarity maps (#8912)
* add option to track atoms involved in each bit for morgan FP

Needs test still

* support similarity maps using fingerprint generators

* support RDKit, AP, and TT

still need tests

* add some testing

* response to review
2025-11-06 19:12:29 +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
Ricardo Rodriguez
a4b63d7df5 Minor refactor of the python wrappers (#8847)
* refactor python wrappers

* fix FilterHierarchyMatcher converted already registered warning
2025-10-05 09:42:31 +02:00
Greg Landrum
c15eb1a143 Fixes #8633 (#8794)
* Fixes #8633

* changes in response to review
2025-09-26 05:33:13 +02:00
Greg Landrum
86141183c1 Moving towards getting all tests to pass when using the new stereo code (#8409)
* Fixes #8379

* check in some working tests

* test passes

* test passes

* test passes

* test passes

* test passes

* ensure that the invariants flush the streams on failure

* tests pass

* test passes

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* Fixes #8391

* tests pass

* fix a test with legacy
not clear why this was not causing problems before

* make a test work

* Fixes #8396

* gcc builds work

* fingerprint tests pass

* mention backwards incompatible change

* fix a problem with FindMolChiralCenters

* more testing details

* enable the test status output

* Fixes #8432

fix a bug in double-bond stereo handling for template matching

* all depictor tests pass

* use the new-stereo chiral ranks in the depiction code

* always assign new-stereo chiral ranks

* make _ChiralAtomRank a computed property
This is analogous to _CIPRank

* tweak to the way the atom ordering is computed for 2D coordinate generation

* update two expected results

* backup

* response to review

* tests pass

* tests pass

---------

Co-authored-by: = <=>
2025-04-15 14:00:32 +02:00
Greg Landrum
5817e52db2 Fixes #3102 (#8413) 2025-04-07 09:01:16 -06:00
Ricardo Rodriguez
1a67fefcc6 mem fixes (#8276) 2025-02-20 05:59:30 +01:00
Hussein Faara
44364fd982 remove no-op macros and dead code (pt 4) (#8037)
* remove no-op macros and dead code (pt 4)

* review comments
2025-01-26 07:49:50 +01:00
Greg Landrum
b6fe7be27b Fixes #6679 (#8163) 2025-01-12 20:02:33 +01:00
Hussein Faara
f35e7e6414 remove no-op macros and dead code (pt 1) (#8012) 2024-11-19 04:31:56 +01:00
Greg Landrum
5b943e3a55 Fixed #7986 (#7987)
* Fixed #7986

* get builds working on linux

* try again

* oops, use std::uint32_t
2024-11-05 13:58:48 -05:00
Greg Landrum
2f119c2693 Convert reaction fingerprinter to use FingerprintGenerators (#7931)
* FingerprintGenerator improvements

1. simplify construction by adding ctors taking FingerprintArguments
2. remove inexplicable boost::noncopyable from FingerprintArguments

* Switch FingerprintType to be an enum class

* Fixes #7521

* dumb mistake

* initialize everything

* get the defaults right

* Update Code/GraphMol/ChemReactions/ReactionFingerprints.cpp

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

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2024-10-31 06:58:02 +01:00
Ricardo Rodriguez
ccfb1fa688 ... and more mem errors fixed (#7924)
* fixleak in CIP labels catch test

* fix leak in Murtagh clustering

* do not leak writers in streambuf

* fix leaks in fingerprintgeneratorwrapper

* remove 'minor leak' comments
2024-10-25 07:01:34 +02:00
Ricardo Rodriguez
0164ac7fae Fix some more mem errors in 2024.09.1 (#7899)
* fixes

* do not leak MolCatalogParams

* do not leak points on align failures

* give python ownership of pointers returned in getFingerprintsHelper

* clean up ScaffoldNetwork ptr if createNetworkHelper fails

* manage FF ptrs during construction

* wire in ownsBondInvGenerator in getMorganGenerator

* manage weights in rdMolAlign CalcRMS

* fix ownership of matches list/tuple in generateRmsdTransMatchPyTuple

* manage stream in createForwardSupplier during construction

* drop redundant Point3D allocations in GetUSRDistributionsFromPoints

* fix signed comparison mismatch
2024-10-10 16:08:50 +02:00
Kevin Boyd
0345c2e70a Improve Morgan Fingerprint Performance (#7862)
Fingerprinting is improved via the following changes:

* Neighborhoods are stored in a map rather than a vector
* Removed an extraneous neighborhood lookup that was already covered elsewhere in the code
* Pull vectors out of loops and preallocate where possible
* Use swap on  current and next level invariants.

The aggregate speedup on a random sample of Chembl molecules was about ~60% on radius = 2, and 100% on radius = 3
2024-10-05 06:46:46 +02:00
Ricardo Rodriguez
ea7f51f3b1 Fix some mem errors in 2024.09.1 (#7867) 2024-10-03 16:05:43 +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
62b9f7a019 fix typo (Fingeprint -> Fingerprint) (#7801)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-09-16 06:18:43 +02:00
Eisuke Kawashima
b340eb9bb9 doc: fix -Wdocumentation-html (#7721)
#7525

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2024-08-16 08:12:42 +02:00
Greg Landrum
d3061b03ef Fixes github #7533 (#7539)
* Fixes #7533

Fixes problem with SparseIntVect and SparseBitVect where the intention is to
be able to store all possible values of the index type: in these cases
you could not store (or access) the final element.

* increase the verbosity of the DataStructs tests
so that we can see what's going on
2024-06-20 09:27:27 +02:00
Anna Brünisholz
3a8199e4ca Numpy 2 Support (#7531)
* facilitate numpy 2.0 support

* so that all tests run smoothly

* not yet ready for this

* w/ casting to bool

* remove formatting changes from this PR
2024-06-19 07:54:50 +02:00
Greg Landrum
a64ab4ef5f fix a lifetime bug Andrew Dalke identified (#7408) 2024-05-08 22:25:43 -04:00
Greg Landrum
254817127c fixes bug with overly large count_bounds (#7368)
* fixes bug with overly large count_bounds

bug found and submitted by Andrew Dalke

* add another test
2024-04-23 07:34:04 +02:00
Ricardo Rodriguez
73e91a6344 Fixes #7318 (#7319)
* fix hybridization for atoms with outgoing dative bonds

* expose and wrap C++ numPiElectrons

* deprecate AtomPairs.Utils.NumPiElectrons

* add & update tests

* fix draw2d test

* update expected hash

* add hybridization test

* move numPiElectrons to Atom.h

* take reference instead of ptr
2024-04-03 15:34:37 +02:00
Riccardo Vianello
d6e8e473c1 fix GCC 13.2 warnings about redundant move in return statement (#7029) 2024-01-09 09:29:33 +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
c43f6d363a - enable building stubs in both in-tree and out-of-tree builds (#6980)
with cmake --build . --target stubs (also make stubs on *NIX)
- improved the patching script to do a better assignment of
  overloaded constructor parameters, whcih results in a number
  of docstring fixes

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-12-13 04:49:34 +01:00
Paolo Tosco
9e2bfca876 fix #6958 (#6959)
* fix #6958

* Update Code/GraphMol/Fingerprints/testFingerprintGenerators.cpp

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

* Update Code/GraphMol/Fingerprints/testFingerprintGenerators.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>
2023-12-04 04:55:30 +01:00
Paolo Tosco
2b4202867e Add Python modules to generate stubs and automatically patch docstrings (#6919)
* - added gen_rdkit_stubs Python module to generate rdkit-stubs
- added patch_rdkit_docstrings Python module to patch existing C++ sources to fix docstrings missing self parameter and add named parameters taken from C++ signatures where possible
- added rdkit-stubs/CMakeLists.txt to build rdkit-stubs as part of the RDKit build
- added an option to CMakeLists.txt to enable building rdkit-stubs as part of the RDKit build (defaults to OFF)

* fixed CMakeLists.txt, rdkit-stubs/CMakeLists.txt and a doctest

* - added missing cmp_func parameter
- fixed case with overloads with optional parameters
- do not trim params if expected_param_count == -1
- add dummy parameter names if we could not find any
- keep into account member functions when making up parameter names
- address __init__ and make_constructor __init__ functions
- fix incorrectly assigned staticmethods

* patched sources

* address residual few remarks

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-11-30 04:54:18 +01:00
Greg Landrum
57d2fd2e27 Add (multithreaded) functions to the fingerprint generators for calculating multiple fingeprints in one call (#6910)
* compiles and runs, not tested
backup commit before I break it

* complete the implementation

* add the MT implementation to the C++ library

* tests pass

* remove old code

* release the GIL

* linux builds

* remove some warnings on macos

* changes in response to review
2023-11-24 17:57:33 +01:00
Greg Landrum
2957ab4576 switch to catch2 v3 (#6898)
* switch to catch2 v3
Fixes #6894

* fix a couple of problems noticed in the CI builds

* more warning cleanup

* changes in response to review
2023-11-15 06:45:42 +01:00
Paolo Tosco
a384878fbe avoid leaking memory in case exceptions are thrown while generating FPs (#6630)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-08-15 04:59:14 +02:00
Paolo Tosco
4f23cb70c6 Fix a few broken docstrings (#6480)
* - Fix a couple of docstrings that were confusing boost::python
- Python keywords should not be used as parameter names

* changes in response to review

* removed two leftover BOOST_PYTHON_FUNCTION_OVERLOADS

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-23 13:47:51 +02:00
Ric
880a8e5725 Reformat Python code for 2023.03 release (#6294)
* run yapf

* run isort

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-04-28 06:53:56 +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
Greg Landrum
8559f5d3a9 Add a new tautomer mol hash (#6289)
* backup

* does not work

* backup

* passes all tests

send more tests!

* backup

* seems to mostly work
needs cleanup still

* more tests + python wrappers

* more testing

* some cleanup

* fix problem with newer boost

* be more expansive about unsaturation

* be symmetric in choosing the starting bond
fix a test error

* passes all tests;
passes ChEMBL regression test

* docs

* update cookbook

* expose the new hash function to the cartridge too

* support v2 hash in the registration hash

* better testing

* alternate, simpler approach for that

* remove vestigial docs
2023-04-26 16:57:39 +02:00
Greg Landrum
cb6caa161b Add option to only include shortest paths for topological torsion fingerprints (#6090)
* get findAllPaths versions working

* add that to the python wrapper

* add overlooked test file

* update test

* change in response to review
2023-02-20 11:13:53 +01:00
Greg Landrum
3866d3c419 Expose fingerprint generator options to python (#6024)
* add test making sure that multiple bits per feature works with other fp types

* simplification

* expose base options class

* remove redundant df_includeChirality from TT generator

* expose the fingerprint arguments (i.e. options) to python

* typo
2023-02-01 04:29:22 +01:00
Ric
0e7e44c9f4 Fix some minor leaks (#6029)
* fix deserializing leaks ringinfo

* fix leak in FingerprintGenerator

* fix leak in MolStandardize test
2023-01-31 17:30:34 +01:00
Martin Larralde
20a0759590 Fix computation of distance betwen MHFP fingerprints (#5920)
* Update `testMHFP.py` to check distance to self is zero

* Fix `MHFPEncoder::Distance` to compute a distance instead of a similarity

* Fix distance used for testing `MHFPEncoder::Distance` in `testMHFP.py`

* Fix expected distance values in `testMHFPFingerprint.cpp`

* Fix undeclared variable in `testMHFP.py`

* Fix C++ documentation of `MHFPEncoder::Distance` to mention Hamming instead of Jaccard distance
2023-01-24 05:38:51 +01:00
Greg Landrum
9f6cbc3740 Fixes #5838 (#5959)
* Fixes #5838

* more testing

* update the expected test results

* changes in response to review
2023-01-16 04:12:41 +01:00
Greg Landrum
a96f3ac4b4 FingerprintGenerator refactoring (#5748)
* add FingerprintFuncArguments() to simplify things

* getFingerprintHelper() also uses FingerprintFuncArguments

* port atompairs and tts to use new code

* not working yet

* all tests pass

* move the includeChirality flag to the global arguments
ensure stereochemistry is assigned when calculating fingerprints using chirality (#1993)

* migrate legacy morgan fp code to use generators

* refactoring the way bit info is handled

* all tests pass

* all tests pass

* expose getArguments()

* rename getArguments->getOptions

* copyright updates

* update a test

* remove template from FingerprintArguments
some other refactoring and cleanup

* hopefully fix the windows dll builds

* partial docs update

* improve docs and API

* more docs

* more docs

* a bit of modernization

* more doc tweaks

* changes in response to review
2022-12-28 17:40:13 +00:00
Greg Landrum
e322928028 swap boost::tuple to std::tuple (#5851) 2022-12-16 16:01:19 +01:00
Greg Landrum
776441c064 add includeRedundantEnvironments support to GetMorganGenerator (#5732)
* add includeRedundantEnvironments support to GetMorganGenerator
This is connected with the discussion #5665

* Update MorganGenerator.h
2022-11-07 17:49:40 +01:00
Greg Landrum
594c58f86c make the catch tests build faster (#5284)
* reorg the catch tests
the goal here is to make the builds faster

* make that easier
2022-05-17 04:39:33 +02:00
Eisuke Kawashima
ba6d8e0d3b clang-tidy: readability-simplify-boolean-expr (#4639) 2022-03-17 13:50:50 +01:00