15 Commits

Author SHA1 Message Date
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
6c966b4fe5 RGD code cleanup (#7186)
* RGD code cleanup
- made an effort to give more meaningful names to variables (e.g., renamed most instances of attachment (point) to avoid ambiguity as attachment may be interpreted as either the R-group atom or its neighbor atom on the core, which are two different things)
- replaced the old school removeAtom() method with begin/commitBatchEdit()
- added std::move and std::make_move_iterator where relevant to avoid potential unintended copying
- replaced instances of container.size() == 0 and !container.size() with container.empty() for better clarity
- replaced std::map::find() with std::map::at() where the key was not needed
- replaced expensive std::find_if with more efficient alternative
- added some missing const keywords and added references to avoid copying where appropriate
- replaced for loops with modern implicit looping alternatives where convenient
- avoid calling MolToSmiles when VERBOSE is not defined as the result is anyway not used
- removed "oops, exponential is a pain" code snippet as I believe 1. it is never executed 2. it is not tested 3. I do not think it is correct
- removed check for data->matches.size() > 1 as I do not believe it is correct
- Use std::unique_ptr::reset instead of defining a new std::unique_ptr and moving it to the original one

* changes in response to review

* change in response to review

* replaced std::set with boost::dynamic_bitset to save time on std::set::insert and std::set::find

* make sure we do not go out of bounds

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-03-03 05:34:13 +01:00
Greg Landrum
1f4584b2ca run clang_format (#5676) 2022-11-01 04:14:26 +01: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
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
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
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
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
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
Brian Kelley
015fed1e67 rgroup speedup (#3279)
* First part of restructuring rgroup decomposition classes

* Add docs

* Cache often calculated values and simplfy lookups

* Fix accidentally deleted code

* Merge doc changes

* Remove unused timing code

* Remove unused header

* Remove redundant doc string

* Fix chrono issues

* Response to review

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2020-07-12 06:56:15 +02:00
Brian Kelley
adf19f7517 RGroupDecomposition restructuring (#3270)
* First part of restructuring rgroup decomposition classes

* Add docs

* Move doc strings before structs
2020-07-08 11:47:00 -04:00