Commit Graph

55 Commits

Author SHA1 Message Date
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
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
8176f5c962 Fail CI builds on compiler warnings + some fixes (#6675)
* enable Werror on Mac and Linux

* do not fail on boost multiprecision pessimizing move

* fix eigen array_bounds warning

* Fix unused arg in Rascal MCS

* fix range-loop-construct warning in Rascal MCES

* fix sign mismatched comparison

* drop unused lambda capture

* allow FMCS timeout test more time under Debug (not a warning!)

* fix fwd declaration of struct RascalClusterOptions

* fix deallocator mismatch

* fix two minor leaks

* fix a real leak

* more minor leaks

* fix another real leak, plus some potential ones

* fix std::move preventing copy ellision

* allow longer run time for debug builds

* make maxBondMatchPairs and getLargestFragSize unsigned int

* make snake case camel case

* update to current master, fix new warnings

* update again and more fixes

* add #include <optional>

* fix char array deallocation

* update and fixes in Marvin writer

* unsigned int

* more copy ellision fixes

* more copy ellision fixes, and typos

* and some more
2023-09-02 04:38:45 +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
Paolo Tosco
312fa9a703 Optionally expose MCS to JS and extend optional compilation to JSReaction and JSSubstructLibrary (#6409)
* reverted all changes that did not really belong to this PR

* I had forgotten ChemReactions_static

* changes in response to review

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-06-07 12:35:55 +02:00
Greg Landrum
1f4584b2ca run clang_format (#5676) 2022-11-01 04:14:26 +01:00
Eisuke Kawashima
ba6d8e0d3b clang-tidy: readability-simplify-boolean-expr (#4639) 2022-03-17 13:50:50 +01:00
David Cosgrove
94cde75973 Make FMCS check bond stereo. (#5009)
* Make FMCS check bond stereo.

* Increase timeouts.

* Remove spare test.

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2022-02-22 06:50:17 +01: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
Ric
6fbcaef135 Fixes #4498 (#4499)
* add fix

* add test

* change fix

* Update Code/GraphMol/FMCS/MaximumCommonSubgraph.cpp

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

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-09-13 17:17:29 +02:00
Paolo Tosco
681f5c6256 - fixes MinGW build (#4347)
- make sure that supplier istream is opened in binary mode or istream::tellg() will
  report wrong offsets on MinGW builds (MSVC will make no difference)
- avoid that in MSVC conda DLL builds the libboost_*.lib static
  libraries are picked by cmake instead of the boost_*.lib import libraries
  by defining BOOST_ALL_DYN_LINK
2021-07-22 06:26:20 +02:00
Paolo Tosco
2433982386 avoid that lone atoms which are part of a ring in one of the molecules become part of the MCS (#4065)
Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-04-27 11:10:29 +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
Paolo Tosco
a93dc21599 Fixes #3886 (#3900)
* fixes #3886

* remove the Python check in response to Greg's request

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-03-11 05:15:18 +01:00
Daniel Paoliello
be5cab546a Include Winsock2.h instead of Windows.h in DebugTrace.h (#3756)
* Include Winsock2.h instead of Windows.h in DebugTrace.h

Including `Winsock2.h` has a number of advantages:
* It is much smaller than `Windows.h`, improving build time.
* It allows rdkit to be used in environments where `WIN32_LEAN_AND_MEAN` is set.
* It is [the recommended way to get `timeval`](https://docs.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-timeval) (rdkit doesn't actually use `timeGetTime`).

* Fix build break in test code

* Fix test failures
2021-01-26 05:35:43 +01:00
Braxton
2235a790c0 3D MCS - Minimal version, no refactoring (#3749)
* 3D MCS

* Move test data to dedicated directory

* 3D MCS: changes based on code review

* Replace conformer generation code in MCS 3D test with mol blocks
2021-01-26 04:50:05 +01:00
Paolo Tosco
7fc8feee9e Addresses #3693 (#3695)
* addresses #3693

* change in response to review

* applied clang -format

* changes in response to discussion
2021-01-07 18:25:08 +01:00
Paolo Tosco
3c3efd80d0 fixes #3458 (#3472) 2020-10-08 06:22:22 +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
Greg Landrum
9892f4740b remove usage of auto_ptr (#3188) 2020-05-26 08:45:26 -04: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
Eisuke Kawashima
75f03412ef Modernize deprecated header inclusion (#3137) 2020-05-04 10:40:57 +02:00
Paolo Tosco
a6cafc4635 Added support for Python FMCS functors (#3023)
* Added support for Python FMCS functors

* - changes in response to review
2020-03-23 11:20:57 +01: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
Eisuke Kawashima
5cd27a242f Fix typo (#2862)
* Fix typo

* Reflect the comments

* Fix more typos
2019-12-31 06:43:27 +01:00
Paolo Tosco
c6503e9f8e Use query molecule rather than ambiguous SMARTS for MCS matching (#2759)
* - MatchFusedRings does not imply CompleteRingsOnly anymore

* - use a more specific query molecule rather than an ambiguous SMARTS string in MCSResult

* - changes in response to review
2019-12-16 04:57:54 +01:00
Paolo Tosco
864fdab349 - MatchFusedRings does not imply CompleteRingsOnly anymore (#2748) 2019-11-29 13:35:39 +01:00
Paolo Tosco
ab021aa960 Add consideration of ring fusion to the MCS algorithm (#2731)
* - Adds consideration of ring fusion to the MCS algorithm

* - removed some commented out lines
2019-10-25 04:35:10 +02:00
Paolo Tosco
589c98c3af Fixes #2714 (The MCS smartsString may still be ambiguous) (#2715)
* - fixes #2714 (The MCS smartsString may still be ambiguous)

* documentation update
2019-10-17 11:19:37 +02:00
Steve Roughley
710bdfa60b Added AtomComparator.AtomCompareAnyHeavyAtom and test cases to FMCS code (#2656)
* Added AtomComparator.AtomCompareAnyHeavyAtom and test cases to FMCS code

* Added AtomComparator.AtomCompareAnyHeavyAtom

* Added AtomComparator.AtomCompareAnyHeavyAtom - fixed test typo

* Added AtomComparator.AtomCompareAnyHeavyAtom and test cases to FMCS code (2)

* Added AtomComparator.AtomCompareAnyHeavyAtom - fixed test cases

* Added AtomComparator.AtomCompareAnyHeavyAtom and test cases

* Update Code/GraphMol/FMCS/FMCS.cpp

Co-Authored-By: Greg Landrum <greg.landrum@gmail.com>

* Reverted tabs to 4 spaces

* Update FMCS.cpp
2019-10-03 17:19:22 +02:00
Paolo Tosco
22b0540cdd Fixes #2662 and #2663 (#2665)
* - fixes #2663 (The C++ MCS code generates ambiguous SMARTS strings)

* - fixes #2662 (C++ MCS code returns a null MCS between
methylcyclopentane and methylcyclohexane)
2019-10-01 16:25:46 +02:00
Greg Landrum
4db0bade46 Fixes $945
Fixes #2420

Tests updated to reflect changes.

The existing CompleteRingsOnly code wasn't actually guaranteeing CompleteRingsOnly at all, it was just causing #2420.
The updated code actually makes sure that bonds that were ring bonds in one of the queries are ring bonds in the final MCS.
This is done via a relatively simple DFS.
2019-04-24 14:30:38 +02:00
Greg Landrum
1d47049f2a add test for #945 2019-04-23 17:32:57 +02: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
Greg Landrum
50d2328251 Fixes #2034 (#2035)
* Fixes #2034

* update release notes to describe that
2018-09-17 06:50:54 +02: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
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
Greg Landrum
4001b2ba0e Add the option to match formal charges to FMCS (#1311)
* very basics of charge checking in

* add the new parameters to the python wrapper. more testing please

* Additional testing.

* update which unittest methods are used
2017-02-28 08:49:28 -05:00
Greg Landrum
9d1e7b73dc normalize line endings on testFMCS_Unit.cpp 2016-01-20 08:51:44 -05:00
Alexander Savelyev
66c52aa701 fmcs: fix fmcs for chiral sub queries #688 2015-12-17 17:17:40 +03:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Brian Kelley
54311dff9c Suppresses warnings in tests 2015-10-18 16:09:58 -04:00
Alexander Savelyev
11105660c8 fmcs: fixes #631 with chiralirty 2015-10-07 14:40:31 +03:00
Greg Landrum
f724a477db test the problem 2015-10-03 07:55:12 +02:00
Alexander Savelyev
e331a57791 fmcs: implement adding an initial seed structure 2015-08-25 14:21:04 +03:00
Alexander Savelyev
654ae2b682 issue #481 was fixed 2015-04-17 18:27:26 +03:00
Alexander Savelyev
ec6ecdd3bc request notes were fixed. chirality algorithm was slighlty improved 2015-04-06 19:53:19 +03:00