70 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
Brian Kelley
b0ef80d68d Allow labeled atoms to have working queries (#8849)
* Allow labeled atoms to have working queries

* Remove stray keystrokes

* Fix typo

* Apply clang-format

* Move simpler checks first

---------

Co-authored-by: Brian Kelley <bkelley@glysade.com>
2025-10-09 04:46:20 +02: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
8411f4535e 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-11 14:10:00 +01:00
Greg Landrum
9367e207d5 remove some warnings with -Wextra (#7339) 2024-04-11 11:01:59 +02:00
Brian Kelley
693796d7af Enhance molzip to properly handle RGroupDecompositions (#7202)
* Fix zipping of rgroup decomps with broken rings

* Add utility to molzip rgroup rows

* Add RGroupRow molzip

* Fix typo in example and test

* Fix warning on integer size

* Don't use ssize_t

* a couple of suggestions

* Update Code/GraphMol/ChemTransforms/MolFragmenter.cpp

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

* Update Code/GraphMol/ChemTransforms/MolFragmenter.cpp

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

* Move molzip rgroup row from RGroupDecomp to ChemTransforms

* Fix exports

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-03-19 17:02:45 +01:00
MarioAndWario
643a356e44 Fix Mol block parser by resetting atomic number to 0 for COMPOSITE_OR query atoms (#6349) (#6768)
* Fix Mol block parser by resetting atomic number to 0 for COMPOSITE_OR query atoms (#6349)

* Fix fileParsersTest1

* Fix test23MolFileParsing

* Fix testRGroupDecomp

* Fix testSubstructMatch

* Use std::unique_ptr instead of raw pointer

* Add isAtomDummy() to QueryOps.h

* Add `!a->getQuery()->getNegation()`
2024-01-23 17:13:53 +01:00
Greg Landrum
63c7e85046 Update CI, remove some warnings (#6882)
* ci updates

* forgotten update

* inch by inch

* remove unused variable

* try a gcc bump

* get rid of a bunch of unused-but-set errors in clang16

* be more selective

* disable a test in an obsolete module which is mysteriously failing
2023-11-09 13:14:00 -05:00
Gareth Jones
1c33f1a393 RGD: Fix doEnumeration true for cores that are not bundles (#6857)
* Fix doEnumeration true for cores that are not bundles

* Fix doEnumeration true for cores that are not bundles
2023-11-09 15:08:27 +01:00
Gareth Jones
81e9cb2386 Fix stereo bond corruption on RGD. (#6832) 2023-10-28 12:47:58 +02:00
Gareth Jones
b46fc6e28b RGD with matching on tautomers of core (#6611)
* Support tautomer queries in RGD

* Continuing RGD and tautomer development

* Python and C# tests

* Python and C# tests

* C# test

* Typo fix

* For cire tautomer query update properties instead of full sanitization

* Added query comment

* Code review change

* Support Enumeration of input cores

* Mol enumeration test

* Remove useNormalMatch from RGroupDecomp

* Added comments for handling tautomeric core

* Added comments for handling tautomeric core
2023-08-29 08:50:14 +02:00
Gareth Jones
e6cf9e7768 RGD and Stereo Groups (#6247)
* Copy stereo group information to RGroups and Core

* Fix pointer alignment formatting issues

* Created details::copyStereoGroups
2023-04-01 07:58:52 +02:00
Gareth Jones
a383b9e1dd Refactor RGD moving function implementations from header to source files (#5958)
* Create implementations for functions defined in header files

* Fix testRGroupInternals.cpp include

* Add windows dll export to RGroupData

* Fix swig wrappers

* Remove unused RGroupData constructor

* Fix RGD CMakeLists.txt
2023-01-20 15:01:45 +01:00
Gareth Jones
0d68b2f50b Bug/github5613 (#5735)
* Undo change to master

* Fixed typo in tests

* Undo change to master

* Initial development and test

* Sort of working tests

* Copy corodinates to new core

* Clear stereochemistry on core atoms with unlabelled rgroups

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Continuing development

* Updated development

* Fixed Chirality Issues

* All tests working

* Remove some unused code

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Working tests

* Tidy test code

* Adjust catch_rgd for stereochemistry in output cores

* Build ring info in output cores

* Fix Mac OS bug

* Fix for MCS and onlyMatchAtRGroups

* Brian's optimization suggestion

* Fix core group coordinate bug

* Test for replaceCore and multiple core bonds to chiral atom

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Update Code/GraphMol/RGroupDecomposition/RGroupDecompParams.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupDecompParams.cpp

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

* Changes in response to Greg's code review

* R group stereo bond attachment fix

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2022-12-16 05:36:49 +01:00
Gareth Jones
fd1972a4a6 Fix R Goups in matching core are poorly positioned (#5684)
* Fixed typo in tests

* Undo change to master

* Undo change to master

* Recalculate core dummy positions for hydrogen only r groups

* Undo change to master

* Fixed typo in tests

* Undo change to master

* Greg's code review changes
2022-10-30 07:11:28 +01:00
Gareth Jones
afd6586bcf Allow RGD to decompose 2 sidechains on unlabelled core atoms to separate R groups (#5618)
* Initial work preparing the core

* Simple test case working

* Check for labels

* Fix for labels

* Development for core wildcard issue

* Fixed core wildcard issue

* First working test

* Updated tests

* All tests working

* Reorder tests

* Fix failing tests

* Remove uint type

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupUtils.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupDecomp.h

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

* Update Code/GraphMol/RGroupDecomposition/RGroupDecompParams.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupDecompParams.cpp

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

* AddCore method for RGroupCore

* Revert addCore refactoring (thanks Clion)

* Fixed typo in tests

* Minor fixes

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupDecomp.h

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupDecompData.h

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

* Update Code/GraphMol/RGroupDecomposition/RGroupCore.cpp

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

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2022-10-19 04:36:56 +02:00
Gareth Jones
bed7eb1eb5 Fixed R-group attachment positions in RGD (#5570)
* Fixed adding terminal dummy coordinates in replaceCore

* Restore precedence of guess of dummy atoms

* Reverse dummyAtomMap in RDKit::replaceCore
2022-09-20 06:35:13 +02:00
Ric
0d8ad69541 fix warnings (#5561) 2022-09-14 06:36:42 +02:00
Gareth Jones
5a06ba567a Fix for RGD dummy atom bug in RDKit::replaceCore (#5154)
* Fix for RGD dummy atom bug

* Also fix labelling issues in the R group containing input dummy atom

* minor tweaks to the proposed fix

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2022-05-02 14:01:57 +02:00
Gareth Jones
b587a65a27 Fix github5222 (#5232)
* Fix for github5222

* Remove stderr output

* Fix failing tests

* Fix comment

* Revert to old label ordering

* Fix failing tests

* Revert unnecessary change.  Hopefully fix notebook

* Modified RDG Jupyter notebook

* Fix kernelspec in rgd_testing.ipynb
2022-04-27 06:25:05 +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
David Cosgrove
f93016a77f Refactor mol draw2 d (#4948)
* MolDraw2D refactoring
- rename setupMoleculeDraw->initMoleculeDraw
- track whether or not initDrawing() has been called
- centralize calls to initDrawing() and clearDrawing() into initMoleculeDraw()
- update svg hashes in tests

* update some expected test results

* support changing font scale and default scale
add reaction test

* does not work... this is hard

* all tests pass

* do something about legends

* docs

* more tests

* more docs

* cleanup

* going around in circles...
hopefully converging

* cleanup

* Single bond skeleton works.

* Simple bond drawing seems to be working.

* Initial addition of atom symbols.

* Stash of not-quite-working atom symbols prior to major surgery.

* Atom symbols seem to be working.  Major surgery not required, just inverted Y coords at the outset.

* Add classes to atom labels.

* Renamed AtomLabel AtomSymbol.

* Add highlights.

* Fix bug from PR4839.

* Molecule note.

* Added atom notes.

* Added bond notes.

* Extract radicals.

* Annotation via new DrawAnnotation class.

* Add brackets.

* Add linknodes.

* Add close contacts.

* Add attachment points.  Fix wavy lines.

* Draw molecules in grid.

* Tidy.

* Fix radicals when font has hit maxFontSize.
Make getDrawCoords work.

* Draw primitives take atom or draw coords.

* Fix legends.

* More fixing for tests.  DrawMol::setScale now takes font scale as well.

* tidy debug writes

* Variable fraction of panel for legend.

* Better legend positioning.

* Fix sub- and super-script spacing.
Added spaces to Freetype strings.

* Basic reaction drawing.

* Reaction highlighting.

* Minor tweak to reacctions.

* Tweaked reaction DrawMol widths.

* Fix atomTags.

* Fix catch tests except contours.

* Contouring working in catch_tests.cpp.

* Fix catch tests.

* AtomSymbol and DrawAnnotation into MolDraw2D_detail.

* DrawMol and DrawShape into MolDraw2D_detail.

* DrawText inot MolDraw2D_detail.

* Machete out.

* DrawText goes private.

* Move some stuff about, such as StringRect to its own header.

* Python wrapper compiles (but crashes when Draw imported).

* More tidying.  Python DrawArrow failing.

* Linux changes.

* Fixed error in DrawShapeArrow spotted by valgrind.
Fixed some warnings from gcc.

* Maybe fixed DrawArrow.

* Added basic argparse interface.

* Added newlines.

* Changes in response to review.
Non-const args in move constructors and operator=.
Added missing classes to MolDraw2D_detail.
Deleted move operator= where it had been forgotten.
Fixed copyright dates.

* Deleted all default c'tors in derived classes.

* Changes in response to review:
Wedge widths now a proportion of mean bond length in draw coords..
Add padding below legend when positioning it.

* Fix tests.

* Fix the private/protected mess of the new classes.

* Moved doesLineIntersect etc.

* Reinstate original alignString for non-FT drawings.

* More faffing about with reaction layouts.

* Fix font sizes in testGitHub3391.

* Fix atom notes fitting inside fat wedges.

* Fix molecule annotation font size.

* More fixes of rectangle/triangle collision detection.

* Test for highlight linewidth multiplier.

* Use push_back not emplace_back.

* Attempt at better Freetype char spacing.

* Option to turn off TEST_ASSERT. Currently off.

* Fixed embarrassing maths to do with wedge fatness.

* More tidying post-review.

* Document highlight_linewidth_multipliers.

* Expose baseFontSize to Python.

* Changes in response to review.

* Allow DrawMolecules molecules to be drawn to different scales.

* Fix bond sneaking between C:8 in, for example, reactions.

* Fix bad re-factoring.

* Fix globbing.

* Changes in response to review.

* Add invariant check.

* Add draw option to fix font size.

* suggested changes

* Update catch test results.

* Fix expected freetype results.

* Fix non-freetype drawers.

* Fin non-freetype test results.

* get the Qt drawer working too

* Fix disappearing reaction highlights.

* Changes as result of review.

* Fixed non-FreeType hash codes for reaction SVGs.  Extra comment in catch_tests.

* reactant highlighting was clearning properties

* Fix for failing contour python test.

* fix a non-freetype problem

* swig wrappers working

* Bump timeouts in test.

Co-authored-by: greg landrum <greg.landrum@gmail.com>
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2022-02-18 16:30:21 +01:00
Paolo Tosco
1872ea5a47 Fixes a bug with the choice of RGD cores (#4890)
* Later cores with more R-groups should only be chosen when they are structurally related, i.e. when they are superstructures of earlier cores

* Update Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp

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

* Update Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp

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

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2022-01-26 08:55:23 +01:00
Gareth Jones
a9bc39e0d5 RGD: dummy atom in input structure is mishandled (#4863)
* Support wildcard in input structures

* Fix typos

* Handle R groups containing a single wildcard and wildcards with group numbers

* Reorder tests

* Use propety instead of isotope to mark input dummy

* fix the windows DLL builds

* Added constexpr for dummy input atom property

* Omitted to replace one instance of string 'INPUT_DUMMY'

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2022-01-10 13:55:54 +01:00
Gareth Jones
f8241c89e8 RGroup core output aligned to inout structure (#4709)
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-11-27 09:37:19 +01:00
Gareth Jones
922db38086 Fix for cores with atom lists and unit test (#4695) 2021-11-20 04:30:46 +01:00
Eisuke Kawashima
11532089de Run clang-format against cpp (#4358) 2021-10-20 04:25:27 +02:00
Paolo Tosco
823bc93d04 Major speed-up of RGD scoring (#4544)
* speed up scoring of permutations by clever caching of already settled
matches rather than recomputing scores for all matches every time
process() is called

* changes in response to review

* changes in response to review

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-09-30 09:31:49 -04:00
Paolo Tosco
3904b6958d Fixes RDK_BUILD_THREADSAFE_SSS=OFF build (#4349)
* - fix non-threaded *nix builds that currently fail because
  boost flyweight introduces a dependency on pthreads
- make sure that mutexes and futures are only used when
  RDK_BUILD_THREADSAFE_SSS is ON
- fix SubstructMatch failing test when RDK_BUILD_THREADSAFE_SSS is OFF
  due to misplaced #ifdef's
- rename RDK_TEST_MULTITHREADED to RDK_THREADSAFE_SSS in inchi.cpp
  (which is not a test)

* - the limitexternal Linux build is now single-threaded so we make
  sure single-threaded builds do not break in the future
  (suggestion from Greg)

* reverted unnecessary change to Code/GraphMol/FileParsers/testMultithreadedMolSupplier.cpp

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-07-23 14:25:25 +02:00
Gareth Jones
c2fb57c19f RGD - a fix for the cubane issue (single target atom matches 2 user R group attachments) (#4002)
* Most tests working

* All tests working

* Fixed tests after merge with master

* Create header and implementations for RCore

* Updated comments

* Removed old code

* DLL export for MolMatchFinalCheckFunctor

* Information line for failing Mac test

* Log replace core behaviour

* Ordering fix for OSX

* Possible fuzzer fix

* Removed debug output

* Fix unmatched user R group bug

* Code review changes

* Bug fix and ChemTransforms test
2021-05-23 15:16:03 -04:00
Brian Kelley
2bab9e6125 Add return codes and make RGroupDecomp less verbose (#3971)
* Add return codes and make RGroupDecomp less verbose

* Changes in response to review

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-03-26 08:29:54 +01:00
Paolo Tosco
29599cf6b1 Do not add unnecessary R-labels (and an optimization) (#3969)
* - do not add unncessary R-labels
- use a boost::dynamic_bitset rather than a std::set for lookups

* - R group labels can be >0 or <0, not 0, so no need to check for >=0 when looking for user labels
- as soon as a core is found that requires no additional labels to accommodate a molecule, bail out from the loop as no better core can be found
- add a test to better describe the use case for this change
- remove a signed/unsigned warning

* - added an entry to Release Notes to describe the impact of #3969

* avoid French expressions in Release Notes

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-03-25 04:37:06 +01:00
Paolo Tosco
0e3aa77fd0 Make sure that added R-groups have non-zero coordinates (#3877)
* Make sure that added R-groups have non-zero coordinates

* - renamed setHydrogenCoords to setTerminalAtomCoords (and parameters accordingly)
- switched from ROMol* to RoMol& to remove a PRECONDITION
- documented the newly exposed C++ function
- added a Python wrapper
- added C++ and Python tests

* fixed conflicts and added a test

* Update Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp

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

* Update Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp

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

* Update Code/GraphMol/MolOps.h

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

* Update Code/GraphMol/Wrap/MolOps.cpp

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

* changes in response to review

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-03-19 08:17:56 +01:00
Brian Kelley
98237b8ade Fixes #3924 (#3941)
* Fixes #3924
The scoring function was not taking into account empty rgroups which biased certain
arrangements of rgroups that didn't have an rgroup at every position.

* Change in response to review

* Rigger the no_rgroup into EMPTY_RGROUP

* Remove Fix Me label from the geminal rgroup test

* add testUserMatchTypesDefaultScore to test default score on user types

* Fix scoring RGroups with split attachments [*:1]O.[*:1]N.

* Test both scoring functions for testMutipleCoreRelabellingIssues and testUnprocessedMapping

* Update testRGroupInternals.cpp

remove a couple obsolete comments as suggested in review

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-03-19 06:22:36 +01:00
Paolo Tosco
ad8fad0bd6 Remove temporary labels from RGD results (#3947)
* - remove temp labels from RGD results
- remove a debug printout in non-debug builds

* Update Code/GraphMol/RGroupDecomposition/RGroupDecompData.h

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

* Update Code/GraphMol/RGroupDecomposition/RGroupDecompData.h

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

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-03-18 18:23:14 +01:00
Gareth Jones
a6ee6ae537 Tests for RGD default function failures (#3926)
* Tests for default function failures

* Revert tests

* Fix linker matches in the case that they span multiple rgroups

* Change to test required by linker fix

* Update based on Brian's changes

* get windows dll builds working

Co-authored-by: Brian Kelley <fustigator@gmail.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-03-16 13:36:52 -04:00
Paolo Tosco
d6ac27e2ea Fixes issues with unlabelled groups on aromatic nitrogens (#3908)
* make sure that unlabelled R-groups on aromatic nitrogens have correct valence and formal charge to avoid kekulization failures

* change in response to review

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-03-12 14:39:52 +01:00
Gareth Jones
81d3705358 R group match any issue (#3767)
* RGD modifications for any atom and index labels

* Continued development

* All tests working

* Added comment

* CR changes suggested by PTosco

* Fix catch_rgd for autocrlf

* Core dummy matches on output. RGroups on heavy atom. Dummy atoms User rgroups only when they are degree 1.

* Start work on test fixes

* testRGroupDecomp test working

* CPP and Python tests working

* Removed options for matching core query atoms on sidechains

* Windows build fix

* R groups off ring. User group matches single heavy substituent. Remove extraneous hydrogens

* Updated fingerprint variance score and tie selection

* Refactor fingerprint variance score functions to class

* Removed fingerprint distance score

* Boost::trim fix

* Updated RGD test notebook

* Fixed AddHs.cpp

* - fixes the kekulization issue
- avoids that empty R-group labels are included in cores
- makes sure that SMILES cores are always canonical
- adds a few missing const declarations and avoids unintentional copying

* Support for allowNonTerminalRGroups parameter. Remove R groups that contain H or Nothing.  Ignore R group labels on non-dummy atoms

* Fixed tests for Paolo's changes. Rebuilt test notebook.  Increased weighting of rgroup penalty in fingerprint variance score

* remove some debug output

Co-authored-by: Brian Kelley <fustigator@gmail.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2021-03-10 12:56:42 +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
Paolo Tosco
d00dcc29fb Fix RGroupCoreAlignment::NoAlignment not properly matching symmetric RGroups correctly(#3743)
* Improve consistency in R-group tables involviing symmetric groups

* applied clang-format

* much simpler fix

* use equivalent but simpler regex

* changes in response to review

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2021-01-29 15:55:30 -05:00
Gareth Jones
ec5a172886 R group symmetry (#3565)
* Exploration

* Initial work on GA fro Rgroup Symmetry

* GA for rgroup decomp and fingerprint rgroup symmetry scoring

* Continuing development

* Exploration

* Initial work on GA fro Rgroup Symmetry

* GA for rgroup decomp and fingerprint rgroup symmetry scoring

* Continuing development

* Further development

* Continued tweaks

* Function rename

* Continued tweaks

* Bug fix for variance calculation

* Copyright notices. Remove Eigen dependency. RdKit logging.  Clock fix.

* Changes to fix build failures

* Fixes for Windows dynamic DLL build

* Included GA export.h file

* Fixed RGroupDecomp CMakeLists.txt

* Notebooks working, GGroup labelling bug fixed

* Fix windows build.  More options for example GA program

* More bugs found and tests adjusted

* Fixed Python rgroup test

* Trivial change to trigger CI

* OSX java and windows build fixes

* Windows DLL fix

* Fix segmentation error

* proposed change

* Possible fix for segmentation fault

* CR fixes

* CR fixes

* CR fixes

* Recreates molecules from rgroups where possible

Co-authored-by: greg landrum <greg.landrum@gmail.com>
Co-authored-by: Brian Kelley <fustigator@gmail.com>
2021-01-05 09:27:33 -05:00
Paolo Tosco
5e31c975a2 Fixes a few residual issues with the RGD code (#3606)
* - replaced set with vector for SMILES-based R-group equivalence
- the first GreedyChunk is constituted by chunkSize+1 mols
- labeled R-groups may not be extracted when onlyMatchAtRGroups==false
- labeled geminal R-groups are incorrectly scored
- my attempt to introduce consistency in R-group labeling was buggy
- added a DEBUG pre-processor directive to the tests to make debugging easier
- added a unit test
- fixed unit test results which were inconsistent with the expected behavior

* changes in response to review
2020-12-12 08:52:00 -05:00
Paolo Tosco
4b978f0c58 Fixes an RGD issue with cores having dummies adjacent to R-group labels (#3551)
* - fixes an issue with cores having dummy atoms adjacent to R-group labels

* changes in response to review
2020-11-09 08:07:43 -05:00
Paolo Tosco
ffddae7ac4 give a bit more time to debug builds (#3536) 2020-11-03 06:32:17 +01:00
Paolo Tosco
b74a4aeb4c Fixes a few bugs in the R-group decomposition code (#3497)
* - Fixes three bugs in the R-group decomposition code

* - delete iterator properly during loop so the Mac does not complain

* added more tests

Co-authored-by: user173873 <user173873@FF026.local>
2020-10-19 07:46:06 -04:00
Paolo Tosco
5e71c91d05 RGD cleanup, optimization and a better fix for #1705 (#3428)
* - removes an unnecessary O(n) complexity in setting the constant core_atoms_with_user_labels set
- provides a better and more general fix to github #1705
- makes sure that the best R group permutation is chosen based on a stable sorting criterion

* - changes in response to review

* reverted from compute_heavy_rgroup_counts() to compute_num_added_rgroups()

* Suppress warning in removeHs due to having a lot of dummy atoms

Co-authored-by: Brian Kelley <fustigator@gmail.com>
2020-10-05 13:03:17 -04:00
Greg Landrum
edd922c99c Cleanup warnings from clang-10 (#3238)
* stop returning local memory in exceptions

* remove a couple unnecessary copies in loops

* fix a bug in the way the default MMFF aromatic parameters are constructed

* remove a bunch of loop-variable warnings

* remove a bunch of clang warnings

* disable clang warnings in python wrappers

* remove some warnings when building the python wrappers
2020-06-19 17:16:22 -04:00
Greg Landrum
90585c0f0d Add optional timeout to RGroupDecomposition (#3223)
* refactor RGroupDecompositionParameters to directly initialize data members
add params getter for the RGroupDecomposition object

* initial implementation of timeout

* refactor the timeout check
We could move the function that checks and throws the exception somewhere else

* re-enable the tests I stupidly left disabled

* Fixes #3224
add option to skip symmetrization entirely

* test #3224

* stupid mistake
2020-06-15 09:14:20 -04: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
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