41 Commits

Author SHA1 Message Date
Paolo Tosco
97bb4a7f37 Improvements to 2D depiction and alignment/RMSD calculation (#5598)
* update AvalonTools to version 2.0.1

* Improvements to 2D depiction and alignment/RMSD calculation
- Refactored the straightenDepiction code which is now much simpler and more readable and supports a minimizeRotation parameter
- added C++, Python and JS tests for the new minimizeRotation parameter
- refactored tests to use CalcRMS rather than an internal implementation to compute RMS deviations
- Removed duplicated code in CalcRMS() and getBestRMS() and made their APIs consistent with respect to supported parameters
  IMPORTANT NOTE: for backwards compatibility I set the CalcRMS() default for the  new symmetrizeConjugatedTerminalGroups
  to false as this parameter was not originally supported. @greg: I would be very much in favor of setting this to true instead
  if you agree, even though it might change results for existing scripts, as I think it is a much more sensible default.
- Improved documentation to clarify the difference between CalcRMS() and getBestRMS()
- Added unit tests for CalcRMS() as there was none previously
- Added tests for the additional CalcRMS() and getBestRMS() parameters
- Added a new getBestAlignmentTransform() function
- The CFFI function set_2d_coords_aligned() now returns the matching atoms similarly to the C++, Python and JS counterparts
  IMPORTANT NOTE: this required an API change for the additional char ** parameter used to return the match.
  Existing code using set_2d_coords_aligned() will fail to compile and will require a last NULL parameter to be added to compile again
- Removed duplicated code between CFFI set_2d_coords_aligned() and JS generate_aligned_coords()
- Added has_2d_coords() to the CFFI library
- generate_aligned_coords() now supports JSON parameters and the previous versions are deprecated
- set_2d_coords_aligned() and generate_aligned_coords() both support an alignOnly parameter (which defaults to false).
  If set to true, rather than re-generating a fresh 2D layout around templateMol, the existing coordinates (if any) are simply aligned
  to the provided templateMol. If the molecule has no coordinates, a set of 2D coordinates is generated independently of templateMol
  and then aligned to the provided templateMol
- avoid that when acceptFailure is false set_2d_coords_aligned() and generate_aligned_coords() overwrite existing coordinates

* - explicitly link testDepictor to MolAlign library

* - add MolAlign dependency to testDepictor (rather than to the catch test as in the previous commit)
- add a couple of tweaks

* suppress compiler warnings (1st pass)

* warnings: 2nd pass

* warnings: 3rd pass

* - alignOnly mode should also support allowRGroups

* - fixed C++ build
- added tests for allowRGroups+alignOnly combination

* changes in response to review

* added an entry to backward incompatible changes regarding set_2d_coords_aligned()

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-10-02 06:24:01 +02:00
Greg Landrum
b558de22c6 Cleanup alignment dependencies (#3317)
* split MolAlign lib into two pieces

* further dependency cleanup

* release notes update

* add a missing dependency to the new library
2020-08-18 07:42:59 +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
John Mayfield
76ed536c87 Branch/vf2 optimisations (#2500)
* Remove out_1 and out_2, only need for directed graphs.

* Variable renaming, no other changes.

* Fix a couple things that were forgotten during the rename

* Only one of these counts is updated now.

* Add ifdef to enable/disable VF2Pruning

* Add degree bound check, could be pushed down to the generic VertexCheck predicate.

* The stack knows at each point what was added, by passing these into the Backtrack call the clone allocation can be removed.

* Indent and rename added_node1 to node1.

* Now the clone is removed we can add a member function to handle the recursion cleanly.

* Also make for MatchAll a member function.

* Set lim=0 to mean infinity.

* VF2Plus optimisation, when candidate is in the terminal set select from a mapped neighbours adjacency list.

* Optimisation hint.

* Use a struct for the Pair removing the need for double pointer and heap alloc/delete of the iterators.

* disable pruning by default (it's a bit quicker to not do this)

* update expected test results

The updated VF2 code can return symmetric results in a different order
than we were getting previously. The results are still correct, but they
change some of the downstream things that don't do symmetrization

* update expected java results
2019-06-30 04:49:24 +02:00
Greg Landrum
09325d32ff Speed up some of the tests (#2398)
This removes some redundancy from some of the test code in order to bring
the runtime down. This does not affect test coverage and shouldn't do
anything bad to the overall test quality.
2019-04-07 06:06:51 +02:00
Ric
a6b26253ff Fix (most of) mem problems (#2123)
* do not use new on loggers

* del pointers in testDistGeom

* Update Dict hasNonPOD status on bulk update

* delete new Dicts in memtest1.cpp

* fixes in MolSuppliers and testFMCS

* PeriodicTable singleton as unique_ptr

* fix EEM_arrays leak

* fix leaks in testPBF

* fix ParamCollection leak in test UFF

* fix leaks in MMFF

* clear prop dict before read in in pickler

* fix leaks in testFreeSASA

* fix leaks in test3D

* modernize Dict.h & SmilesParse.cpp

* fix leaks in testQuery

* fix leaks in testCrystalFF

* fix leaks in cxsmilesTest

* fix leaks in Catalog & mol cat test

* fix leaks in ShapeUtils & tests

* fix leaks in testSubgraphs1

* fix leaks testFingerprintGenerators

* fix leaks in Catalog/FilterCatalog

* fix leaks in graphmolqueryTest

* these changes reduce bison parse leaks

* fixed leaks in testChirality.cpp

* fix leaks + 2 tests in testMolWriter

* fix 4m leaks in substructLibraryTest

* small improvements to molTautomerTest; still leaks

* fix leaks in testRGroupDecomp

* fix leaks in test; parser still leaks

* fix leaks in itertest

* fix 4m leaks in testDepictor

* fixes in smatest; still leaking due to parser

* fixes in testSLNParse; still leaking due to parser

* flex/bison: always add atoms with ownership; smarts error cleanup

* fix leaks in testReaction

* fix leaks in testSubstructMatch

* fix leaks in resMolSupplierTest

* fix leaks in testChemTransforms + bug in ChemTransforms

* fix leaks in testPickler

* fix leaks in testMolTransform

* fix leaks in testFragCatalog

* fix leak in testSLNParse. Still leaks due to Smiles

* fixed most leaks in testMolSupplier

* pre bison fix

* fix some atom & bond parse problems; others still fail

* bison smiles & smarts, atoms & bonds more or less fixed

* fix leaks in molopstest.cpp

* fix leaks in testFingerprints, MACCS.cpp & AtomPairs.cpp

* fix leaks in moldraw2Dtest1

* fix leaks in testDescriptors

* fix leaks in testInchi

* fix leaks in testUFFForceFieldHelpers

* fix leaks in hanoiTest & new_canon.h

* fix leaks in testMMFFForceField

* fix leaks in graphmolTest1

* fix leaks in testMMFFForceFieldHelpers

* fix leaks in testDistGeomHelpers

* fix leaks in testMolAlign

* initialize occupancy & temp facto with default values

* fix leak in TautomerTransform

* updated suppressions

* fix testStructChecker

* fix logging & py tests

* fix TautomerTransform class/struct issue

* remove misplaced delete in testSLNParse

* deinit in testAvalonLib1

* fix Avalon-triggered(?) bug in StructChecker/Pattern.cpp

* fix random testMolWriter/Supplier fails

- diversify output file names to avoid clashing.
- unify Writers close/destruct behavior.
- flushing/closing in tests.

* use reset in FFs Params.cpp

* comments on testMMFFForceField

* unrequired 'if's added to mol suppliers

* correct cast in FilterCatalog.h

* use unique_ptr in MACCS Patterns

* remove unrequred if in new_canon

* update & move suppressions
2018-10-29 14:33:26 +00:00
Paolo Tosco
f7c888844d moved test.h from RDBoost to RDGeneral for consistency with export.h (#2074) 2018-10-11 17:35:23 -04:00
Paolo Tosco
c08ea49bda - enable building DLLs on Windows (#1861)
* - enable building DLLs on Windows

* - export.h and test.h are now auto-generated by CMake
2018-05-16 08:42:41 +02:00
Greg Landrum
108d84ab1e Switch from boost::thread to std::thread (#1745)
* boost::thread mostly gone... still need to get rid of once
everything compiles

* replace boost::call_once

* remove link-time dependency on boost::thread

* first pass at using async

* switch to using async everywhere
2018-02-22 03:43:07 +01:00
Greg Landrum
87786c08b5 Merge branch 'master' into modern_cxx
# Conflicts:
#	.travis.yml
#	Code/GraphMol/FileParsers/MolFileParser.cpp
#	Code/GraphMol/FileParsers/MolFileStereochem.cpp
#	Code/GraphMol/ForceFieldHelpers/UFF/testUFFHelpers.cpp
#	Code/GraphMol/MolAlign/testMolAlign.cpp
#	Code/GraphMol/MolDraw2D/MolDraw2D.cpp
#	Code/GraphMol/MolDraw2D/Wrap/rdMolDraw2D.cpp
#	Code/GraphMol/QueryOps.cpp
#	Code/GraphMol/ROMol.cpp
#	Code/GraphMol/SmilesParse/test.cpp
#	Code/GraphMol/Trajectory/Trajectory.cpp
#	Code/GraphMol/Wrap/Atom.cpp
#	Code/GraphMol/Wrap/Bond.cpp
#	Code/GraphMol/new_canon.cpp
#	Code/RDGeneral/testDict.cpp
#	Code/SimDivPickers/Wrap/MaxMinPicker.cpp
2017-10-05 05:58:38 +02:00
Patrick Avery
f30dea195f Added C++ version of getBestRMS() (#1568)
getBestRMS() was previously a Python-only function. This
adds a C++ version of the function, and replaces the old version.
2017-09-16 04:44:06 +02:00
Greg Landrum
915cf08faa run clang-format with c++-11 style over that 2017-04-22 17:19:10 +02:00
Greg Landrum
7c0bb0b743 clang-tidy output 2017-04-22 17:09:24 +02:00
Doliath Gavid
7244dd01f3 Remove autos and magic booleans 2016-03-26 07:24:38 -07:00
Doliath Gavid
b61503f6ac Add regression tests for aligner 2016-03-25 14:47:16 -07:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Brian Kelley
403a3d6b7c Suppresses Boost warnings 2015-10-18 13:41:03 -04:00
Greg Landrum
49cada6e46 First pass at #586 2015-09-04 11:09:57 +02:00
Greg Landrum
84cd86b92a add some tests for an observed multi-threading bug 2015-07-30 09:46:03 +02:00
Greg Landrum
8c3d698472 remove some compiler warnings 2015-03-22 18:13:58 +01:00
Greg Landrum
73213276e9 add getO3AForProbeConfs()
This is part of #445
2015-03-12 06:10:23 +01:00
Greg Landrum
d421f475b9 make the O3A multithreading tests run a bit faster (do not need to do quite so many reps) 2015-03-12 06:09:09 +01:00
ptosco
13bb831dd5 - removed a few spurious, though non harmful, "const" keywords from
Code/ForceField/MMFF/Params.h, Code/ForceField/UFF/Params.h,
  Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.cpp
  and Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h (I realized
  their uselessness thanks to a warning issued by Intel C++ compiler)
- refactored O3A code
- added the possibility to set weighted constraints on selected
  atom pairs
- added an option to carry out local-only optimization
2014-04-15 22:13:54 +01:00
ptosco
bc88b4393d - Fixed a bug in Code/GraphMol/MolAlign/testMolAlign.cpp which caused
data races in the multithreaded test
- Removed a spurious #include in Code/ForceField/Wrap/ForceField.cpp
- Restored caching in Code/GraphMol/Descriptors/Crippen.cpp
2014-01-24 14:20:34 +01:00
Greg Landrum
c73792bb21 passing all tests 2014-01-24 05:16:56 +01:00
ptosco
18bfae88b7 - Refactored the O3A code to allow for different cost, weight
and scoring functions

- Added cost, weight and scoring functions using atom-based
  Crippen logP contributions

- Added relevant tests for the new functionality

Important points:
-----------------

- The constructors now accept optional pointers to
  MolHistogram objects instead of pointers to arrays of
  double. I think it is better for performance, since
  rebuilding the histogram involves running through two
  nested loops over all atoms, even though the
  3DDistanceMat is provided to the O3A constructor.
  This change breaks binary compatibility with previous
  C++ programs linking to RDKit MolAlign library; I do not
  think this is big issue, and while I was there I made
  other changes which cause binary incompatibility.
  If needed, we may preserve binary compatibility
  reverting the MolHistogram change and the other ones.

- From Python, nothing changed in the interface to previous
  MMFFO3A functionality. It MIGHT be more appropriate to
  change the "GetO3A()" function into "GetMMFFO3A()", but
  I have not done that to avoid breaking existing scripts;
  the choice is yours

- As of now, the code contains a number of conditional
  compilation directives checking for the
  USE_O3A_CONSTRUCTOR macro; if USE_O3A_CONSTRUCTOR is
  defined, then the code is built with an alternative O3A
  constructor which allows choosing whether one wishes
  to use MMFF or Crippen descriptors. Otherwise, no
  alternative constructor is built, but rather two
  functions which return a pointer to an O3A object.
  I prefer by far the first solution (namely, with
  USE_O3A_CONSTRUCTOR defined), but again, the choice is
  yours. The code is tested and works in both cases.

- Custom cost, weight and scoring functions can easily
  be defined in external programs without need to rebuild
  the RDKit, allowing flexibility. The new custom
  functionality can be accessed by calling the "bigger"
  O3A constructor.
2014-01-22 19:30:29 +01:00
Greg Landrum
b8b5263fc3 update data 2013-12-06 05:10:51 +01:00
Greg Landrum
64f01f7506 sync with master 2013-12-06 03:56:07 +01:00
ptosco
170c88ae03 - the RMSD value returned by O3A::align() and O3A::trans() is now
computed in the usual way, while previously the value computed
  by MolAlign::AlignMol(), which incorporates weights, was returned
- the C++ and Python test results were updated accordingly
2013-12-04 23:18:21 +01:00
Greg Landrum
e3b7aa74d2 support providing a distance matrix to the O3A ctor 2013-12-04 15:22:15 +01:00
Greg Landrum
5c99bd0da6 Test O3A thread safety (it passes);
Fixes #161
2013-11-20 07:08:39 +01:00
Greg Landrum
2f6c55f8cc O3A memory leak plugged
Part of #159
2013-11-20 04:29:14 +01:00
Greg Landrum
31e310cd3a merge an O3A patch from Paolo T. 2013-10-12 06:35:21 +02:00
Greg Landrum
b6029fc3ee some small cleanups 2013-10-06 06:56:16 +02:00
ptosco
42cba63468 - propagated the changes in the master branch to the O3A branch 2013-10-01 23:36:35 +02:00
Greg Landrum
b92ac7daa0 this passes all tests 2013-09-30 05:47:48 +02:00
ptosco
d557fc29cc - implemented Open3DALIGN-like alignment functionality (from both
C++ and Python)
- added relevant C++/Python tests
2013-09-29 17:03:14 +02:00
Greg Landrum
f3fbef45c5 update copyright statements 2010-09-26 17:04:37 +00:00
Greg Landrum
fe6b29fec1 dos2unix 2008-02-22 17:57:57 +00:00
Greg Landrum
5d03333c22 setup svn keywords (should have done this before import... grn) 2006-05-06 22:54:39 +00:00
Greg Landrum
75a79b6327 initial import 2006-05-06 22:20:08 +00:00