124 Commits

Author SHA1 Message Date
Ricardo Rodriguez
9e301c15d6 Normalize rings (#9208)
* normalize rings

* update tests

* update doctests

* update release notes
2026-04-01 05:37:02 +02: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
Jackson Burns
6426df8ef1 update references to GetSSSR with correct return type (#9121) 2026-02-19 05:50:22 +01:00
Greg Landrum
5df8f93e27 Get things working with numpy 2.4 and pandas 3.0 (#9072)
* get BertzCT working with numpy 2.4

* test pass with with Pandas 3.0
(on windows at least)

* update testRanker too

* update nb test

* run win32 CI tests with different pandas versions
also updates boost version

* works with pandas 2.0?

* update linux_build_py311 -> linux_build_py312
test both old and new pandas

can't go higher with the python version yet because the older pandas and numpy are not available.

* doctest fix?

---------

Co-authored-by: = <=>
2026-02-04 12:06:21 +01:00
PatrickPenner
55f4f14e11 Fixed Typo in Getting Started Docs (#8947) 2025-11-13 06:21:48 +01:00
Justin Gullingsrud
bda9ffbeec Incremental synthon search (#8855)
* Iterated interface to substructure search

* Add a test

* Add python unit test

* Expose the toTryChunkSize parameter to python

* Respect the maxHits parameter; sort the hitset

* Treat maxHits=-1 as infinite

* Add callback versions of fp and rascal search; conform to C++ style

* Add fp and rascal C++ tests

* maxHits=-1 tripped me up again

* Add fp and rascal python wrappers.

Changed the name of the callback-based method to have "Incremental"
in the name because the overloaded versions with default arguments
can't be reliably selected by the boost python runtime.  Probably
better to have a different method name anyway since the return type
is None instead of a results object.

* Delete stray printf.

* Run clang-format

* Use std::int64_t instead of ssize_t for portability

* Make docstrings on callback-based methods more descriptive

* Stop incremental search if the callback returns true.

* Add an example of incremental synthon search to the getting started docs

* trivial commit to force CI rerun

* Reformat single line if statements.

* Make SearchResultsCallback take const ref input

* Fix another one-liner

* Oops - another one-liner
2025-11-08 04:27:16 +01:00
Greg Landrum
0ee90279b5 Partial fix to a problem with implicit Hs being written to SMARTS (#8893)
* Partially resolve a problem with implicit Hs ending up in SMARTS

* update doctest

* document in release notes
2025-10-24 07:50:06 +02:00
Greg Landrum
93d0f8bb74 Fixes #8776 (#8875)
* Fixes #8776

don't call the pseudo-CIP perception code if we really don't need to

* allow calling the pseudo-CIP code from Python

* update doctests
2025-10-17 05:52:27 +02:00
David Cosgrove
5e3c08c185 Add documentation for SynthonSpaceSearch. (#8293)
* Add documentation for SynthonSpaceSearch.

* Quick extra.

* Small tweak.

* Try accessing RDBASE.

* Fix doctests.

* Corrections after review.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-04-30 17:35:01 +02:00
David Cosgrove
d7e1ce7cf4 Rascal Fix 8360 (#8376)
* Use distances on all valid paths rather than just shortest distance.

* Optimise BondPaths.

* Optimise BondPaths.

* Hash coded for the bond paths.

* Faster find all paths.

* Build in gcc working.

* Comment.

* Remove debugging code.

* Update GettingStartedInPython.rst.

* Now need to split the clique and keep the largest fragment.
Lots of warnings about how slow this is.
Split out long tests.

* Back out a lot of changes.  Remove the distance check with singleLargestFrag when building modular product.

* Tidy code.
Update docstrings.
Add explanation to GettingStartedInPython.rst.

* Fix single fragment test.

* Response to review.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-04-08 10:12:58 +02:00
Greg Landrum
6dce5d4080 Fixes #1670 (#8093)
* add missing descriptors to Lipinski.py
Fixes #1670

* add to descriptor list
2024-12-15 05:58:20 +01:00
Greg Landrum
fe6e239da2 Updates to the Docs/Book directory (#7942)
* doc updates

* add rdShapeAlign to the docs

* fix shape docs

* let's not add too much here, revert deprecation

* cleanup the python book

* more book cleanups

* bring in sphinx.napoleon so that we can use the numpy docstrings

* fix a typo

* Update rdkit.ML.rst
2024-10-22 16:07:25 +02:00
nmaeder
6675315b85 Fix/kminimization (#7535)
* first try

* do over with @greglandrum: fix atomPairs, lower SP angle force constant.

* change test file for 'update parameters from JSON':'ETKDGv2'

* adapt length to fix

* remove overwritten random seed

* adapt test files to changes

* adapt amide test, check with Greg

* fix python tests and remove unused imports

* proposal for new test molecule

* remove double comparison, increase threshold. Check with greg

* remove TODO comments

* remove debugging statements

* same code for both since they are doing the same

* format docstring to make more readable

* remove todo comments

* add indentation to angle param

* adapt doctest to newly generated conformers

* fix test to pass with fewer failures and move mol to mol file for less cluttered test.

* a bit of modernization

* remove cerrs and format correcly

* reverted test to old behavior

* use insert and make force field contribs exception safe

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-07-08 15:29:45 +02:00
Greg Landrum
34e5569866 deprecations for the 2024.09 release (#7398)
* deprecations for the 2024.09 release

* update doctests

* Fixes #7402

* get tests passing when the cairo build is not there

* fix a problem in the tests
2024-05-05 07:30:00 -04:00
Rachael Pirie
58023dd3b8 Add Double Cubic Lattice Volume (DCLV). (#7234)
* Add Double Cubic Lattice Volume (DCLV).

Method to compute the solvent accessible surface area and volume, van der Waals volume, compactness and packing density of a protein. Implemented from:  Frank Eisenhaber, Philip Lijnzaad, Patrick Argos, Chris Sander and Michael Scharf, "The Double Cubic Lattice Method: Efficient Approaches to Numerical Integration of Surface Area and Volume and to Dot Surface Contouring of Molecular Assemblies", Journal of Computational Chemistry, Vol. 16, No. 3, pp. 273-284, 1995.

* refactor

* DCLV is no longer a configuration option

* add to the docs

* standalone test has been removed

* reduce use of pointers as args

* DCLV to catch_tests

* update python wrapper

* add copyright statements

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-03-20 13:35:54 +01:00
Kollin Trujillo
aaab587f58 Lipinski Rule of 5 was incorrectly described. (#7055)
* Lipinski Rule of 5 was incorrectly described.

* Update GettingStartedInPython.rst

removed MLogP descriptor
2024-01-30 04:45:52 +01:00
Greg Landrum
b6361ae684 Change the defaults for the conformer generation to be ETKDGv3 (#6985)
* fix a float comparison in a test

* make ETKDGv3 (i.e. v2 of the torsion parameters) the default.
This should have been done a long time ago.

* change default for onlyHeavyAtomsForRMS too

* release notes update
2023-12-19 04:25:55 +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
ab152a4ed1 Switch over to using pytest to run the python tests (#5916)
* misc adaptations/modernizations
plus a few changes to allow pytest discovery

* get the recap unittests running

* pytest config updates

* all tests pass

* integrate the pytest stuff into ctest

* integrate Projects dir
better cmake integration

* ci build env updates

* ignore more files

* remove six.py

* cleanup UnitTestPandasTools

* cleanup pytest

* remove obsolete use of rdkit.six from doctests

* update release notes

* mysterious CI fix

* add conftest to remove some tests

* remove the old python-based testing infrastructure

---------

Co-authored-by: Ric <ricrogz@gmail.com>
2023-11-03 14:39:24 +01:00
Greg Landrum
42c09f5237 Fixes #6818 (#6820)
* make sure that a full build and test can work even if boost::iostreams is not being used

Hopefully nobody every actually needs this, but as long as we supply the option, the tests should actually work

* update doctests for that change
2023-10-22 05:23:05 +02:00
Paolo Tosco
d9d1fe2838 Fixes #6773 (#6785)
* fixes #6773

* removed unused captures

* update release notes and cmakelists for beta (#6788)

* 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>

* Revert "Removed some code duplication between Depictor.cpp and common.h (#6368)" (#6797)

This reverts commit ddfe708b37.

* All 3d des (#6741)

* add function to calc all 3D descriptors

* fix indentation in CalcMolDescriptors3D

* add error handling for 2D molecules

* suggested changes

* change exception type

* add unit tests

* add random seed to conf gen in unit tests

* fix function call in unit tests

* fix expected PMI1 value in tests

---------

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

* _moltoimg() should honor drawOptions.prepareMolsBeforeDrawing (#6792)

* _moltoimg() should honor drawOptions.prepareMolsBeforeDrawing and not run PrepareMolForDrawing if requested not to

* _moltoimg() and _moltoSVG() should honor drawOptions.prepareMolsForDrawing and not call PrepareMolForDrawing if asked not to

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>

* Bad lasso (#6751)

* Better separation of lines.

* Only put atoms in colour list once.

* Test.

* Hash codes.

* Response to review.

* First attempt at fixing stray line.

* Tidier.

* Squared distances.

* tag release (#6801)

* fixes #6773

* removed unused captures

* - fixed comment
- fixed bug found in checkIfRingsAreClosed()

* - removed redundant NRing queries
- added ring size queries to avoid incorrect matches with MCS results originated with MatchFusedRingsStrict

* fixed doctests

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: John Mayfield <john@nextmovesoftware.com>
Co-authored-by: Rachael Pirie <56546141+RPirie96@users.noreply.github.com>
Co-authored-by: David Cosgrove <davidacosgroveaz@gmail.com>
2023-10-19 05:01:27 +02:00
Ric
90d22c94c5 Fixes #6664 (#6692)
* add some testing

* fix issue

* update doctests
2023-09-07 12:32:38 +02:00
David Cosgrove
2dd9c5f3cd RASCAL MCES (#6568) 2023-08-27 13:51:49 +02:00
Paolo Tosco
350370abe3 - Changed all unsigned to unsigned int for clarity (#6646)
- Switched from dynamic to static allocation for an instance of `MCSParameters`
- Switched to using `auto` where possible
- Added a few `CHECK_INVARIANT` where appropriate before dereferencing pointers
- Moved some inline comments to the previous line to improve readability
- Added a early check for `CompleteRingsOnly` in `checkBondRingMatch()` to improve computational efficiency
- Removed `RingMatchTableSet` entirely as 1) it is unnecessary since its functionality is already provided by `RingInfo` 2) it abused the `userData` pointer. This allows cleaning up and simplifying the code, particularly the Python wrappers which had a significant amount of added complexity to support it
- Removed all the code that was deprecated several releases ago
- Reimplemented ringFusionCheck() from scratch to address several bug reports; also switched from std::set to boost::dynamic_bitset for better efficiency
- Replaced boost::tie with boost::make_iterator_range
- Modernized `for` loops where possible
- Removed entirely the QueryRings structure as its functionality is already available in RingInfo
- Removed entirely the _DFS() function since the same algorithm can be implemented in a simpler and more efficient way using RingInfo (from 2m28.441s to 2m9.859s for the same task)
- Replaced std::vector<bool> with boost::dynamic_bitset
- Replaced C-style casts with C++ casts
- Replaced some size_t with unsigned int
- Refactored checkIfRingsAreClosed() such that checkNoLoneRingAtoms() is not needed anymore
- Added a test for slow runtimes with CompleteRingsOnly
- Setting Timeout to 0 means no timeout, as it should be
- Removed unused `steps` variable from `MaximumCommonSubgraph::growSeeds`
- Storing both Atom and Bond pointers and their indices on Seed and MCS data structures is time-consuming and a potential source of incons
istencies; storing pointers is sufficient
- Promoted `MaximumCommonSubgraph::match` from `private` to `public`
- `NewBonds` was declared `mutable`, but `Seed::fillNewBonds()` was incorrectly declared as `non-const`, which caused the need for an ugly
(and unnecessary) `const_cast`.
I have now removed the `const_cast` and correctly declared functions that alter `NewBonds` as `const`, since `NewBonds` is explicitly `mut
able`
- Removed some useless random scoping that was peppering the MCS code
- Removed a significant amount of duplicate code from the Python wrappers by inheriting from a base `PyMCSWrapper` class
- Fixed #6082
- Fixed #5510
- Fixed #5457
- Fixed #5440
- Fixed #5411
- Fixed #3965
- Fixed #6578

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-08-25 06:09:19 +02:00
Jeremy Monat
0caa9a01fb Add early example of drawing a molecule to Getting Started with the RDKit in Python (#5803)
* Add early example of drawing a molecule
and corresponding image, Cc1ccccc1.png

* Remove stray text

* Add: import Draw

* Assign image to a variable
2023-03-03 07:01:15 +01:00
Greg Landrum
0a2cb42d84 The new Filters should have a FilterSet property (#6129)
* add molecular filter examples

* Update Docs/Book/GettingStartedInPython.rst

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

* Update Docs/Book/GettingStartedInPython.rst

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

* Update Docs/Book/GettingStartedInPython.rst

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

* Update Docs/Book/GettingStartedInPython.rst

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

* Update Docs/Book/GettingStartedInPython.rst

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

* Add additional info example

* the new Filters should have FilterSet members

---------

Co-authored-by: Rachael Pirie <56546141+RPirie96@users.noreply.github.com>
2023-02-27 07:41:04 +01:00
Rachael Pirie
5a9a3e0ce5 add molecular filter examples (#5647)
* add molecular filter examples

* Update Docs/Book/GettingStartedInPython.rst

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

* Update Docs/Book/GettingStartedInPython.rst

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

* Update Docs/Book/GettingStartedInPython.rst

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

* Update Docs/Book/GettingStartedInPython.rst

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

* Update Docs/Book/GettingStartedInPython.rst

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

* Add additional info example

* get doctests passing

* one more update to doctests

* another typo

<sigh>

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-02-24 17:52:55 +01:00
Greg Landrum
82dd73d079 Fix a problem with pickling molecules with more than 255 rings (#5992)
* Fix a problem with pickling molecules with more than 255 rings

* fix doctest
2023-01-30 23:24:00 -05: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
b85cfe1f2e Make it easy to calculate all 2D descriptors (#5892)
* remove deprecation warning

* add CalcMolDescriptors() function

* Also add all python descriptors to the C++ Properties interface

* add to docs

* rip the property stuff back out
2022-12-27 05:39:28 +00:00
Greg Landrum
eec737b432 Fixes #5395 (#5437)
* Fixes #5395

* fix a failing doctest
2022-07-20 16:05:11 +02:00
gedeck
44db7c0b5e Update GettingStartedInPython.rst (#5350)
Fixes a text rendering issue
2022-06-03 13:40:54 +02:00
Greg Landrum
cca9475aa3 [Operational] get windows CI builds working again (#4672)
* try cleaning up the similarity map tests a bit before disabling them
completely on windows (temporarily)

* disable tests on windows (temporarily hopefully)

* disable similarity map doctests in Getting Started
2021-11-06 07:43:50 +01:00
Vincent F. Scalfani
2138c51b8c Add 3 new examples to Cookbook. (#4404)
* add 3 new examples to Cookbook.

* adjust test setup in GettingStarted and RDKit_Book docs

* removed unnecessary rdMMPA import
2021-08-09 17:03:39 +02: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
Greg Landrum
af3bb3e78b Allow partial deserialization of molecules (#4040)
* make pickling/depickling conformers optional

* make de-pickling properties optional

* support the new options in molecule ctors

* update doctest
2021-04-24 07:22:55 +02:00
Greg Landrum
5167c99fa3 Documentation cleanup and update (#3922)
* include info about query rendering

* Fixes #3897

* update images

* better documentation for the conformer generator

* conformer not conformation

* switch to using context managers and make sure we add hs before generating conformers

* yay more docs

* Finishing #3917

* more documentation of backwards-incompatible changes
2021-03-17 09:02:12 +01:00
Greg Landrum
1fe204841f Add Kier Phi descriptor (#3864)
* Add Kier Phi descriptor along with tests

* warn about hybridization
2021-03-06 09:40:27 -05:00
Paolo Tosco
19c9a3905c Enhanced generateDepictionMatching2DStructure functionality (#3811)
* - generateDepictionMatching2DStructure can be used with referencePattern smaller than reference
  to only use part of a scaffold
- adds generateDepictionMatching2DStructure overload to pass a matchVect instead of doing a substructure match
- adds allowRGroups parameter to enable using a scaffold bearing R groups as reference

* changes in response to review

* added comments

* fixes failing doctest

* - reverted change committed accidentally
- fixed get_sss_json for the case where R groups are not included in the match
- added tests for the return value of generate_aligned_coords

* Documented the value returned by GenerateDepictionMatching2DStructure (Python)

* changes in response to review

* - changes in response to review
- fixed sortMatchesByDegreeOfCoreSubstitution that was not working
- added Python wrappers for sortMatchesByDegreeOfCoreSubstitution and getMostSubstitutedCoreMatch
- added C++ and Pyhon unit tests for the above

* added missing variable initialization

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2021-02-24 05:37:31 +01:00
Maximilian Greil
f6c23dc0bd Fix for Github issue 2530 (#3657)
* Github issue 2530

* Fix unittests

* Fix unittests 2

* Fix doctests

* Change name of default method back
2020-12-19 05:49:11 +01:00
Greg Landrum
b510e06720 Documentation update (#3488)
* remove a bad documentation file
add new documentation module stubs

* tweak docs
2020-10-13 04:45:44 +02:00
shrey183
8ea1ac6112 [GSoC-2020] Generalized and Multithreaded File Reader (#3363)
* fixed issue #2965

* added test case for issue #2965

* fixed formatting and added comment.

* update

* General Reader files

* removed dependency on boost filesystems

* removed class

* clang-format

* added-comments

* further-cleanup

* added clang-formatting

* braces-for-if-else

* changed error messages, added option for windows file path

* fixed getFileName function

* cleanup

* option for filename without path

* further-cleanup

* added tests for determineFileFormat

* cleanup, const arguments for validate function

* init

* cleanup

* cleanup

* clang-format does not work for CMake

* added RDK_TEST_MULTITHREADED option

* add-flag

* cleanup

* Delete ConcurrentQueue.h

This PR deals with the Generalized File Reader.

* Delete testConcurrentQueue.cpp

This PR deals with the Generalized File Reader.

* no change

* concurrent queue

* print values

* Single Producer Multiple Consumer works

* cleanup

* Producer Consumer Example

* update queue methods and tests

* cleanup

* test

* fixed tests

* cleanup, updated tests

* Delete ProducerConsumer.h

* Delete testProducerConsumer.cpp

* cleanup

* futher cleanup

* changes based on feedback

* make queue non copyable

* psuedocode

* possible implementation

* untested implementation

* change class to typename

* basic-setup

* need to fix segfault

* need to fix blocking

* need to fix blocking

* need to fix blocking

* fix indentation

* one possibility

* without lambda function

* possible fix with some test cases

* performance tests

* added support for record id and item text

* cleanup

* cleanup

* fixed memory leak and added methods with tests for getting last id and item text

* cleanup

* added more test cases with different smi files

* cleanup

* SD mol supplier

* modified the parsing for SDMolSupplier

* cleanup

* cleanup

* new file for testing

* added support for reading molecule properties with tests

* thread-safe logging and exception handling

* cleanup

* without thread safe logging

* cleanup

* cleanup, modified MultithreadedSmilesMolSupplier

* cleanup, made reader and writer functions private

* move O2.sdf

* basic python wrapper with tests

* cleanup, added new methods for python wrappers

* made changes suggested by Andrew

* file and compression formats are case-insensitive

* cannot open files with gzstream

* cleanup

* possible fix for opening compressed streams (SMILES)

* removed seekg() and tellg() methods from multithreadeded suppliers

* cleanup

* test cases for python wrappers

* some wrapper cleanup

* cleanup, removed unused functions

* update the MT tests so that they actually do some work
also includes some cleanup here

* cleanup

* remove iterator_next header include

* added support for multithreaded readers

* use getNumThreadsToUse for multithreaded suppliers

* fixed documentation for multithreaded python wrappers

* commented performance test

* first draft of final evaluation report

* removed inline variables

* first draft getting started in python

* fixed typos in getting started in python

* fixed typos

* fix documentation tests

* fixed documentation tests

* added links to important files and PR

* added perfomance results

* first version of wrappers with compressed streams

* getting rid of streambuf stream method

* modified General File Reader

* make this work when building in non-threads mode

* rename a test

* rename a function in the python API

* rearrange the python test a bit

* disable the stream-based constructors in Python

* mark the multithreaded classes as experimental

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-10-09 04:31:05 +02:00
Greg Landrum
717c62d9de fix documentation typo 2020-10-02 06:43:57 +02:00
Greg Landrum
d2d87909de Add support for abbreviations (#3406)
* support read-only access to cstates from python

* expose GetBrackets

* expose getAttachPoints too

remove vestigial SubstanceGroupCState_VECT

* backup

* backup

* basics working

* backup

* add label_mol_abbreviations

* fix a bug in the chirality handling

* add linkers, needs more testing

* add another peptide test

* sanitize results by default

* just need rings

* getting started with the C++ form of abbreviations

* a bit of error handling

* add findApplicableMatches

* actually apply the abbreviations

* make the getDefault functions more efficient

* add labeling (creating s groups)

* docs

* basic python wrappers (maybe this is enough?)

* add _displayLabel and _displayLabelW support to MolDraw2D
update the docs for that

* use displayLabel props

* add more default abbrevs

* change default linker defns
add parseLinkers convenience function

* make sure attachment point atoms aren't aromatic

* change the color of dummies to be darker gray

* remove python implementation

* support abbreviations in the java wrappers

* add abbreviations to the csharp wrappers

* add abbreviations to the js wrappers

* add molParity to the list of atom props not written to CXSMILES

* support condensing SUP substance groups

* add that to the python wrappers

* Update testAbbreviations.py

* clear ring info if we added it

* document that the molecules with abbreviations removed have not been sanitized
2020-09-28 17:09:46 -04:00
Greg Landrum
1a3ce773cf Molecule metadata in PNGs (#3316)
* reader stub. Navigates the file successfullly

* works

* works

* read out all metadata, not just ours

* first pass at reading out molecules

* support mol blocks too

* add python wrapper for parser

* add direct writer

* get rid of multiple definitions in PNParser.h

* update from code review

* robustification

* handle reading compressed metadata

* support compressing metadata too

* reorder arguments to make this more consistent

* add writers to python wrappers

* forgotten file

* add pickle support

* explicit zlib dependency

* get windows builds working
at least with conda boost+zlib

* switch to using boost::iostreams to do the compression/decompression

* switch to using a vector of string pairs to store the metadata

need this so that we can contain "duplicate" keys

* add metadata output to MolDraw2DCairo
still need python test

* add a python test

* initial work at reading/writing reactions from PNGs

refactor the ReactionParser.h header a bit

* cleanup debug messages

* reaction PNG support -> python

* ReactionPickler no longer includes all ProductTemplate props

* handle metadata at the MolDraw2D level
Currently only supported by MolDraw2DCairo, it's worth extending this to SVG too

* support reading multiple molecules from a png

* support multiple molecules from files and in python

* stop duplicating tags with multiple molecules

* update to get windll builds working
this change should be propagated to more cmakelists.txt files

* make sure the metadata ends up in the notebook

* make sure PNGs in the notebook also have metadata

efficiency improvements for some notebook bits (i.e stop going PNG->Image->PNG)

* no need to pretend that we might be using PIL anymore

* documentation

* update docs to show new functionality

* not sure why the doctests failed on linux

* still trying to diagnose those failures

* protect doctests in case python interpreters are being re-used

* switch tags

* the wrapped functions to read png data from files weren't working

* <sigh>... windows dlls
2020-08-25 07:51:18 +02:00
Paolo Tosco
3d831d8809 Fixes #3095 (single-atom MCSs are not captured) (#3109)
* - fixes #3095 (single-atom MCSs are not captured)

* - fixed doctest

* - changes in response to review

* - fixed typos

* - fix Windows compiler error
2020-05-05 13:58:33 +02:00
David Cosgrove
6d1266615b Updatecppdocs (#3039)
* Updated CMakeLists.txx

* Updated all examples, extended some.

* Added info about highlighting atoms.

* Added info about annotation to python getting started.

* Minor tweaks.

* Minor tweaks.  Can only examine the rst in GitHub.

* Minor tweaks.  Can only examine the rst in GitHub.

* get doctests working

* update an example image

* Include the GettingStartedInC++ doc in the standard docs build

* move the C++ docs after the python docs

* update backwards incompatible changes doc

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-03-27 14:19:17 +01:00
Greg Landrum
80cc117b4b update docs for 2020.03 (#3028)
* update release notes

* more doc updates

* meta!

* last minute

* version bump in CMakeLists.txt for beta
add an additional doc template
2020-03-23 15:25:07 +01:00
Greg Landrum
9f90a24f41 add random seed to docs to get reproducible conformations (#3026) 2020-03-23 06:13:24 +01:00
David Cosgrove
774892a9ab 2ddrawenhancements2931 (#2979)
* First pass of fixing layout of OH/NH type drawing.

* Fixed scale for N/S NH type groups.

* Fixed bond end points with new display of heteroatoms.

* Fixed case where it drew aromatic dashed bonds in wrong ring for morphine.

* Minor edit.

* Fixed non-drawing of chiral bonds.

* Removed use of boost for_each.

* Modern atom traversal.

* Put in fixed scale for drawings.
Made drawMolecule() take note of prepareMolsBeforeDrawing.
Updated more iterators to modern idiom.

* Added fixed bond length for drawing.

* Fixed drawing of CH4, NH3 etc.

* Stash of working but ugly, prior to re-work.

* Better, simpler splitting of atom symbols.

* Took clang-tidy's advice about use of override.

* Tidied up drawing of text strings.

* Tweaked what is classed as vertical bond in drawing.

* fixedBondLength now down-scales if it would overflow the draw window.

* Some tidying.

* Tests for new parameters in JSON.
Fixed some existing tests where, for example, scale on picture is now different.

* Added option to rotate 2D draw coords before drawing.

* First pass at highlighting atoms in multiple colours.  Circles only at the moment.

* Line width scales if big enough.

* Tweaked SVG text drawing.

* Added highlighting with more than 1 colour on an atom.  C++ only.

* Fixed some issues with widths of highlights in a frustrating game of whackamole.
Updated some tests accordingly.

* Added Python wrapper for new drawing code.

* Removed debugging writes.

* Added C++ test for multi-coloured highlights.

* Added python test for multi-coloured highlights.

* Attempt to show radicals.

* Tidied up radicals in drawing, including a bullet instead of full stop in SVG.

* Fixed catch_tests.cpp for MolDraw2D.

* Fixed crash in Python wrappers on OSX.

* Fixed test5_2.svg bug (trailing </tspan>).
Made wavy line width scale as other lines do.

* Improved placing of charges.

* We're already in the future.

* Fixed a number of bugs that made drawMolecules not set the scales properly.

* Fixed Cairo wavy line width.

* Fixed non-closure of collision boxes.

* Added maximum font size for text, with tests.

* Addressed all Greg's first PR change requests.

* Fixed crash in extractAtomsymbols.

* stop using coordgen and adjust tests to reflect that
there's a bit of reformatting in here too

* Fixed layout of reactions.

* Fiddled with moldraw2DTest1 tests again.

* Fiddled with catch test.

* Fixed istope postion in W atom labels.

* Minor tweak to cairo,

* update expected results

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-03-10 17:33:59 +01:00