380 Commits

Author SHA1 Message Date
Ricardo Rodriguez
9e301c15d6 Normalize rings (#9208)
* normalize rings

* update tests

* update doctests

* update release notes
2026-04-01 05:37:02 +02:00
Yakov Pechersky
0986d22c58 Deterministic kekulize, independent of atom and bond order (#9125)
* Make kekulization deterministic

* Add tautomer order-independence regression (python)

* Adjust tautomer tests for deterministic kekulization

* Update graphmol wedged-bond kekulization checks

* SmilesParse: update aromatic bond index expectations

* SmilesParse: refresh cxsmilesTest expected files

* Depictor: update testDepictor expected MolBlocks

* Depictor: update depictorCatch expectations

* Depictor Wrap: update expected MolBlock for pyDepictor

* MarvinParse: update testMrvToMol expected outputs

* FileParsers: refresh testAtropisomers expected outputs

* FileParsers: update tests for deterministic kekulization

* MolDraw2D: refresh brittle bond assertions

* RascalMCES: update expected cluster size

* MinimalLib: make cffi wedging check order-independent

* documentation fix

* MinimalLib: update Kekulé bond table in aligned-coords test

* Hoist duplicated lambdas to TEST_CASE scope

* Remove unused originalWedges variable

* Remove redundant bounds check; clarify wedge-end preference

* Pre-sort allAtms by wedge-end + rank

* Use mol.atomNeighbors() for neighbor iteration

* Check inAllAtms before linear-scanning done

* Drop redundant optsV/wedgedOptsV sorts

* Remove unused Canon.h include

* Add canonical parameter to Kekulize; skip ranking during sanitization

* Test canonical re-kekulization preserves stereo across atom orderings

* MinimalLib: update Kekulé bond orders in invertedWedges

* Change Kekulize canonical default to false, expose in Python wrappers

* keep rank order, push_back

* Revert "RascalMCES: update expected cluster size"

This reverts commit a81bb39495.

* docstring change

* expose new flag to python wrapper

* document changes in ReleaseNotes.md

* revert minimallib test changes again

* canonical = true defaults

* Revert "revert minimallib test changes again"

This reverts commit 039e1d84da.

* Reapply "RascalMCES: update expected cluster size"

This reverts commit 7b83a7a3e8.

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2026-03-19 08:43:13 +01:00
Brian Kelley
ecdf55ac2a Fixes a boundary issue when indexing SDF (#9162)
* Fixes an index boundary error in SDMolSupplier

* Add test data

* Run clang-format

* Update Code/GraphMol/FileParsers/testMolSupplier.cpp

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

* Update Code/GraphMol/Wrap/rough_test.py

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

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2026-03-12 13:58:33 +01:00
Greg Landrum
c1b67f0c03 fix the python docs for CanonicalRankAtomsInFragment (#9087)
some clang-format reformatting of rdmolfiles.cpp also is in here
2026-02-07 05:54:10 +01:00
Rachel Walker
664d3194b3 Move some fields and methods from AtomPDBResidueInfo to base class (#8863)
* fix pickling

* added python wrapping and test

* fix expected pickles

* trigger CI

* Apply suggestions from code review

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

* greg suggestion

* remove additional enum values

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2026-02-04 12:13:33 +01:00
tadhurst-cdd
0b5172b62d cleanup of stereogroups and wedges for non-chiral sites (#9051)
* cleanup of stereogroups and wedges for non-chiral sites

* fixed testShapeHelpers for Arm64 build

* reorg the tests a bit

* rename and document option

* add to the python wrappers

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2026-01-30 04:20:32 +01:00
Ricardo Rodriguez
86902488e9 Store CIP-ranked anchors after CIP labeling. (#9056)
* add the _CIPNeighborRanks property

* store CIP-ranked chiral neighbors

* store CIP-ranked SP2 bond and atropisomer anchors

* add a test

* boost headers in test

* add Atom::NOATOM

* add NOATOM test

* amend and clarify implicit H in Tetrahedral

* rename property

* rename property to _CIPNeighborOrder

* deprecate Chirality::StereoInfo::NOATOM
2026-01-29 18:23:44 +01:00
paconius
bea9b11a34 Python Bond Inversion (#8951)
* Exposed Bond::invertChirality() to Python

* Add Bond InvertChirality Test

* Fix test code

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

* Fix unittest

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-11-19 05:54:04 +01:00
Greg Landrum
0ee90279b5 Partial fix to a problem with implicit Hs being written to SMARTS (#8893)
* Partially resolve a problem with implicit Hs ending up in SMARTS

* update doctest

* document in release notes
2025-10-24 07:50:06 +02:00
Greg Landrum
8844c55572 Fixes #8890 (#8891)
stop stripping string properties
updates doc string
adds a test for autoConvertStrings
2025-10-23 08:52:27 -04:00
Greg Landrum
20907d3ba9 Fixes #8877 (#8886) 2025-10-22 07:59:35 -04:00
Ricardo Rodriguez
d9850596aa Fixes #8726 (#8874)
* do not remove hydrides by default

* add a minimal test

* add release note about behavior change

* require Hydrides to have degree 1

* also allow hydrides with degree 0 (ionic bond)

* suggested changes

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2025-10-17 16:51:22 +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
Brian Kelley
d304f9f416 Trim spaces from RDProp strings to simulate reading from SDFiles (#8760)
* Trim spaces from RDProp strings to simulate reading from SDFiles

* Update documentation

* Use the correct doc strings

---------

Co-authored-by: Brian Kelley <bkelley@glysade.com>
2025-09-26 06:14:23 +02:00
Paolo Tosco
9c7ffb33e9 Expose reading/writing PNG metadata to CFFI and MinimalLib (#8381)
* get SynthonSpace.cpp to build also when RDK_USE_BOOST_SERIALIZATION is
not defined

* test should not fail when RDK_USE_BOOST_SERIALIZATION is not defined

* - expose reading/writing PNG metadata to CFFI and MinimalLib
- add relevant CFFI and MinimalLib unit tests
- add RDK_USE_BOOST_PROGRAM_OPTIONS CMake option
- enable using standalone zlib in the absence of boost::iostreams for parsing PNG files
- enable linking against maeparser in the absence of boost::iostreams also on Windows
- enable building RDKit in the absence of boost::program_options

* add check for boost::program_options

* change size_t into std::uint64_t in SearchResults for consistency with doTheSearch() which uses std::uint64_t

* change size_t into std::uint64_t in SearchResults for consistency with
SynthonSpaceSearcher::doTheSearch()

* set CMake policy to allow YAeHMOP to require a version which is not
actually supported

* reverted External/YAeHMOP/CMakeLists.txt to master version

* check if Windows build will work

* fix build

* configure zlib install location

* build zlib dependency

* include zlib header directory

* explicitly set PropertyFlags.AllProps so the test does not fail on
static builds

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-07-23 17:10:38 +02:00
paconius
284012bd3e Update createStereoGroup to accept bond list (#8587)
* Modify createStereoGroup

add bondIdx list

* update python wrapper

* Add CreateStereoGroup tests w/ bonds

* Update StereoGroup.cpp

* Update StereoGroup.cpp

* Update StereoGroup.cpp

* Update rough_test.py

* Update StereoGroup.cpp

added check if atom and bond lists are both empty

* aded test for empty stereogroup creation
2025-06-16 06:04:34 +02:00
tadhurst-cdd
0c70360dab allow limiting the number of stereo groups to process (#8541)
* limit number of stereo groups to process

* limit to stereogroup count added to python wrapper
2025-05-23 04:39:14 +02:00
Greg Landrum
9d4afd0e08 add clearPropertyCache() (#8533) 2025-05-18 08:14:05 +02:00
Greg Landrum
ab1ef7c267 expose cleanupStereoGroups to python (#8515)
Fixes #8467
2025-05-11 05:08:38 +02:00
Greg Landrum
6a63afb767 add StereoGroup.getBonds() to Python wrapper (#8451)
* add StereoGroup.getBonds() to Python wrapper

* test that returning an empty list also works
2025-04-17 16:22:22 +02:00
Greg Landrum
86141183c1 Moving towards getting all tests to pass when using the new stereo code (#8409)
* Fixes #8379

* check in some working tests

* test passes

* test passes

* test passes

* test passes

* test passes

* ensure that the invariants flush the streams on failure

* tests pass

* test passes

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* Fixes #8391

* tests pass

* fix a test with legacy
not clear why this was not causing problems before

* make a test work

* Fixes #8396

* gcc builds work

* fingerprint tests pass

* mention backwards incompatible change

* fix a problem with FindMolChiralCenters

* more testing details

* enable the test status output

* Fixes #8432

fix a bug in double-bond stereo handling for template matching

* all depictor tests pass

* use the new-stereo chiral ranks in the depiction code

* always assign new-stereo chiral ranks

* make _ChiralAtomRank a computed property
This is analogous to _CIPRank

* tweak to the way the atom ordering is computed for 2D coordinate generation

* update two expected results

* backup

* response to review

* tests pass

* tests pass

---------

Co-authored-by: = <=>
2025-04-15 14:00:32 +02:00
Greg Landrum
32608ae0b4 Atoms bonded to metal atoms should always have their H counts explicit in SMILES (#8318)
* refactor the code to determine whether or not an atom is in brackets

* move the definition of isMetal to QueryOps

* atoms bound to metals in SMILES should always be in square brackets

Implementation and some test updates

needs confirmation that all of tests run

* basic tests pass

* java tests pass

* update js tests

* doc updates

* Update Code/GraphMol/catch_graphmol.cpp

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

* Update Code/GraphMol/SmilesParse/test.cpp

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

* finish fixing tests

* bump yaehmop version to allow compilation to work

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2025-03-29 07:26:03 +01:00
Greg Landrum
b40f99eee3 Fixes #8304 (#8316)
* first pass, does not pass all tests

* add an option to control the new behavior

* add that to the python wrapper too

Fixes #8304

* Update Code/GraphMol/MolOps.h

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

* undo some extra comment reformatting

* typo

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

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2025-03-04 14:56:08 +01:00
Greg Landrum
b64aea5082 apply query adjustments when makeAtomsGeneric is enabled (#8315)
* apply query adjustments when makeAtomsGeneric is enabled

* changes in response to review

* I got Python in my C++
2025-03-04 13:50:24 +01:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +01:00
Richard Gowers
8dbe2728f5 fix SetPositions when using strided numpy array (#8150)
* fix SetPositions when using strided numpy array

previously SetPositions assumed that the provided numpy array used contiguous-C stride patterns

* cast to a const pointer to avoid compiler warning
2025-01-09 07:17:08 +01:00
Brian Kelley
bd85b29d43 Fix #4570 Segfault on Property Getters/Setters (#8042)
* Fix #4570 Segfault on Property Getters/Setters

* Revert regression, response to review

* Remove print statement
2024-12-09 14:34:40 +01: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
Brian Kelley
0909d753b8 Fixes #7873 (#7885)
* Fixes #7873

* Resolve MonomerInfo class for deletion

* Add regression test for setMonomerInfo

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-10-11 06:42:52 +02:00
Timothy Palpant
e66f3f35fa Prevent SIGSEGV in SplitMolByPDBResidues (#7880)
* Prevent SIGSEGV in SplitMolByPDBResidues

* Remove bare assertions in unit test

---------

Co-authored-by: Timothy Palpant <tim@atommapper.com>
2024-10-10 14:31:31 +02:00
David Cosgrove
df3403f767 Allow atom map numbers to be ignored when generating canonical SMILES (#7732)
* Add option to ignore atom map numbers when generating canonical SMILES.

* Remove blank line.

* Improve docs.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-08-23 17:15:31 +02:00
Paolo Tosco
14ccb65731 Add missing GetRow method and fix Python parameter names (#7575)
* add missing GetRow method and fix Python parameter names

* - return type of getRow() should be unsigned int, not double, since atomicData.Row() returns unsigned int
- added missing overloads

* fix compilation error in test

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-06-28 12:47:34 +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
Brian Kelley
806a5e931a Add python Conformer.SetPositions wrapper (#7449)
* Add python Conformer.SetPositions wrapper

* Don't register scalar converters, this changes ALL docstrings

* Change TypeError to ValueError

* Remove comment

* Use CXSMiles for coords

* numpy2 compatibility

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2024-06-25 04:38:31 +02:00
Greg Landrum
ea6fbeec30 add MolToV2KMolBlock() (#7511)
* add MolToV2KMolBlock()

small refactoring in the mol block writing

* throw an exception for more than 999 atoms, bonds, or SGroups
update docs for that

changes in response to review
2024-06-13 09:43:59 +02:00
Greg Landrum
2bc3a2d3e2 Allow disabling output of dative bonds to SMILES (#7384)
* basic code to convert dative to single if we aren't outputting dative to the SMILES

add forms of GetAtomSmiles() and GetBondSmiles() that take SmilesWriteParams

* dative/coordinate bond support when writing CXSMILES

* expose all of that to Python

* remove usage of _doIsoSmiles property
add params to smarts writers

* allow disabling dative bonds in SMARTS

* typo

* add support to the reaction writers

* support params for SMARTS
2024-05-25 06:48:55 +02:00
Riccardo Vianello
b5041c3c51 Fix a python 3.12 compatibility issue (#7450) 2024-05-24 07:32:50 +02:00
Greg Landrum
db952786b6 Expose a couple of additional functions to Python (#7444) 2024-05-17 04:47:30 +02:00
David Cosgrove
f48c87444d Expose replaceAtomWithQueryAtom to Python (#7380)
* Expose QueryOpts::replaceAtomWithQueryAtom.

* Indentation error.

* Response to review.

* Update docstrings in response to review.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-05-07 06:50:59 +02:00
Riccardo Vianello
15eaad4bea Allow reapplyMolBlockWedging() to restore the original wedging regardless the bond type (#7386)
* Allow reapplyMolBlockWedging to restore the original wedging regardless the bond type

* update python wrapper for Chirality::reapplyMolBlockWedging

* changes in response to review

* update the API documentation
2024-04-27 06:40:36 +02:00
Matt Swain
aec4a2a868 Remove misleading walrus operators (#7323) 2024-04-03 06:41:35 +02:00
Paolo Tosco
f5431728db make sure outdated ring fusion information is recomputed before attempting to use it (#7274)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-03-20 09:37:10 +01:00
Greg Landrum
01ec60a856 Fixes #7078 (#7155)
* add MolOps::expandAttachmentPoints, along with tests

* support expandAttachmentPoints in the mol file parser

* switch the v2 stuff in the guts of the reaction parser

* add collapseAttachmentPoints()
add addAsQueries option to expandAttachmentPoints()

lots of testing

* an edge case and some cleanup

* add python wrapper for those two functions

* Update Code/GraphMol/FileParsers/FileParsers.h

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

* changes in response to review

- support addCoords in expandAttachmentPoints()
- support the new attachment point stuff to/from CXSMILES
- add MolOps::details::addExplicitAttachmentPoint() and MolOps::details::isAttachmentPoint() utility functions

---------

Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2024-02-28 17:05:53 +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
MarioAndWario
643a356e44 Fix Mol block parser by resetting atomic number to 0 for COMPOSITE_OR query atoms (#6349) (#6768)
* Fix Mol block parser by resetting atomic number to 0 for COMPOSITE_OR query atoms (#6349)

* Fix fileParsersTest1

* Fix test23MolFileParsing

* Fix testRGroupDecomp

* Fix testSubstructMatch

* Use std::unique_ptr instead of raw pointer

* Add isAtomDummy() to QueryOps.h

* Add `!a->getQuery()->getNegation()`
2024-01-23 17:13:53 +01:00
cdvonbargen
45c88e4e1e Add Atom::hasValenceViolation (Take 2) (#7030)
* Refactor Atom.cpp to create a hasValenceViolation method that uses existing valence checking code

* work without exceptions

* get rid of the snake_case

* put free functions in an unnamed namespace

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-01-18 05:06:57 +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
Greg Landrum
c9a46b34bc Fixes #6975 (#6972) 2023-12-11 17:40:30 +01:00
Greg Landrum
ce1a90e47d Fixes #6961 (#6971)
Change the Rcov values used
do some format modernizations
2023-12-09 06:17:53 +01:00
Ric
abbad16899 Fixes #6945 (#6948)
* update default value

* suggested fix and a test (#19)

* fix mistakes in that last PR (#21)

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-12-04 20:33:13 +01:00