15 Commits

Author SHA1 Message Date
Greg Landrum
b1663052b8 Remove Descriptors as a dependency of many other RDKit libraries (#7700)
* move mol weight and formula calculators to MolOps and refactor them a bit.
The descriptors are still there and should remain.

* remove other unnecessary dependencies on Descriptors

* Update adapter.cpp

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

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2024-08-13 13:22:43 +02:00
Greg Landrum
c7c9ad3328 Add in place and multithread support for more of the MolStandardize code (#6970) 2023-12-12 17:21:18 +01:00
Greg Landrum
ac54eb3209 Add an in place version of most of the MolStandardize functionality (#6491)
* reionizer and uncharger and normalizer can now operate in place

* add removeUnmatchedAtoms argument to in-place version of runReactant

When set to false atoms which are not explicitly removed by the reaction are preserved

* Fix a case where transforms were incorrectly updating atomic numbers

* add more inplace operations to MolStandardize

* support those in the Python layer

* support inplace for the rest of the python wrappers

* move a few more functions over to the inplace code
2023-07-21 08:44:41 +02:00
Paolo Tosco
fed45f9483 Allow using heavy atoms only in the FragmentChooser (#4791)
* addresses #4754

* changes in response to review

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2021-12-15 04:56:49 +01:00
Greg Landrum
f5a54af475 A collection of MolStandardize improvements (#4118)
* Swap to using a data structure for default normalization parameters

* bring the default fragment data into the code too

* cleanup

* add reionizer parameters via data

change fragment parse failures to ValueErrorExceptions

* tautomer parameters in the code

* got a little over-enthusiastic in that last cleanup

* use boost::flyweight to cache normalization and charge data params

* a bit more cleanup

* support reading params from JSON

* fragments from JSON
single-call for fragment removal

* add a one-liner for the canonical tautomer

* quick refactor

* Fixes #4115

* complete the parents

* docs

* move the definitions to a namespace and make them const

* see if switching to c++14 fixes the CI compile problems with g++ 5.5

* somewhat uglier way of solving the initalizer list problem
2021-05-19 09:11:23 +02:00
Paolo Tosco
68734762fc Avoid that MolStandardizer segfaults on empty mols (#4119)
* Avoid that MolStandardizer segfaults on empty mols

* changes in response to review

* added missing not operator

Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-05-11 20:11:10 +02:00
Greg Landrum
2e3f31990d Allow batch editing of molecules: removal only (#3875)
* backup

* simple first pass, passes all tests

* cleanup a bunch of existing uses

* ensure that we can safely add atoms/bonds while in edit mode

* add context manager on python side

* handle exceptions properly in those

* changes in response to review
2021-03-11 05:10:43 +01: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
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
Greg Landrum
c09fb2f3f4 fragments need to match bond counts too (#2768) 2019-11-14 13:57:22 +01:00
Greg Landrum
d0c8c3cf8f Fixes #2411 and #2414 (#2412)
* clang-tidy-7 pass

* Fixes #2411

* Fixes #2414
2019-04-19 21:51:41 -04:00
Greg Landrum
9f103a9913 Allow components of the MolStandardize code to be initialized from streams (#2385)
* Fixes #2383 (tests coming in the next commit)
Minor typo fix
Fixes a "bug" in one of the default transforms

* Adds support for directly providing normalization parameter data
instead of requiring the use of a text file.

* allow fragment removers to be initialized with string data

* remove unicode

* allow the reionizer to be initialized from a stream
2019-04-03 04:48:05 +02:00
Greg Landrum
55fb9034a6 Add a skip_all_if_match option to the FragmentRemover (#2338)
* add SKIP_IF_ALL_MATCH argument to FragmentRemover
    Refactor FragmentRemover::remove() to make it more efficient

* implement and test SKIP_IF_ALL_MATCH

* expose the extra option to Python

* add info to logger
2019-03-14 09:32:08 -04:00
Susan Leung
956fdf268c Dev/GSOC2018_MolVS_Integration (#2002)
* short test file for MolVS standardize_sm

* short test file for MolVS fragment

* short test file for MolVS metals

* short test file for MolVS normalize

* short test file for MolVS reionize

* short test file for MolVS tautomer

* short test file for MolVS validate

* long test file for MolVS standardize smiles

* long test file for MolVS fragment

* long test file for MolVS metals

* long test file for MolVS normalize

* long test file for MolVS reionize

* long test file for MolVS tautomer

* long test file for MolVS validate

* Unit tests for MolVS steps

* dropping support for Python2

* molvs/__init__.py

* molvs/charge.py

* molvs/errors.py

* molvs/fragment.py

* molvs/metal.py

* molvs/normalize.py

* molvs/resonance.py

* molvs/standardize.py

* molvs/tautomer.py

* molvs/utils.py

* molvs/validate.py

* molvs/validations.py

* molvs/cli.py

* adapted and renamed molvs/cli.py to work within $RDBASE/Contrib/MolVS/

* setup MolStandardize directories, source with empty cleanup function, header, CMake files

* corrections to empty source, header and test1.cpp

* adding empty functions and initializers to MolStandardize

* empty Metal source, header and added test

* added most of Metal.cpp functionality and made some more tests

* empty functions and initializers to Normalize

* empty functions and initializers to Validate

* added most code for RDKitDefault mode, along with some tests

* restructure for abstract base class ValidateMethod

* written in isNoneValidation for MolVSValidation

* took out isNoneValidation, put in noAtomValidation, neutralValidation, isotopeValidation for MolVSValidation

* added in AllowedAtoms

* added in disallowedAtoms

* corrections to Validate

* added code for FragmentRemover

* extended fragment functionality to include choose largest fragment, added in tests for fragment catalog, fragment remover. Also added fragmentValidation method in MolStandardize

* added another test to testValidate test_fragment

* corrections to fragment

* corrections to Metal

* added code for Normalize

* added normalize member function to MolStandardize and added tests

* added multi fragment functionality to Normalize.cpp and additional tests

* TransformCatalog

* tests for Normalize.cpp

* first bit of cleanup

* added most of Charge functionality and some tests

* some corrections to Charge.cpp and some more tests to testCharge.cpp

* corrections to Charge.cpp

* start of Tautomer Enumerate with some tests

* added BondType option to Tautomer Enumeration

* correcting for some memory leakage

* a few alterations to formatting

* sorting out some memory leaks

* sorting out some memory leaks

* some corrections for PCS test set

* redo tests with updated RDKit

* fixing memory leak

* more fixes after 100kPCS set testing

* using tab as delimiter in CSVs rather than comma

* tutorial for MolStandardize

* still working on Tautomer enumeration

* deleted some empty tests

* starting writing tautomer canonicalize

* rename test_data -> data (the source still needs to be updated)

* automatic source reformatting

* adjust to directory rename

* move the fragment catalog test into the MolStandardize directory
do not create separate library for FragmentCatalog

* stop building separate libraries for the catalogs

* move the CleanupParameters into the MolStandardize namespace

* first pass at python wrapper

* move the py module to the correct dir;
add some python tests;
add standardizeSmiles to python wrapper

* disabling the compareMolVSTest since that requires command line arguments to run

* get this building on windows

* put the python lib in the right place

* further work on python wrapper for rdMolStandardize

* added get and set functions to Metal and wrapped them

* added get and set functions to Metal and wrapped them

* changed construstor of Reionizer class and input args for reionize, wrapped this default

* overload Reionizer constructor so user can input own AcidBaseFile from python

* added Uncharger class to Charge and added test for Uncharger

* wrapped Fragment, fixed some memory leakage, changed some args and return types, added some tests

* wrapped Normalized and changed how Normalizer class is initiated

* changing MolVSValidation structure so user can choose which MolVS submethod they want

* starting to write Wrap for Validate

* now it compiles with Wrap/Validate.cpp

* a couple refactorings around validate

* move the validate code into the rdMolStandardize module

* make sure a valid pointer is returned for standardizeSmiles

* rdMolStandardize.MolVSValidation done and tests added

* half way through AllowedAtomsValidation

* finished AllowedAtomsValidation and DisallowedAtomsValidation

* moved charge, fragment, metal, normalize into the rdMolStandardize module

* changed tutorial to use wrapped code

* added copyrights

* added copyrights

* move the data files

* modify source files to adjust to the move

* added validateSmiles functionality

* removed std::cout

* redid some of the 100k PCS tests

* working on the tutorial

* adding some documentation

* deleting some comment lines

* some changes after pull review

* More changes after pull review

* start of trying to make java wrap

* remove some warnings, add some questions

* additional warning removals, a bit more reporting

* some test cleanups

* enable testing of the java code
2018-09-28 11:24:25 +02:00