Commit Graph

75 Commits

Author SHA1 Message Date
Ricardo Rodriguez
af4e8cf01f propagate string_view (#8858) 2025-10-14 19:15:37 +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
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
Ricardo Rodriguez
a085df44a5 Fix performance issue in PR 7327 (#7391)
* use references, skip batch remove if nothing to remove

* fix commitBatchEdit

* reword comment
2024-04-28 06:16:20 +02:00
Ricardo Rodriguez
9e1dbd2f33 Fixes #7327 (#7328)
* add tests

* fix
2024-04-08 06:12:56 +02:00
tadhurst-cdd
d5d4d194ec atropisomer handling added (#6903)
* atropisomer handling added

* fixed non-used variables,  linking directives

* BOOST LIB start/stop fixes, linking fix

* Fixes for RDKIT CI errors

* minimalLib fix

* changed vector<enum> for java builds

* check for extra chars in CIP labeling

* removed wrong deprecated message

* fix ostrstream output error?

* restored _ChiralAtomRank to lowercase first letter

* changes for merged master

* Fixed catch label for new Catch package

* update expected psql results

* get swig wrappers building

* restore MolFileStereochem to FileParsers

* fix java wrapper for reapplyMolBlockWedging

* some suggestions

* move a couple functions out of Bond

* Merge branch 'master' into pr/atropisomers2

* merged master

* Renamed setStereoanyFromSquiggleBond

* atropisomers in cdxml, rationalize atrop wedging, stereoGroups in drawMol

* fix for CI build

* attempt to fix java build in CI

* attempt to fix java build in CI #2

* New routine to remove non-explicit  3D-geneated chirality

* changed to use pair for atrop atoms and related bonds

* Changes as per PR reviews

* PR review respnses

* PR review reponse - more

* Fix merge from master

* fixing java ci after merge

* Updated the help doc for atripisomers

* update the atropisomer docs

* improve the images

* add the source CXSMILES

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-12-22 04:58:18 +01:00
Gareth Jones
81e9cb2386 Fix stereo bond corruption on RGD. (#6832) 2023-10-28 12:47:58 +02:00
Ric
d033aee043 Optionally forward Enhanced Stereo Group ids (#6560)
* add id members to StereoGroup class

* add optional read id argument to StereoGroup constructors

* add functions forward Stereo Group Ids and assign the missing ones

* update ops updating stereogroups to forward read id

* update CX Smiles to parse/write stereogroup ids

* Add test cases for stereo group id forwarding/canonicalization

* update mol block (V3K only) to parse/write stereogroup ids

* update pickling to parse/write stereogroup ids

* update cdxml parser to store stereogroup ids

* update mol interchange to parse/write stereogroup ids

* update draw code with new stere group ids

* update test

* add some tests

* Update Code/GraphMol/Wrap/rdmolfiles.cpp

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

* Update Code/GraphMol/Wrap/rdmolfiles.cpp

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

* Update Code/GraphMol/Canon.cpp

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

* Update Code/GraphMol/SmilesParse/CXSmilesOps.cpp

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

* review

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-07-27 18:53:40 +02:00
Ric
58d135a874 Reformat C/C++ code ahead of 2023.03 release (#6295)
* format files

* format template files too
2023-04-28 04:42:35 +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
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
Greg Landrum
1f4584b2ca run clang_format (#5676) 2022-11-01 04:14:26 +01: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
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
Greg Landrum
7f73da78a2 Fixes #4809: double bond stereo can now be set after calling replaceCore() (#4827)
* add test

* backup commit

* Fixes #4809

* cleanup

* don't make that change in large rings

* docs
2021-12-29 09:03:09 +01:00
Greg Landrum
85608555fe add ROMol::atomNeighbors() and ROMol::atomBonds() (#4573)
* add ROMol::atomBonds() and ROMol::atomNeighbors() methods

* remove some warnings

* start using the new code

* add default for those template params

* some more applications

* get the SWIG builds working

* get rid of extraneous ref

* remove extraneous comments
2021-10-02 07:28:24 +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
Paolo Tosco
0ce4bcf73c fixes #4019 (#4022)
Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-04-27 09:10:26 +02: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
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
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
1630540ef0 Add cxsmiles query atoms to CTAB parsers and writers (#3261)
* allow CXSMILES generic query atoms to be parsed from mol;
need more tests here

* remove vestigial directory

* Add d_queryType to Query
This opens up additional flexibility with customizing the way queries are handled
Also includes some assorted cleanups in the Query directory

* remove the MolFileSymbol hack added in #3235
We don't need it anymore

* Add support for additional ChemAxon extensions and document them

Signed-off-by: greg landrum <greg.landrum@gmail.com>

* bump pickle version

* add an additional test
2020-07-03 12:51:19 -04:00
Greg Landrum
853d9137c8 Fixes #3197 and #3206 (#3208)
* add tests

* Fixes #3197

* Fixes #3206
2020-06-04 13:27:29 -04:00
Manan Goel
bfc4b3a230 Kekulization error create scaffold network (#3195)
* Fixes #3153
Added logic to handle cases where there is C+ aromatic atom by adding an explicit hydrogen to it

* Improved tests by adding checks if the scaffold network is created correctly

* Replaced implemented linear search by pre-implemented STL find function
2020-06-02 05:55:41 +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
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
ec366c1ab7 Dev/pvs studio cleanups2 (#2877)
* a round of cleanups courtesy of PVS studio

* add a test to make sure that a warning is a false alarm

* bug fix

* Fix a UFF bug

* more PVS studio cleanups

* next round of PVS studio cleanups

* completely remove the chances for that bug

* changes in response to review

* add an additional test
+ a bit of reformatting that snuck in
2020-01-22 15:10:58 +01:00
Eisuke Kawashima
dc7cc84a0c Fix typo [ci skip] 2019-10-17 17:45:50 +09: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
Greg Landrum
f6bbba411d Fix github1734 (#1741)
* Fixes #1734
still want some additional testing though

* formatting

* typo

* add python tests

* response to review
re-enable some forgotten tests
2018-02-15 20:24:40 -05:00
Greg Landrum
ba12d98ad0 Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers (#1713)
* Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers

* Actually delete atoms and bonds...

* RWMol::clear now calls destroy to handle atom/bond deletion

* Changes broken Atom lookup for windows/gcc

* Adds tests for running with valgrind

* Adds test designed for valgrind and molecule deletions

* Removes RNG, actually tests bond deletions

* update swig wrappers

* deal with most recent changes on the main branch
2018-01-07 14:19:47 -05:00
Brian Kelley
5fe9bbb780 Adds ability to read and parse marvin smarts in mol blocks 2017-12-22 08:20:31 -05:00
Greg Landrum
636a0f6e69 Cleanup a bunch of compiler warnings (#1697)
* remove a bunch of compiler warnings

* remove some more warnings on windows (there are still plenty to go...)
2017-12-22 12:59:52 +01:00
Greg Landrum
f6ced134f0 a number of other small changes from manually reviewing the PR 2017-04-22 17:24:57 +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
270f7b76e5 Partial support for reading CXSMILES (#1237)
* add a SmilesParserParams object to prepare for this

* add a SmilesParserParams object to prepare for this

* add tests for the SmilesParseParmas

* support name parsing, should it be the default?

* rename CXNSmiles to CXSmiles;
add a spirit parser for CXSmiles coordinate that is at least syntax correct

* abandon boost::spirit for now; crude atom token parser

* support params in smiles parser (not tested, may not build)

* can read coords and atom labels along with mol names; crude, but works

* read coordinate bonds

* remove some compiler warnings with VS2015

* remove a bunch of compiler warnings on windows

* remove more warnings on windows

* remove more warnings on windows

* backup commit: first pass at parsing query features

* radical spec parsing

* handle attachment points using atom mapping

* switch to a named property for atom labels

* fix handling of the "A" atom query

* add functions to construct A and Q queries (needs more work)

* fix a problem created while cleaning up warnings earlier

* add some additional convenience functions for making generic atoms.
Still need M and to recognize these while writing CXSMILES

* add M queries; update some tests

* fix a linux compile problem

* get the cxsmiles stuff working in python; basic testing

* support "M" in CXSMILES
2017-01-31 13:50:36 -05:00
Brian Kelley
71a0ae32b2 Adds replaceCore function that takes a matchVect (#1013)
* Adds replaceCore function that takes a matchVect

* Fixes error reporting, adds tests

* Switches PRECONDITION to ValueError exceptions

* Fixes MatchVectType annoyance in swig.  Don't know why this is necessary.

* Silences warnings

* Adds working doctests and better explanations.
2016-08-17 04:40:59 +02:00
Brian Kelley
fe7d4fefb3 Dev/chemtransforms chirality (#1006)
* Adds useChirality to replaceCore, fixes atom ordering
  n.b. when replaceDummies==False and labelByIndex==True
   the indices used are the indices of the dummy atom,
   previously they were the atoms the dummy was connected
   to.

* Adds useChirality to the remaining functions in ChemTransforms

* Adds a mess o tests

* Fixes labelByIndex=false ordering for dummies

* Removes debugging statements
2016-08-09 04:41:36 +02:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Brian Kelley
6ebbeb3bd3 Major conversion of std::string API to const std::string & 2015-09-25 15:15:59 -04:00
Greg Landrum
97d8b8a7db this was a similar bug to #584 2015-08-27 10:13:46 +02:00
Riccardo Vianello
7c346d7c2e Code/RDBoost/Exceptions.h moved to Code/RDGeneral 2015-03-16 22:31:48 +01:00
Brian Kelley
95a92282d1 Dictionary access is saniztized and optimized.
o rdkit gains a RDKit::common_properties namespace that contains common string value properties

 o Dict.h and below gain getPropIfPresent that attempts to retrieve a property and returns
  true/false on success or failure.  This is used to optimize access.

 o rdkit learns how to pass property keys by reference, not value.

A new namespace has been added to RDKit, common_properties
that contains the std::string values for commonly used
properties.  This helps to avoid typos in string values
but also avoids a creation of std::strings from character
values.  All accessors (has/get/clear and getPropIfPresent) now pass
the key by reference.

Additionally, getPropIfPresent removes the double lookup
of hasProp/getProp which can be a significant speedup
in the smiles and smarts parsers (10-20%)
2015-01-15 12:23:29 -05:00
Greg Landrum
302b84960b improve docs;
cleanup some compiler warnings;
add parseQueryDefText()
2014-05-03 06:45:35 +02:00
Greg Landrum
d7971cc40c Fixes #171 2013-12-06 06:54:31 +01:00
Greg Landrum
5a340dd454 Fix a typo 2013-03-01 06:53:17 +00:00
Greg Landrum
00655e7bd6 backup commit; may not build 2013-01-29 06:28:31 +00:00
Greg Landrum
03ef0e6f1b Add support for merging recursive queries on the C++ side
(contribution from Sereina Riniker)

A pure Python version of this was in the tutorial material from the RDKit UGM.
2013-01-08 15:13:01 +00:00
Greg Landrum
68e370d581 initial pass at a fix for sf.net issu275 2012-12-18 17:16:06 +00:00