Commit Graph

32 Commits

Author SHA1 Message Date
Greg Landrum
58b79c6f8e BondDir not cleared from bonds that aren't stereoactive (#6162)
* backup

* update .gitignore

* passes tests

* all tests now pass

* update release notes

* cleanup

* changes in response to review
2023-03-07 15:15:11 +01:00
Greg Landrum
4d4b927651 Fixes #6049 (#6061)
* backup

* backup

* Fixes #6049

Bump version of NumBridgeheadAtoms descriptor

* add a specific test for the issue
2023-02-09 08:31:39 +01:00
Greg Landrum
ec67021fa0 Fix #6011 and #6012 (#6013)
* stop finding potential nontetrahedral sites when nontetrahedral stereo is disabled
stop matching [PH3] as potential stereo

* add another test
2023-01-26 19:26:19 +01:00
Greg Landrum
6372a7b201 Do deprecations for the 2023.03 release (#5675)
* remove SmilesParserParams::useLegacyStereo

* MinimalLib JS deprecations

* PandasTools deprecations

* update release notes
2022-11-01 13:29:58 +01:00
Paolo Tosco
268ef03198 we want to use _putenv_s also in MinGW builds (#5711) 2022-10-31 06:40:09 +01:00
Ric
aaf85e7d7c Fixes #5659 (#5660)
* fix issue, add test

* check all common rings
2022-10-18 15:16:26 +02:00
Greg Landrum
867c2976f9 Fix bad interaction between the useLegacyStereo options in the SMILES parser (#5576)
* partial fix

* prepare testing code for the deprecation

* more detail in the release notes
2022-10-07 16:53:59 +02:00
Ric
c946bb8a6d Fixes #2984 (#5560)
* fix issue

* add / reenable tests

* Do cheap test first

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

* remove underscores from function/variable names

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2022-09-15 04:55:31 +02:00
Greg Landrum
c060e5de98 New version of AssignStereochemistry (#5442)
* bring over some new functionality

* adjust your expectations

* more tests

* additional cleanup and testing

* implement fix from #5407

* more testing

* a bit of optimization

* add the new func to the python wrappers

* cleanup

* findPossible working in the new code
NOTE: the combination of findPossible and cleanIt does not work and needs to be disallowed

* do some cleanup

* better handling of UNKNOWN (not unspecified) atoms and bonds

* update

* backup... we're close

* catch_chirality tests all pass

* all tests pass

* cleanup

* docs and a bit of optimization

* "optimization" which makes things slower... maybe revert this

* we don't need cleanExistingStereo() anymore... get rid of it

* cleanup

* changes in response to review
2022-09-06 12:53:02 +02:00
Ric
d5aa4f5b5c Fixes #5403 (#5407)
* add a test

* add potential fix
2022-07-07 14:42:28 +02:00
Greg Landrum
fbaa6fd36c Fixes #5307 (#5310)
* Fixes #5307

* python doc string
2022-06-09 06:11:17 +02:00
Greg Landrum
cb0f48388a Prevent wedging ring bonds (#5356)
* a bit of modernization

* change weighting preferences for wedging bonds

Really try not to wedge ring bonds.
2022-06-09 04:51:32 +02:00
Greg Landrum
d640eb98c9 [WIP] Fixes #5327 and #5328 (#5330)
* Fixes #5328
Fixes #5327

probably a good idea to add a bit more testing here

* more tests!
2022-06-01 04:45:14 +02:00
Greg Landrum
d2a05ecef2 Add a global feature flag to enable the "new" stereo perception code (#5309)
* add a global feature flag to control use of the new chirality code

* expose that flag to minimallib

* add getters for allowNontetrahedralChilrality and useLegacyStereoPerception

* switch to using environment variables to store the values

* document that
correct the documentation about nontetrahedral stereo

* yay visual c++

* in response to review
2022-05-27 16:52:59 +02:00
Greg Landrum
cd74dc2207 Initial support for non-tetrahedral stereochemistry (#5084)
* very basics: actually parsing the new atom stereochem features

* add some input verification for the chiral permutations

* fix a typo
add quadruple bond SMILES/SMARTS extension

* add forgotten files

* patch from Roger

* add Roger's parsing examples

* typo

* new tests

* adjusted version of next PR from Roger:
- add SP2D hybridization for square planar (this may change)
- some modernizationof Chirality.cpp
- stop using < HybridizationType in Chirality.cpp (should probably do this elsewhere too)
- improved handling of hybridization assignment for new stereochem
- handle new stereo/hybridization in UFF
- tests for the above

* perception of non-tetrahedral stereo from 3D (from Roger S)
Basic testing of SP and TB based on opensmiles docs

* potential fixes for octahedral assignment
more tests

* docs update
need way more!

* map the TH tags directly to @ tags

* very basics of SMILES writing
this does not work with anything that changes the permutation order
like canonicalization or writing things in rings.

* start to support the getChiralAcross API

* more testing

* consistency

* add hasNonTetrahedralStereo() and getIdealAngleBetweenLigands()

* assignStereochemistry should only remove non-tetrahedral stereo

* re-simplify those tests

* cleanup matrix stream output

* initial pass at supporting nontet stereo in distgeom

* backup

* start on the reference docs

* TBP reference

* first pass at Oh finished

* update SP section

* more doc updates

* fix a typo

* add param to not remove Hs connected to non-tetrahedral atoms

* VERY basic coord generation for square planar

* TBP basics

* basic OH depiction

* start testing missing ligands
allow non-tet stereo in rings (ugly, but correct)

* add new TBP functions from Roger

* update depiction code for new API

* backup, the new tests work so far

* Finish the TB tests

* OH tests pass too

* cleanup

* first pass at getting correct SMILES with reordering
need way more testing than this

* ensure permutation 0 is correctly preserved

* some progress towards adding non-tetrahedral stereo to StereoInfo

* doc update

* add non-tet chiral classes to python wrappers

* make sure removeAllHs also gets neighbors of non-tetrahedral centers
more testing

* a bit of depictor cleanup

* make the assignment from 3D more tolerant
more testing

* improve the bulk testing

* cleanup

* remove a bit of redundant code

* ensure we don't write bogus permutation values to SMILES

* fix some rebase problems

* allow assignStereochemistryFrom3D() to be called without sanitization

* allow disabling the non-tetrahedral stereo when it's not explicit

* get that working on windows too
2022-05-20 09:07:16 +02:00
Greg Landrum
ca5d470b48 Fixes #5239 (#5247) 2022-04-29 18:05:43 +02:00
Greg Landrum
7e7fdb0f29 Fixes #5196 (#5201)
* Fixes #5196

This fixes the bug as reported, but there's more work to do in order to get the other cases

* cleanup

* fix assignStereochemistry()

* Fixes #5200

* move those functions to the public API

* fix assignStereochemistry

* cleanup

* refactoring in response to review
2022-04-15 05:13:45 +02:00
Greg Landrum
4bbbc6611d Add a CXSMILES option to the MolHash (#5058)
* Nonchiral atoms should be removed from StereoGroups

This fixes a bug where atoms which have no chirality were left in StereoGroups

In order to make this work, ROMol::setStereoGroups() needed to be made public.
That shouldn't be a problem since it doesn't change connectivity.

* support CXSmiles extensions in the hashes

* initial tests for that

* some cleanup

* copyright header cleanup

* minor refactoring

* call out the changes in the release notes

* extension and more testing

* add python wrappers
2022-03-03 16:00:38 +01:00
Greg Landrum
7e575db3c4 AssignStereochemistry should remove nonchiral atoms from StereoGroups (#4986)
* Nonchiral atoms should be removed from StereoGroups

This fixes a bug where atoms which have no chirality were left in StereoGroups

In order to make this work, ROMol::setStereoGroups() needed to be made public.
That shouldn't be a problem since it doesn't change connectivity.

* fix some broken old tests

* update cartridge tests
2022-02-08 05:17:34 +01:00
Alex Rebert
e2b0a850d7 Fix memory safety issues found by OSS-Fuzz (#4983)
* RWMol: replace atom in stereo groups

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36998, a
use-after-free in initFromOther.

* Fix out-of-bounds write in iterateCIPRanks

If the rank has not changed in the current iteration, the cipEntries
vectors might not have increased in size. Accessing `numIts + 1`
resulted in an out-of-bounds write. This commit skip the cipEntries
update when the rank is unchanged.

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28660

* Fix use of uninitialized values in MolSGroupParsing

`stream >> count` may silently fail without an exception. In that case,
`count` was uninitialized but used. This commit initalizes `count` to 0,
as well as other variables that may be read without being initialized.

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25220
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25225

* Fix vector size cast in streamReadVec

In 32-bit systems, the implicit conversions from 64-bit to a 32-bit
size_t could lead to an underallocation of the vector. This would follow
by a out-of-bounds write while trying to populate the vector. Now, the
code throws an exception in case of a cast that would change the size.

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28034

* RWMol: improve atom replacement in stereo groups

This code is cleaner and more efficient.

* Add test for replaceAtom and stereo groups
2022-02-06 05:06:38 +01:00
Ric
1c6b70fff3 fixes (#4569) 2021-09-28 04:42:39 +02:00
Greg Landrum
df72c241c5 Improve test coverage and some bug fixes (#4536)
* test getIdOfEntryWithBitId()

* remove unused functions

* improve bv tests in python wrapper

* more UniformGrid tests

* improve deprotect coverage

* improve abbreviations coverage

* add operator!= to DeprotectData

* more testing for adjustQueryProperties

* fix a copy-paste bug

* copy-paste bug

* more testing

* more testing

* more testing

* fix an edge case bug in getValenceContrib

* more bond tests

* add operator!= to StereoInfo
tests StereoInfo::operator==

* make some internal functions testable

* more testing

* minor code cleanup

* fix some bad caching behavior in getDistanceMat() and get3DDistanceMat()

testing

* test FixeMolSizeMolBundle() copy ctor

* deprecate BalabanJ

* more testing

* testing

* mods to get things working for windows DLL builds
(don't bother running some of the tests there)

* fix a typo
2021-09-26 07:45:06 +02: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
Greg Landrum
f47703e706 Fix some problems with perception of ring chirality in spiro-linked systems (#4280)
* add the tests

* backup

* cleanup

* Fixes #4279

* additional testing

* revert the changes to Chirality.cpp
they didn't solve the problem anyway
2021-07-02 14:14:02 -04:00
Greg Landrum
91d2093dd0 Fixes #4238 (#4255)
* prefer to not wedge bonds to double bonds

* addWavyBondsForStereoAny() works

* add option to clear bond stereo

* support wavy bonds in prepareMolForDrawing()

get rid of MolDraw2D/catch_main.cpp

* add a drawing example

* name the bug correctly

* add that new functionality to the python wrapper

* remove some debugging cruft
2021-06-22 10:51:09 +02:00
Greg Landrum
4ee7af88e6 Fixes #4155 (#4192)
removes the shared-bond restriction for potential chiral centers
add support for chiral bridgehead nitrogens
2021-06-03 05:10:15 +02:00
Greg Landrum
02c269f036 Fixes #4115 (#4117) 2021-05-07 10:21:48 -04:00
Greg Landrum
487b1c9d51 Fix definition of bridgehead stereo (#3968)
* support ring stereo from Ns

* modify the definition of bridgehead from #3958

* changes in response to review
2021-03-24 14:45:35 +01:00
Greg Landrum
4d747d5945 Allow three-coordinate bridgehead N to be chiral. (#3958)
This is a followup from #3632
2021-03-22 19:27:55 +01:00
Greg Landrum
b81e313c51 Fix #3631 (#3632)
* Fixes #3631

Still worth investigating *why* this happened.

* a bit of simplification/refactoring
2020-12-12 05:50:29 +01:00
Greg Landrum
170796a175 Fixes some problems with findPotentialStereo() (#3499)
* backup, definitely does not work

* remove obsolete test
(not even really sure anymore that's a bug)

* remove code from a false path

* at this point the code passes all tests

* backup

* handle isotopes and h counts properly

* remove some compiler warnings

* all tests passing

* Use InChI minimimum ring size for bonds

* Fixes edge-case bug in canonicalization when bond labels are provided

* cleanup, no substance here

* fixes the last set of problems I've seen

* document that this is still experimental

* remove obsolete/testing comments

* stop considering charge and H count in chirality
2020-10-17 04:35:58 +02:00
Greg Landrum
19bdd21de1 Updated code for chirality perception (#3324)
* add new test (it fails, of course)

* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure

* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests

* backup

* oops

* backup

* switch to always using four atoms for bonds

* backup

* add new test (it fails, of course)

* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure

* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests

* backup

* oops

* backup

* switch to always using four atoms for bonds

* backup

* this now actually works

* doc update

* add a test to demo that ring stereo is not working

* more testing

* add a fun CIP test

* add review note

* debugging

* remove extraneous debugging
turn off tests for ring-double bond stereo

* disable the ring-stereo fix... this breaks a few tests, but we will recover

* works, needs cleanup, chirality code needs re-testing

* nothing works

* Fixes #3322

* Python and C++ tests now pass

* clang-format

* first pass at python wrappers

* improve doctest

* basic optimization...
stop with the copying

* rename

* all tests passing again

* optimization

* fix the sort in the tests

* looks like this might fix the windows-dll build problems

* update tests

* the fun never ends

* comment cleanup

* handle deliberately unspecified atoms/bonds

* add cleanIt option

* add flagPossible

* add option to use the new code to the SMILES parser

* additional testing

* additional testing

* a bit of additional testing never hurts

* changes in response to review

* fixes a bug with potential parastereo not being cleared

other changes in response to review

* update docs
2020-09-02 15:00:29 +02:00