Commit Graph

67 Commits

Author SHA1 Message Date
jfkonecn
4f0521e116 fixes #3967 (#4190)
* fixes #3967

* modernize test

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2021-06-03 05:13:13 +02: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
1dc9ac3fbf adds a one-liner for getting a vector of random smiles for a molecule (#3002)
* first pass at random smiles vector; c++ version

* add python wrappers for that

* Remove accidental change

* switch to using a cross-platform reproducible RNG
2020-03-12 13:10:29 -04:00
Greg Landrum
9991c5247a cleanup of the SMILES/SMARTS parsing and writing code (#2912)
* first cleanup

* next round of changes. all tests pass

* Fixes #2909

* Fixes #2910

* further cleanup

* some cleanup/refactoring of the Dict class

* remove now extraneous calls to hasProp() before clearProp()

* minor refactoring of RDProps.h

* Switch from using our own version of round() to std::round()

* replace some boost::math stuff with the equivalents from std::

* cleanups in SmartsWrite

* refactor out a bunch of duplicated code

* fix an instance of undefined behavior

* changes in response to review
2020-01-29 15:13:39 +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
Ric
bb3bdb01ea Fix some chirality issues in SMARTS writing/parsing (Issues #2565 & #2568) (#2570)
* forward doIsomericSmiles

* added test for #2565

* fix for my snippet

* update test with Greg's comments

* add braces for readability to MolMatchFinalCheckFunctor

* small refactors: abstract label checking, while/size, final check

* merge loops reading order of bonds -- all tests pass

* fix chiral-lead fragments, allow frags w. degree < 3

* add new test, update old

* add test, update old

* fix (inocuous) bug with ranks assignment in MolToSmarts

* start SMARTS with first non-chiral atom

* use smart pointers in test

* reenable doIsomericSmiles

* update patch for #2594

* remove faulty fragments matching

* review tests, remove wrong flip
2019-10-03 15:33:46 +02:00
Ric
06f79666c1 Use the same criteria to flip chiral atoms in SMILES parsing/writing (Fixes #1028) (#2600)
* symmetrize SMILES read/write chirality flipping

* fix bad escape

* fix test ???

* add a test

* add mol in #1028

* fix sequence test: consider imp. valence in chiral flip decision

* restore Code/GraphMol/Wrap/rough_test.py
2019-08-15 07:47:27 +02:00
Ric
5b23830425 Fix to Issue #2023 (Canonizalizer assumed directed bond must be reversed) (#2598)
* fix

* update test, add mol from #2023
2019-08-12 11:52:59 +02:00
Greg Landrum
d8c49e6dab Code cleanups from PVS/Studio (#2531)
* first round of cleanups based on PVS-studio suggestions

* a couple more

* a few more cleanups

* another round of cleanups

* undo one of those cleanups
we want the integer rounding behavior here

* add a comment to make that clear

* Fix for filter catalog PRECONDITION redundancy
2019-07-13 07:25:37 +02:00
Brian Kelley
373a89021e Change boost int types to std types (#2233) 2019-01-22 17:45:03 +01:00
guillaume godin
d58197f4a2 Fix #2042 allowing python/c++ randomizer smiles generator (#2059)
* Fix #2042 allowing python/c++ randomizer smiles generator

* adding rootAtAtoms randomness

* add the minor change to bypass rules if doRandom

* Add another point of randomness (the initial choice had been missed)
Make the tests cross-platform. Hopefully
2018-10-08 11:09:42 +02: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
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
e625c58bab Add cis/trans tags to double bonds (#1316)
* add cis and trans to bond stereo

* compiles, does not work

* tests all pass

* Whitespace cleanup to recent changes.

* C++ test case for Bond::setStereo using Bond::STEREOCIS and Bond::STEREOTRANS

* Adding a PRECONDITION to Bond::setStereo to make sure the stereo atoms
are already specified if CIS or TRANS is being specified.

E/Z is technically defined by the topology of the molecule so the
stereo atoms are redundant (easier to understand and use!), but
ultimately redundant with the graph. However, CIS and TRANS is _only_
defined in this usage as the orientation of the atoms in the
getStereoAtoms vector.

* Exposing Bond::setStereo to Python and adding test cases to make sure
it can be used to set CIS/TRANS stereochemistry.

* verify substructure matching works

* Adding Bond::setStereoAtoms to C++ Bond class.

This allows setting the atoms to be considered for CIS or TRANS
directly without a much more costly determination of ranking that E/Z
requires.

* Wrap Bond::SetStereoAtoms into python with a new type of test case.

* docs
2017-02-26 08:15:44 -05:00
Brian Kelley
2debdfde0d Adds RDAny (smaller generic holder) Updates all used dictionaries (#896)
* Adds RDAny (smaller generic holder) Updates all used dictionaries

This is an API compliant version of the current rdany system,
but uses a lot less memory in practice.

* Removes code duplication

* Converts CHECK_INVARIANT to TEST_ASSERT

* Fixes DoubleTag issue

* Adds Bool to DoubleMagic implementation

* Removes reference to property pickler
2016-05-29 17:04:21 +01:00
kelley
5dbec2fe85 Adds rdcasts where appropriate 2015-11-29 17:52:27 -05:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Greg Landrum
e37296d7c7 post review 2015-11-14 08:08:14 +01:00
Brian Kelley
5f59333a56 Silences unused parameters 2015-10-18 14:02:29 -04:00
Brian Kelley
a146c3826a Remove unused variables/functions and register keyword 2015-10-18 10:01:00 -04:00
Nadine Schneider
5d963846b8 merge 2015-04-10 09:44:18 +02:00
Nadine Schneider
140dc2d938 Bugfix: consider doIsomericSmiles flag in canonicalizeFragment 2015-03-20 16:38:23 +01:00
Riccardo Vianello
7c346d7c2e Code/RDBoost/Exceptions.h moved to Code/RDGeneral 2015-03-16 22:31:48 +01:00
Nadine Schneider
e013399bb9 Bugfixes and new invariant for chiralAtoms 2015-03-06 15:47:08 +01:00
Nadine Schneider
489d06cfca Constify atom ranks in smiles construction 2015-02-12 08:59:28 +01:00
Nadine Schneider
47dbaf2304 Fix: ring stereo chemistry was swapped incorrectly 2015-02-11 18:21:15 +01:00
Greg Landrum
6d7b2b0914 merge with master 2015-01-22 06:30:51 -05: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
3193f88709 merged with trunk; this builds but it has not been tested at all 2014-11-30 06:33:56 +01:00
Greg Landrum
9830b0e8fd some code cleanup 2014-08-27 22:47:08 +02:00
Greg Landrum
a94ce46a43 smiles tests now pass as well 2014-08-27 22:32:49 +02:00
Greg Landrum
b2a6fd1373 backup 2014-08-27 04:18:00 +02:00
Greg Landrum
e170195421 backup commit; this does not completely work yet 2014-08-03 08:01:58 +02:00
Greg Landrum
23076b1cdb Fixes #298 2014-07-23 05:31:16 +02:00
Greg Landrum
75be63fd6b merge with trunk 2014-02-09 05:00:18 +01:00
Greg Landrum
64366007e1 more C++ style cleanups 2014-01-01 17:16:25 +01:00
Greg Landrum
3b0c72c4bf initial pass at ZBO support.
does not yet handle the HYD and ZCH lines
2013-11-30 06:58:03 +01:00
Greg Landrum
a4734bbd43 start using the alternate getProp form 2013-07-20 07:26:06 -04:00
Greg Landrum
f467bdad9a fix problem caused by github-8 fix 2013-03-14 06:23:13 +00:00
Greg Landrum
24e269f8ac I *think* that this fixes sf.net issue 40:
the long-standing problem with ring stereochemistry and canonicalization
2012-11-02 06:33:11 +00:00
Greg Landrum
f2d9755a65 at this point all tests pass 2012-06-29 03:40:28 +00:00
Greg Landrum
6157345dde this version passes the ZINC natural-products torture test 2012-06-28 06:45:42 +00:00
Greg Landrum
0f3b84cd28 backup commit; we are not quite there yet 2012-06-26 06:15:08 +00:00
Greg Landrum
ee43d3e8f8 another step forward 2012-06-13 05:20:39 +00:00
Greg Landrum
a3dc23c43c more canonicalization improvements
there are still some problems with double bonds
2012-06-11 03:21:30 +00:00
Greg Landrum
c293dc23da initial version of MolFragmentToSmiles 2012-05-19 03:50:31 +00:00
Greg Landrum
de2126b641 optimization work 2012-04-15 06:19:22 +00:00
Greg Landrum
2ffaa92cf7 fix and test issue3228150;
note that as part of these changes MolToSmiles and MolToSmarts no longer have
side effects on the original molecule.
2011-03-26 06:51:50 +00:00