Commit Graph

190 Commits

Author SHA1 Message Date
Ricardo Rodriguez
e4c8ed7765 remove (#8872) 2025-10-23 11:21:36 +02:00
Greg Landrum
93d0f8bb74 Fixes #8776 (#8875)
* Fixes #8776

don't call the pseudo-CIP perception code if we really don't need to

* allow calling the pseudo-CIP code from Python

* update doctests
2025-10-17 05:52:27 +02:00
Greg Landrum
6d8fca2fbf Fixes #8689 (#8738)
* add test

* potential fix

* whops\!

* support disabling ring stereo in rankMolAtoms

* pass atom ranks into the ring-stereo detection code

* all tests pass

* forgot a file

---------

Co-authored-by: Ric R. <ricrogz@gmail.com>
2025-09-03 12:15:09 +02:00
Greg Landrum
7a9265b103 Fixes #8420 (#8428)
* Fixes #8420

* Update Code/GraphMol/Chirality.cpp

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2025-04-10 19:15:34 +02:00
Greg Landrum
5c1fa74495 Fixes github #8364 and #8365 (#8366)
* Fixes #8365

* Fixes #8364
2025-03-31 15:58:47 +02:00
Greg Landrum
8ea8ec5e3f Fixes #7983 (#8342)
* Fixes #7983

move the call to cleanupAtropisomerStereoGroups() into assignStereochemistry()

* Additional tests from @susanhleung in #8323

* more testing

* changes in response to review

* changes for review
2025-03-20 07:40:33 +01:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +01:00
Hussein Faara
8411f4535e remove no-op macros and dead code (pt 2) (#8035)
* remove no-op macros and dead code (pt 2)

* test failures due to whitespace changes?

* actually run the testFeatures tests

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2025-01-11 14:10:00 +01:00
Greg Landrum
607912a579 fixes #8060 (#8087)
* fixes #8060

* check the new stereo code too
2024-12-12 18:13:29 +01:00
Brian Kelley
d0fcbdac0d Need to reserve space before assignment (#7964) 2024-10-28 14:11:06 +01:00
Kevin Boyd
54025259d3 Only save the most recent CIP rank for sorting (#7932)
* Only save the most recent rank for sorting

* Remove padding code
2024-10-19 07:17:54 +02:00
Ricardo Rodriguez
077493b209 Fixes #7929 (#7930)
* add a test

* fix issue

* Update Code/GraphMol/Chirality.cpp

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

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-10-18 05:34:50 +02:00
Kevin Boyd
5d840450be Sort CIP entries in place using a lightweight wrapper, only sort tied entries (#7911)
* Sort CIP entries in place using a lightweight wrapper, only sort tied regions

* Address review comments

* Clang-format
2024-10-17 05:42:07 +02:00
tadhurst-cdd
0de215a1f8 Fix canonicalization of stereogroups (#7041)
* 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

* test changes

* 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

* Merge branch 'master' into pr/specialQueries

* changes from previous PR

* Iclude false chiral

* rigorous enhnced stereo canoncalization

* Added more tests and clenup

* removed commented out code

* corrected init of SmilesWriteParams

* added MolFileStereoChem.h to the header files

* Renamed Rxn parser to MrvBlockToChemicalReaction

* To make catch2 work, and match the checksum

* Fixed Structchecker errors

* fix CI for DetermineBonds catch test

* error in catch_test for CI

* Allow custom  smileWriteParams  in GetMolLayers

* misnamed entry point

* ReactionFromMrvString change name

* remove adding writeParams to GetMolLayers

* make rigorous enhanced stereo the default, and fix tests

* only one abs group no longer needs Rigorous Enhanced treatment

* changed string_view to string in catch test

* Canonicalize Enhnaced Stereo only resturne unique smiles

* Now allows or and and groups together

* internal routines inside detail scope

* fix test error

* changed string back to string_view and fixed a CHECK

* Fixes for PR review tests

* Fix RDKit_Book.rst failure on build test

* fix xqm sql test

* updated expected files for cxsmiles_test

* Fixed removal of atom attrs

* Fixed tests after merge of master

* More efficient version of Stereo Groups Canonicalization

* Fixes for ctests

* removed debug code

* readded cipLabel test

* fix generalizedSubstruct/catch_tests.cpp error

* hueristics to improve speed

* Rationaized control of abs groups

* removed unused routine

* added rigorous stereo group treatment to test

* some suggested changes

* Changes per PR review and removed some changes to smiles

* Fixed CI errors

* changes per PR review

* more PR review vhanges and cleanup

* Fixed PSql PKL change

* changes as per PR review

* Restored error type for bad mols for canonicalizeStereoGroups and added a test

* Merge master and fix test in MolDraw2D

* Fix for randomize test error and other PR review comments

* Removed unsued variable to fix mac CI

* do not force aromatization in canonicalizeStereoGroups

* changes as per PR review

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-10-11 17:09:18 +02:00
Kevin Boyd
875596eb12 [IterateCIPRanks] Precompute neighbor indices and counts, sort them together for each atom (#7889)
* Precompute neighbor indices and counts, sort them together for each atom

* Fix copyright

* Fix sort signature, not sure how that ever compiled
2024-10-10 16:27:33 +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
Greg Landrum
8e57151157 Fixes #6757 (#7664)
* assignStereochemistry() should call updatePropertyCache() if it is needed

* Fixes #6757

* update expectations in current tests

* add another test
2024-07-25 15:26:22 +02:00
Greg Landrum
ad3e570dea add findMesoCenters (#7574)
* add option to use chiral presence in atom ranking

* add findMesoCenters

* add includeChiralPresence to python wrapper

* add python wrapper for that

* backup, not working

* backup

* all tests pass

* add tests for partial coverage of stereo groups

all tests pass

* backout the cleanup operations for the initial merge

* track the meso atoms with atom properties.

this is an optimization for later.

* changes in response to review
2024-06-28 04:55:49 +02:00
Ricardo Rodriguez
d6171aaade Fixes #7509 (#7513)
* add a test

* scale pseudo 3d offset

* update inchi test

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-06-14 05:39:48 +02:00
Greg Landrum
ba5f43fa6f Fixes #7438 (#7474)
This moves the function into the Chirality namespace.
2024-05-31 14:41:22 +02:00
Greg Landrum
748f36f7d8 Fixes #7434 (#7446) 2024-05-16 14:32:38 +02:00
Ricardo Rodriguez
ba7deb89a0 Fixes #7346 (#7347)
* add a test

* fix issue
2024-04-11 16:16:47 +02:00
Riccardo Vianello
722cbba894 cleanup RDKit::MolOps::detectBondStereochemistry (#7329) 2024-04-04 19:28:32 +02:00
Ric
3187496d59 make _NonExplicit3DChirality a public property (#7258) 2024-03-16 06:25:22 +01:00
Greg Landrum
6981cb0a39 allow perception of stereo from T-shaped structures (#7183)
* allow perception of stereo from T-shaped structures

* document that in the release notes
2024-03-05 15:59:11 +01:00
Greg Landrum
716b38a2d8 Fixes #7140 (#7150)
* Fixes #7140

deprecates the old version and creates a new one in Chirality.h
adds it to the python wrappers

* changes in response to review

* backup

* support custom labels with templates
2024-02-12 15:50:02 +01:00
Ric
d4fa4c5aed Fixes #7131 (#7132)
* Add a test

* do not consider wedge/dash bonds when choosing controlling bonds
2024-02-06 15:55:42 +01:00
Brian Kelley
eef5aa648e Fixes #7115 (#7117)
Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2024-02-01 05:02:46 +01:00
Greg Landrum
b9a345157e Fixes #7076 (#7092) 2024-01-25 19:31:18 +01: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
Ric
3c494e3425 Fixes #6981 (#6982) 2023-12-16 08:01:33 +01:00
Brian Kelley
4200047dc0 Set squiggle bonds to STEREOANY with stereo atoms (#6877)
* Set squiggle bonds to STEREOANY with stereo atoms

* STEREOANY from squigglebonds is set regardless of sanitization now

* Ensure we have stereo atoms

* Add comment for new behavior

* See if a newer version of cmake works

* rev cmake to a slightly new version

* rev cmake to a slightly older version

* Response to review

* Allow setting of CIS/TRANS in set from squiggle bond

* Fix missing paren

* Add test for the actual enumeration

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2023-11-29 04:52:39 +01:00
Paolo Tosco
36deaefb07 Fixes #6816 (#6827)
* fixes #6816

* cover the case where `CFG=0` is specified, which was missing

* roundtripping a CTAB should not change a cis/trans double bond into a crossed bond after calling reapplyMolBlockWedging(), no matter if the molecule is sanitized or not

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-11-10 20:23:15 +01:00
tadhurst-cdd
d7c01af9c8 Fixes for canonicalization, and stereochemistry (#6743)
* Fixes for canonicalization, and stereochemistry

* chnages from code review

* test that was omitted for canon correction

* PR review changes

* changes as per PR review

* missed file checkint to make PR tests compile

* PR conflict resolution

* change to fix PR buld errors (hopefully)

* line delete to force re-running of tests

* changes as per PR review

* resolve merge conflicts with master

* some suggestions

* revert chirality modifications when sanitization isn't being done

* addl changes: no stereo percept when no sanitize

* missing test expected files added

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-11-06 07:40:23 +01:00
Ric
3720c2ceaf Fixes #6703 (#6705)
* add test

* fix the issue

* make imines w/ implicit H unspecified, but allow unknown

* improve test in 6527

* do not mark double bonds as EITHERDOUBLE if no neighbors
2023-09-28 05:16:17 +02:00
Ric
8176f5c962 Fail CI builds on compiler warnings + some fixes (#6675)
* enable Werror on Mac and Linux

* do not fail on boost multiprecision pessimizing move

* fix eigen array_bounds warning

* Fix unused arg in Rascal MCS

* fix range-loop-construct warning in Rascal MCES

* fix sign mismatched comparison

* drop unused lambda capture

* allow FMCS timeout test more time under Debug (not a warning!)

* fix fwd declaration of struct RascalClusterOptions

* fix deallocator mismatch

* fix two minor leaks

* fix a real leak

* more minor leaks

* fix another real leak, plus some potential ones

* fix std::move preventing copy ellision

* allow longer run time for debug builds

* make maxBondMatchPairs and getLargestFragSize unsigned int

* make snake case camel case

* update to current master, fix new warnings

* update again and more fixes

* add #include <optional>

* fix char array deallocation

* update and fixes in Marvin writer

* unsigned int

* more copy ellision fixes

* more copy ellision fixes, and typos

* and some more
2023-09-02 04:38:45 +02:00
Greg Landrum
5086391cdb Fix a bunch of edge cases in the pseudo 3d chiral assignment code. (#6669)
* handle bonds with zero length around chiral centers

* chirality perception fixes
- fix handling of T-shaped chirality
- catch zero-length bonds
- catch opposing bonds with opposite wedging

* another special case

* more quasi-linear handling

* more progress

* backup

* update

* remove some complication with the neighbor order sorting by just doing a sort
🤦
passing all tests again

* oh, isn't this fun?

* no more t-shaped three-coordinate chirality

* still a couple of tests failing

* all tests pass

* overlapping neighbors without wedges remove stereo

* add test for overlapping atoms with wedged bonds

* make warnings consistent to allow easy parsing

* more testing

* docs
2023-08-31 17:30:16 +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
Brian Kelley
7698842373 Minimal update to fix hang in the legacy stereo checker (#6531)
* Minimal update to fix hang in the legacy stereo checker

* a small amount of cleanup and some refactoring

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-07-13 18:30:15 +02:00
Greg Landrum
fee12b0aa6 Switch to determining atom chiral types from pseudo 3D instead of bond dirs (#6456)
* backup

* backup

* passes a lot of tests

* cleanup; still failing some tests

* pay attention to bond starting points... duh

* all tests pass

* invert y coords

* Scale bonds, make the Wedge detection cleaner, add more tests

* Readd comment

* Use document bond length

* Adds roundtrip test through a molblock

* a bit of cleanup

* remove the old code since we aren't using it any more.

* changes in response to review

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2023-07-04 04:48:55 +02:00
Ric
36c4ec9e2b Fixes #6239 (#6240)
* check for protium nbrs

* Add a test

* fix test id

* fix H detection
2023-04-11 10:42:56 +02:00
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
David Cosgrove
20be664b57 Remove spurious full stops from warnings. (#6124) 2023-02-24 05:07:09 +01:00
Paolo Tosco
177c09cd6b Expose additional functionality to SWIG wrappers (#5614)
* - setenv() should be defined also for MinGW builds, not just MSVC
- fixed getBestRMS signature (ROMol& should be const)
- expose normalizeDepiction(), straightenDepiction(), getBestRMS(), CalcRMS() and getBestAlignmentTransform() to SWIG wrappers
- expose MolFromSmiles() overload taking SmilesParserParams parameter to SWIG wrappers
- expose DoubleVector class to SWIG wrappers as it is needed by alignment functions
- replace std::string with const std::string& in several SWIG wrapper signatures
- build RDKit2DotNet.dll as a 64-bit library on MinGW 64-bit
- add Java tests for the newly exposed SWIG functions
- fixed inconsistent indentation in Chemv2Tests.java

* changes in response to review

* fix typo

* reverted file committed by mistake

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-10-04 05:04:28 +02:00
Greg Landrum
42eed2605d Add CXSMILES support for bond wedging and wiggly bonds (#5575)
* initial support for wiggly and wedged bonds in cxsmiles
add CX_ALL_BUT_COORDS convenience option to CXSMILES writer

* move ClearSingleBondDirFlags to MolOps

* do a better job of handling the wiggly bonds

* mark 3D conformers from CXSMILES

* remove some extraneous printing

* test wD as well

* remove non-applicable test

* basic tests (not passing) for parsing t/c/ctu

* remove test for unimplemented feature

* changes in response to review

* changes in response to review

check for attempt to set the wedging more than once
testing for invalid w blocks
fix a bad comment
2022-09-24 05:44:01 +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
Greg Landrum
550411c493 Fixes #5433 (#5459)
* Fixes #5433
Also a minor bit of refactoring

* update in response to review
2022-07-27 08:05:26 +02:00
David Cosgrove
f9b47d907f Add ACS1996 drawing style (#5425)
* Started on ACS 1996 drawing mode.
Significant change (not by itself, sadly) is that MolDrawOptions::lineWidth has changed from int to double to allow for ACS requirement of 0.6px bond widths.

* Wavy lines and dashed wedges.

* Better dashed wedges.

* Rounder wavy bonds, same as SVG.

* Added FreeSans font for ACS1996 mode.

* Add help functions to write enum classes to ostream.

* Dashed wedge separation now 2.5px between line edges rather than line middles.  Therefore wider gap between lines.

* Increase offset for wavy bond.  Get classes for atoms and bonds in wavy bond correct.

* For SMILES input, option to force wavy and crossed bonds for unspecified stereochem.

* Tidy debugging.

* Extra space round atom labels.

* Extra space between chars in freetype string.

* Reformats.

* Change double bond offset.

* Improve ring double bonds.

* Simple non-ring double bonds all working.

* Tidy.

* All double bonds seem good.

* Remove redundant function.
Move calcTripleBondLines into DrawMol for consistency with calcDoubleBondLines.
Use doubleBondOffset for wavy lines.

* Correct spacing between FT chars.

* Tidying.

* Use MolBlock wedging if there is any.  Needs to be made an option.

* If dashed wedge thick end has bonds of it, stop one dash short.

* Adjust solid wedge ends to line with attached bonds.

* Width of wedge ends now based on double bond separation.

* Change catch_tests.cpp

* Rounder waves in wavy lines.

* Dashed wedges same width even if one dash less..

* Embedded Roboto-Regular font in code.

* Fix docstrings.

* doubleBondTerminal swapped ends.
Deal with O2 - 2 terminal atoms of degree 1.

* Fix terminal double bonds.

* Slightly fatter truncated wedge bonds.

* Fix crash on complicated double bonds.

* Control more assert tests with DO_TEST_ASSERT.

* Fix 2 colour solid wedges.
Fix slanted wedge for morphine (test1_5).

* Change definittion of multipleBondOffset to fraction of mean bond length.

* Don't slant end of solid wedge to atom symbol.

* Fix wiggle separation.

* Fix 2-colour terminal double bonds.

* Fix colours on triple bonds.

* Don't attempt to draw non-existent points in triangle..

* Symmetric bond for P=O and like.

* Fix query bonds.

* Reformatting.

* Tidy up use of font.

* Add FreeSans font and license to $RDBASE/Data/Fonts.

* Draw unspecified stereo as unknown.

* Add check_file_hash.

* Tidying.

* Tidying.

* Start Python wrappers.

* Fix solid wedges for 3-connected atoms.

* Docstrings.

* Tidying.

* Alter width of bond highlights in ACS 1996 mode.

* Expose setACS1996Options and mean BondLength in Python.

* Expose drawMolACS1996Cairo in Python.
Docstrings.

* Extra padding between legend and picture in flexicanvas.

* Python tests.

* Tidy catch tests.

* Tidying.

* Fix catch tests.

* Fix no Freetype tests.

* Draw solid wedge more sensibly..

* Fix bond end at solid wedge.

* Tidy.

* Fix Python Cairo build issues.

* Fix wedge end shape for terminal double bonds.

* Hide the joins at the bond ends.

* Fix gcc pickiness.

* Extra test for no atom labels.

* Change where it looks for FreeSans.ttf for ACS1996 drawings.

* Same number of waves for wavy bonds in SVG and Cairo.

* Same number of waves for wavy bonds in SVG and Cairo.

* rename unspecifiedStereoIsUnknown to markUnspecifiedStereoAsUnknown and move to MolFileStereochem.h

* refactor use of iterators

* py docs update

* undo a bunch of bad formatting changes

* remove FreeSans

* get windows builds working

* Fix problem with Windows build.

* Changes in response to review.

* Align description of unspecifiedStereoIsUnknown in C++ to match Python.

* Still working on file open modes.

* Took out extraneous functions for drawing in ACS1996 mode, including the one that was breaking the windows build.

* Add RDKIT_MOLDRAW2D_EXPORT.

* Fix expected test results.

* Clarified warning.

* RDKIT_MOLDRAW2D_EXPORT missing.

* Windows!

* Update Code/GraphMol/MolDraw2D/rxn_test1.cpp

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2022-07-21 18:11:33 +02:00
Greg Landrum
fbaa6fd36c Fixes #5307 (#5310)
* Fixes #5307

* python doc string
2022-06-09 06:11:17 +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