Commit Graph

71 Commits

Author SHA1 Message Date
Greg Landrum
21225e63b3 Move some more tests over to catch2 (#9058)
* move testSubstructMatch to catch2

* modernization

* modernization

* switch to catch2

* modernize

* convert to catch2

* update

* move to catch

* please be quiet

* move to catch2

* changes in response to review

---------

Co-authored-by: = <=>
2026-01-24 07:03:04 +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
Hussein Faara
f35e7e6414 remove no-op macros and dead code (pt 1) (#8012) 2024-11-19 04:31:56 +01: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
Greg Landrum
bb066c43f4 add mol processing API (#7773)
* fix aliasing bug in MultithreadedSDMolSupplier

* update GeneralFileReader to v2 API

* add backwards incompatibility note

* v1 of this

* The helper function needs to be inline

* forgot the tests

* allow non-threadsafe builds

* MultithreadedMolSuppliers can now be destroyed without being used.

This was previously not possible

* add callbacks to the multithreaded readers

* document the new functions

* switch to storing the queues in unique_ptrs

* does not work

* only do those tests when in MT mode

* more generalfilereader cleanup

* tests pass

* passes tests

* extremely basic python wrapper

* better wrapper

* does not work

* tests pass

* test data

* fix failing test on ARM macs

we need to followup on why the wedging is different here

* move some stuff to the cpp file

the idea is to have the windows DLL builds not break

* fix(?) win64 linkage problems

* remove a warning in non-multi-threaded builds

* fix non-multi-threaded work

* well, at least local windows builds work

* remove duplicated code

* refactoring
simplification?

* simplify mutext handling

* review suggestions
2024-09-19 18:42:25 +02:00
Brian Kelley
3a4a744611 Allow the substruct library to be deleted when refcount goes to 0 (#7462)
* Allow the substruct library to be deleted when refcount goes to 0

* Remove whitespace changes

* Update Code/GraphMol/SubstructLibrary/Wrap/SubstructLibraryWrap.cpp

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

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-05-28 04:39:54 +02: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
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
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
8892fb160a Fix minimal build, allow building without boost::serialization (#6932)
* make sure that we can build without boost iostreams or seralization

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

* get out minimal cmake version correct

* get minimallib js building

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

* clean up a lot of boost::iostreams nonsense

* find_package(boost cleanup

* update the swig wrappers

* updates to psql

* get the Qt demo working again

* fix? coordgen

* only use std::regex in moldraw2d test

this is consistent with the other tests

* cleanup the serialization stuff too
2023-11-10 15:32:54 +01:00
Greg Landrum
908e47cc03 support generalized substructure search in the SubstructLibrary (#6835)
* support generalized substructure search in the SubstructLibrary

* simplify namespaces

* support the new functionality in the swig wrappers

* update mac swig version in CI

* ensure swig4

* switch mac_java ci builds to conda-forge

* change in response to review

* add copy ctor to extendedquerymol

* Back to the way it was
2023-11-01 14:55:28 -04: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
bc8d2e7556 Fix build warnings (#6235)
* un/signed comparisons in molops

* reference in loop in EmbeddedFrag.cpp

* un/signed comparison in filtercatalogtest.cpp

* un/signed comparison in Descriptors/catch_tests.cpp

* un/signed comparisons in DetermineBonds.cpp

* drop unused 'params' arg from static functions in MolInterchange/Writer.cpp

* un/signed comparisons in MolDraw2D/catch_tests.cpp

* unused var in SubgraphUtils.cpp

* 'move' preventing copy ellision in CDXMLParser.cpp

* fix infinite recursive call in SubstructLibraryWrap.cpp
2023-03-30 19:21:51 +02:00
Greg Landrum
79e8295586 Support Python 3.11 (#5994)
* remove some more deprecated numpy stuff

* workaround for changes to random.shuffle in python 3.11

* fix pickling of rdkit mols in python 3.11

* add py311 build to CI

* update py311 CI

* remove qt for py311 for the moment

* only use the new code with pyversion >=3.11

* use the new logic for all pickle_suites

* need to work with older py too
2023-01-24 18:16:26 +01:00
gedeck
3f3bc3b5a1 Fix documentation example for KeyFromPropHolder (#5886)
The example for KeyFromPropHolder in the documentation here:

https://www.rdkit.org/docs/source/rdkit.Chem.rdSubstructLibrary.html

doesn't render the example correctly. I don't know if the extra new line fixes it, but it looks like that is the only difference to the previous code blocks.
2022-12-20 07:06:29 +01:00
Greg Landrum
1f4584b2ca run clang_format (#5676) 2022-11-01 04:14:26 +01:00
Greg Landrum
0147cd8201 Fixes #5210 (#5408)
* revert duplicate chunk in release notes

* replace deprecated ifdefs
This one gets rid of USE_BUILTIN_POPCNT and RDK_THREADSAFE_SS
use RDK_OPTIMIZE_POPCNT or RDK_BUILD_THREADSAFE_SSS instead

* get rid of BUILD_COORDGEN_SUPPORT from ROMol.i

* fix a stupid typo

* update release notes
2022-07-11 11:20:03 +02: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
Greg Landrum
a354f2db62 add boost::serialization support to ROMol (#5249)
* add boost::serialization support to ROMol

* add RWMol test

* get the windows DLL builds working

* switch FilterCatalog and SubstructLibrary to serialize ROMols

* an actual solution to the windows dll problem

* the FilterMatchers stuff was not working
2022-05-07 11:11:53 +02:00
Eisuke Kawashima
27f711a658 Run clang-tidy (readability-braces-around-statements) (#4977)
https://github.com/rdkit/rdkit/pull/3024#discussion_r526549843
2022-03-10 08:00:10 +01:00
Kevin Burk
f8cf31068e Support for logging via Python's logging module. (#4846)
* Support for logging via Python's logging module.

* Avoid the Python 3.9+ PyObject_CallOneArg function.

* Move logging functions to RDBase; Python logger by default; clean up tests.

* See if removing NOGIL fixes the Windows stall.

* get tests running on windows

* Reset to using C++ logging; whiespace tweaks.

* Longer timestamp grace period; try tempfile vs Windows logging stall.

* Clean up commented code; get details for log count bug.

* SubstructLibrary: Fix c++ threads calling into python

* FilterCatalog: Fix c++ threads calling into python

* Release notes; make sure Jupyter still logs to sys.stderr.

* Always use thread-local log buffers.

* de-verbosify a test

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: Brian Kelley <fustigator@gmail.com>
2022-01-24 04:49:27 +01:00
Greg Landrum
b440dc30d2 Fix a number of crashing bugs in the python wrappers (#4810)
* fix a crashing bug in SubstructLibrary

* fix a bunch of other potential seg faults
These are all places where the result from pyObjectToVect(),
which can legitimately return a nullptr, is not checked before
being dereferenced.

* document behavior
clear the result vector for the other pythonObjectToVect() overload

* change error message
in response to review
2021-12-27 16:09:06 -05:00
Eisuke Kawashima
11532089de Run clang-format against cpp (#4358) 2021-10-20 04:25:27 +02:00
Brian Kelley
6a16d64169 Adds KeyFromPropHolder to hold user defined indices (#4571)
* Adds KeyFromPropHolder to hold user defined indices

* Add missing file

* I hate swig.  Had to move keyholder classes into main header file, yuck.
But I added tests, so yay?

* Remove removed dependency

* Fix borked test

* Make consistent getKeys function, fix constness

* Fix overloaded call

* Remove GetKey/s from SubstructLibrary
2021-10-02 08:17:50 +02:00
Greg Landrum
3193b76d8c cleanup some compiler warnings (#4521)
* cleanup some clang warnings

* get rid of some VC++ warnings
2021-09-16 04:34:40 +02:00
Greg Landrum
e21c39dcb3 SubstructLibrary improvements (#4403)
* support MolBundles in the SubstructLibrary

* support SubstructMatchParameters in SubstructLibrary

* expose those methods to the python wrapper

* fix non-threadsafe build problem

* be explicit about sorting

* add the option to set the search order

* add example functions for setting the search order
2021-08-24 05:02:41 +02:00
Ric
9aa949576a Addresses #4425 (#4426)
* refactor converter registration checking

* some more converters refactoring & cleanup
2021-08-20 11:23:39 +02:00
Eisuke Kawashima
013ba4f21d Run clang-tidy (modernize-use-override) (#4251) 2021-07-01 05:18:56 +02:00
Eisuke Kawashima
48f4f3ee82 Run clang-tidy (modernize-pass-by-value) (#4224) 2021-06-14 06:57:08 +02:00
Eisuke Kawashima
78aac3c1bc Run clang-format against header files (#4143) 2021-06-08 07:57:51 +02:00
Greg Landrum
3a82159b57 Cleanup some problems found during an ASAN build (#4054)
* MolFragmenter: fix a leak when exceptions are thrown

* DistGeomHelpers: fix leaks when exceptions are thrown

* SubstructLibrary: fix usage of invalid memory

* clear up leaks found during ASAN testing
2021-04-21 10:22:04 -04:00
Brian Kelley
198c7c60e5 Fixes #3881 (#3882) 2021-03-06 04:36:14 +01:00
Brian Kelley
c8aa10c80f Add tautomer query to the substructlibrary (#3808)
* Fixes #3797

* [WIP] Add tautomer queries to the substruct library

* Add TautomerQuery to CMake

* Add missing TautomerQuery functions, python wrapper and tests

* Add python wrappers for Substruct Library Tautomer Queries

* Explictly label non-const pattern function now that we have both

* Use boost::shared_ptr not std::shared_ptr

* Fix java builds

* One more try to fix java builds

* Fix Java Tests

* Run clang format

* Reenable tests

* Fix annoyingly stupid bug and annoying commit of debug code

* Fix documentation

* reenable ifdef threadsafe check

* Throw warning and perform tautomer search instead of bailing with incorrect fingerprints

* Simplfy api with templates

* Fix SubstructLibrary java issues

* minor API cleanup

* simplify the SWIG wrappers

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2021-03-05 04:56:20 +01:00
Greg Landrum
0e89b2dbea cleanup a bunch of compiler warnings (#3849)
* cleanup a bunch of g++ warnings

* make it work with clang

* remove some additional warnings based on CI builds

* fix that version number

* stop being verbose when building
2021-02-26 05:10:02 +01:00
Ric
703fe5a225 Remove boost::foreach from public headers (#3820)
* remove include from headers

* update implementation files

* completely remove BOOST_FOREACH (#7)

* convert those changes to use auto

* get rid of all usage of BOOST_FOREACH

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-02-17 14:15:48 +01:00
Brian Kelley
bd00fda39e Fixes crashes when using bad smiles in the cached smiles holders (#3798)
* Fixes #3797

* Update Code/GraphMol/SubstructLibrary/SubstructLibrary.cpp

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

* Update test to include positive and negative results

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-02-15 10:49:19 +01:00
Paolo Tosco
8030c36e5b Minor tweaks to SubstructLibrary (#3564)
* - added some missing const keywords
- added an addFingerprint overload to allow passing pointers
- added a test

* changes in response to review

* removed print

* added missing shared_ptr declaration

* added PatternNumBitsHolder serialization

* - merged with upstream changes and resolved conflicts
- got rid of PatternNumBitsHolder and leveraged the serialization version to get the PatternHolder to be backwards-compatible

* built substructLibV1.pkl with an older version of boost

* reverted serialization version to 1
only write numBits if != 2048 and only read numBits if it exists in the archive

* bogus commit just to trigger a rebuild
2020-12-09 19:42:38 -05:00
Paolo Tosco
c5dc6cc258 A few improvements to SubstructLibrary (#3557)
* - enable SubstructLibrary to build without threading support
- enforce consistency across single- and multi-threaded runs
- improve performance on single-threaded runs avoiding overhead of spawning threads
- consolidate internalCountMatches and internalGetMatches into one function to reduce code duplication
- fix a bug in Python CountMatches whjich would run on 1000 threads

* reverted Code/GraphMol/SubstructLibrary/Wrap/SubstructLibraryWrap.cpp as it is now in its own PR (#3558)

* - added missing cast
- removed unnecessary std::make_move_iterator
- added Brian's test

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-11-18 16:07:34 -05:00
Paolo Tosco
b2c3cd935a fixes bug in SubstructLibrary Python wrappers (see #3557) (#3558) 2020-11-09 10:08:26 -05:00
Cédric Bouysset
04a2be149f add newlines for code blocks + typo (#3475) 2020-10-13 05:09:34 +02:00
Greg Landrum
c0a62388a2 switch to using target_compile_definitions instead of add_definitions (#3350)
* switch to using target_compile_definitions instead of add_definitions

* missed one
2020-08-21 04:49:07 +02:00
Greg Landrum
45b9aef28b clang-tidy modernize-use-default-member-init and modernize-use-emplace (#3190)
* run clang-tidy with modernize-use-default-member-init

* results from modernize-use-emplace

* one uniform initialization per line
otherwise SWIG is unhappy

Co-authored-by: Brian Kelley <fustigator@gmail.com>
2020-05-28 09:07:58 +02:00
Eisuke Kawashima
e86e2c1d5d Modernization: use nullptr (#3143) 2020-05-25 09:40:01 +02:00
Greg Landrum
45bf58754a Cleanup some cmake dependencies (#3077)
* change minimal cmake version to a consistent 3.5

* progress towards a cleanup

* get the basic python deps working

* two more libs

* another round of changes
all tests pass at this point

* next round of changes
all tests pass at this point

* close to done
all tests pass

* very close

* almost done

* shift the RDBoost dependencies around a bit

* remove an extraneous python linkage
this is trying to get the mac builds working again

* Only link to python if it was built shared (#3091)

* change in response to review

Co-Authored-By: Ric <ricrogz@users.noreply.github.com>

* move that suppression of the maybe-uninitialized warning to BoostStartInclude.h

Co-authored-by: Brian Kelley <fustigator@gmail.com>
Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2020-04-17 14:34:23 +02:00
Brian Kelley
8fb99abc88 Fix/add patterns reset holders (#3033)
* Reset the mol and fp holders after calling AddPatterns

* Add test for seg fault
2020-03-25 06:36:00 +01:00
Brian Kelley
4c0a99f2ad Add multithreaded pattern/fp generator (#2973)
* Add threaded pattern generator to help speed up library creation

* Add size to FPHolderBase

* Add more complete python wrapper, fix leak in doctest

* Add basic usage test for addPatterns, fix I/O leak

* Add basic test for trusted smiles

* Actually add the new code

* Export addPatterns on windows

* Try fixing the cartridge build

* Change pattern_factory to PatternFactory

* Change boost::ref to std::ref
2020-03-04 09:41:03 -05:00
Greg Landrum
d41752d558 run clang-tidy with readability-braces-around-statements (#2899)
* run clang-tidy with readability-braces-around-statements
clang-format the results
clean up all the parts that clang-tidy-8 broke

* fix problem on windows
2020-01-25 14:19:32 +01:00
Brian Kelley
ecb8ecd8e9 Expose SubstructLibrary serialization stream (#2853)
* Exposes the stream interface for the substruct library

* Update SubstructLibraryWrap.cpp

* Adds docs

* Fix doctests

* Fixes another doc test

* More doc test fixes
2020-01-08 07:44:37 +01:00