521 Commits

Author SHA1 Message Date
David Cosgrove
b30b5d586c Option to draw all bonds in symbolColour. (#9304) 2026-05-28 16:46:13 +02:00
David Cosgrove
71e7775d35 Fix layout of reaction components in reaction drawing. (#9302)
* Fix layout of reaction components in reaction drawing.

* <sigh>

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2026-05-27 18:23:17 +02:00
David Cosgrove
ce08c344e8 Github9280 (#9300)
* Fix setFontScale for maximum and minimum font sizes.

* Fix other test.  Add hashcodes.
2026-05-27 06:39:28 +02:00
Brandon Novy
efa7a32c3c MolDraw2D: configurable legend position and vertical side legends (Issue #9023) (#9183)
* Configurable legend position (Top/Left/Right/Bottom) and vertical text (GitHub #9023)

- Add LegendPosition enum and legendPosition, legendVerticalText to MolDrawOptions
- Support legend at Top, Left, Right, Bottom; vertical text for Left/Right
- Python: MolDrawOptions.legendPosition, .legendVerticalText; LegendPosition enum
- Python: MolToSVG() wrapper with legend/drawOptions; doc updates for MolToImage
- JSON: legendPosition (string), legendVerticalText (bool) in draw options
- C++ and Python tests; release note and Cartridge.md docs

* MolDraw2D: legend gutter for horizontal side legends; vertical side height fit

- Reserve horizontal gap between molecule and left/right horizontal legends
  (scale mol to molWidth-gutter, align toward legend strip).
- Position horizontal side legend by measured text width from partition edge.
- Vertical side legends: iterative scale so n*max_h+(n-1)*gap fits panel.
- Catch: long vertical side legend section.

* Update legend-position tests and review-driven cleanup

Use enum/default wording for legendPosition docs, move the lightweight Python test to Wrap, add regex-based placement checks (including horizontal side and vertical stacking), and refactor extractLegend helpers per style guidance.

* Fix MolDraw2D legend edge cases

* MolDraw2D: review follow-up (legend tests, bounds, DRY Top/Bottom)

* Update no-FT legend test coords

* Address PR review: document constants, remove release-note text, and simplify extra-padding logic
2026-04-16 04:59:00 +02:00
Chris Von Bargen
d8f4afb558 Add getSGroupDataLabels() to MolDraw2D_detail namespace (#9189)
Adds a new function MolDraw2D_detail::getSGroupDataLabels() that returns
the text and molecule-coordinate positions of DAT SGroup labels, using
the same placement logic as the drawing code. This allows external
renderers to display SGroup labels consistently with RDKit's placement.

Refactors DrawMol::extractSGroupData() to call getSGroupDataLabels()
internally, eliminating the duplicate FIELDDISP parsing and position
computation logic.

Closes #7829

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 04:56:00 +02:00
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
Chris Von Bargen
e8f2b98f4c Fix link failure on macOS caused by AGL framework injection in Qt (#9139)
* Fix Qt 6.5.8 link failure on macOS due to removed AGL framework

Qt 6.5.8 injects the AGL (Apple Graphics Layer) framework into the
WrapOpenGL::WrapOpenGL imported target's INTERFACE_LINK_LIBRARIES. AGL
was removed from macOS 14+ SDKs, causing a link error when building
MolDraw2DQt on modern macOS:

  ld: framework not found AGL

This workaround filters AGL out of WrapOpenGL::WrapOpenGL's link
libraries after find_package(Qt6) populates them. The guard conditions
(APPLE and TARGET WrapOpenGL::WrapOpenGL) make it a no-op on other
platforms and Qt versions that do not create that target.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Broaden AGL workaround comment to not pin Qt 6.5.8 specifically

The issue may affect other Qt versions, not just 6.5.8.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 06:12:29 +01:00
Eisuke Kawashima
e89c9f656a style: apply readability-braces-around-statements (#8136)
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2026-02-09 12:10:50 +01:00
David Cosgrove
40fe7ef681 Better solid triangles (#8943)
* Change the way solid wedges are drawn to use larger polygons.

* Better variable name.
2025-11-18 09:47:24 +01:00
Greg Landrum
ad1fcb5b7b Use properties in the MolDrawOptions python wrappers to make setting/getting colours easier (#8857)
* support direct property setting/getting in MolDraw2DOptions

* same thing for contourParams

* add getAtomPalette()
2025-10-09 14:14:19 +02:00
Niels Maeder
db93262a3e Add safeSetattr to more params / options objects (#8842)
* add safeSetattr to varios params objects

* added safeSetattr to further params / options
2025-10-08 16:15:20 +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
Ricardo Rodriguez
a4b63d7df5 Minor refactor of the python wrappers (#8847)
* refactor python wrappers

* fix FilterHierarchyMatcher converted already registered warning
2025-10-05 09:42:31 +02:00
Paolo Tosco
805294c27f - move MolDrawOptions JSON parsing code to a separate compilation unit (#8783)
- implement drawingExtentsInclude MolDrawOption taking as parameter DrawElement enum values
- add unit tests for drawingExtentsInclude option (C++, Python, CFFI)

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-09-23 09:27:13 +02:00
David Cosgrove
f90b4382ca Fix drawing of very short arcs in lasso. (#8706) 2025-08-15 08:25:32 +02:00
David Cosgrove
b9666d93b8 Fix offsets for DrawMoleculeWithHighlights. (#8680)
* Fix offsets for DrawMoleculeWithHighlights.

* No Freetype test.

* Trigger Build

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-08-14 07:17:31 +02:00
paconius
1fe07a5eb7 Add option to draw all CIP codes in DrawMol.cpp (#8609)
* enable showAllCIPCodes in DrawMol code

* Made consistent with old behavior + add test

* Added python test

* Fixed FREETYPE=OFF tests

* Fixed FREETYPE=OFF tests

* Adjusted pytest

* Enabled JSON drawer option setting + new JSON test

* update JS docs
2025-07-24 16:46:15 +02:00
David Cosgrove
b418f5974d Fix irritating warning when DrawMolMCHLasso compiled. (#8540)
* Fix irritating warning.

* Don't use back_inserter.
2025-05-27 04:56:35 +02:00
Yi-Shu Tu
18d4d65fb0 Update python def of MolToSVG (Fix #7497) (#8331)
* update python def of MolToSVG

* add unitest for moltosvg
2025-05-27 04:45:00 +02:00
Paolo Tosco
73a7378ddb Avoid a large number of warnings when building MinimalLib with emscripten (#8545)
* - avoid a large number of warnings when building MinimalLib with emscripten, which does not support SHARED
- fix indentation in CoordGen CMakeLists.txt

* disable RDK_USE_BOOST_STACKTRACE on emscripten platform

* revert change done by mistake

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-05-22 05:08:01 +02:00
David Cosgrove
440171cb1d DrawShapeArrow::doesRectClash uses origPts_. (#8535) 2025-05-18 08:13:00 +02:00
Jeremy Monat
7b729a670f Explain DrawArrow and rawCoords=True (#8517)
* Add to DrawArrow documentation: Explain rawCoords, frac, angle, color.

* Fix formatting of DrawArrow docstring

* Enhance Draw functions documentation: Clarify rawCoords behavior for pixel vs molecule frame coordinates.

* Remove Catch2 subproject dependency
2025-05-11 05:21:44 +02:00
David Cosgrove
f00735a310 Fix arrowhead8500 (#8504)
* Fix the arrow heads.

* Tidy.

* Looser tolerance on test.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-05-08 06:48:54 +02:00
Eisuke Kawashima
26033b6578 style: apply modernize-use-override (#8137)
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-25 12:24:58 +02:00
David Cosgrove
0d9e8fb6e2 Protect Python DrawOptions from bad attributes. (#8453) 2025-04-19 06:05:50 +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
Paolo Tosco
71c4103475 Suppress large amounts of 'BOOST_NO_CXX98_FUNCTION_BASE macro redefined' warnings in clang/emcc builds (#7747) 2025-03-29 20:04:58 +01:00
Greg Landrum
33fda86856 Fixes #8308 (#8335)
* Fixes #8308

* fix typo
2025-03-19 12:00:39 +01:00
Greg Landrum
fe5ccb7d47 Feat/use draw color in drawString() (#8334)
* change exception type for bad user input in the MCH code

* use the current draw color with drawText
2025-03-08 10:46:39 +01:00
David Cosgrove
81cc5bc704 Option for standard atom colours with highlighting (#8294)
* Option to use standard atom colours under highlights.

* Update hash codes for catch_tests.cpp.

* Update hash codes for test1.cpp and rxn_test1.cpp.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-02-24 17:46:24 +01:00
Greg Landrum
7311390005 MolDraw2D: add separate colors for atom and bond annotations (#8249) 2025-02-15 08:28:00 +01:00
David Cosgrove
249ff92e96 Option to put padding round elements of reaction. (#8216)
* Option to put padding round elements of reaction.

* Rename the option to componentPadding.

* Missed one.

* Correct filename.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-01-31 05:50:03 +01:00
David Cosgrove
0f3f7c39f8 Fix reaction panel bug. (#8217)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-01-28 14:06:59 +01:00
David Cosgrove
79ec783cab Add option to omit brackets when drawing query atoms. (#8212)
* Fix bond smoothing - apply atom index offset to products.
Update Hash codes.
Tweak side_by_side_images.py.

* Added hash code for new file.  Doh!

* Option to remove brackets from atom lists.

* Python wrapper.

* Change option name after review.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-01-27 16:59:29 +01:00
David Cosgrove
451e57f0ff Fix bond join smoothing in images of reaction products (#8210)
* Fix bond smoothing - apply atom index offset to products.
Update Hash codes.
Tweak side_by_side_images.py.

* Added hash code for new file.  Doh!

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-01-27 12:44:50 +01:00
Hussein Faara
44364fd982 remove no-op macros and dead code (pt 4) (#8037)
* remove no-op macros and dead code (pt 4)

* review comments
2025-01-26 07:49:50 +01:00
David Cosgrove
78b11c8c12 Reaction rendered badly with small canvas size (#8211)
* Remove forcing minFontSize to 12 for reactions.

* Add hash code test.
Run Clang-format.

* Typo

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-01-26 07:35:50 +01:00
David Cosgrove
4f224cee64 Move creation of 2D coords to before markUnspecifiedStereoAsUnknown. (#8179)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-01-23 06:03:20 +01:00
Paolo Tosco
4431fb708c avoid that map::at() throws an exception in case atomColourPalette includes neither 6 nor -1 (#8085)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-12-12 06:13:52 +01:00
David Cosgrove
578b56a7c5 Resolve clashing atom labels in 2D drawing (#8074)
* Move atom labels round if they clash.

* Tidy.

* Re-work orientation logic.
Remove virtual fns from AtomSymbol.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-12-11 09:25:17 +01:00
Ricardo Rodriguez
ff93b2919f look at y if x is very small (#8011) 2024-11-17 06:22:25 +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
Paolo Tosco
39fbc8bfa1 expose preset color palettes to MinimalLib through JSON (#7853)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-10-10 14:30:42 +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
bb066c43f4 add mol processing API (#7773)
* fix aliasing bug in MultithreadedSDMolSupplier

* update GeneralFileReader to v2 API

* add backwards incompatibility note

* v1 of this

* The helper function needs to be inline

* forgot the tests

* allow non-threadsafe builds

* MultithreadedMolSuppliers can now be destroyed without being used.

This was previously not possible

* add callbacks to the multithreaded readers

* document the new functions

* switch to storing the queues in unique_ptrs

* does not work

* only do those tests when in MT mode

* more generalfilereader cleanup

* tests pass

* passes tests

* extremely basic python wrapper

* better wrapper

* does not work

* tests pass

* test data

* fix failing test on ARM macs

we need to followup on why the wedging is different here

* move some stuff to the cpp file

the idea is to have the windows DLL builds not break

* fix(?) win64 linkage problems

* remove a warning in non-multi-threaded builds

* fix non-multi-threaded work

* well, at least local windows builds work

* remove duplicated code

* refactoring
simplification?

* simplify mutext handling

* review suggestions
2024-09-19 18:42:25 +02:00
David Cosgrove
5484738f3e Highlighted hetero atoms disappear (#7672)
* Make atom symbols black if atom is highlighted.

* Only do it for circle and continuous highlights.

* A lot of hash codes changed.

* Check hash code for new file.

* Change the highlighted atom to the same as carbon to accommodate dark mode, for example.

* Change the highlighted atom to the same as carbon to accommodate dark mode, for example.  But get the logic right this time.

* Safer map lookup.

* Stackoverflow says this is better for >= C++17 as only one lookup.
2024-09-16 15:14:14 +02:00
Paolo Tosco
e4f4644a89 - Expose multicolor highlights to MinimalLib (#7787) 2024-09-03 21:03:40 +02:00
David Cosgrove
9aa77acd1f Fix drawing of 2 colour wedges. (#7760)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-08-28 05:58:18 +02:00
David Cosgrove
4c8b27717a Don't do the fancy merging of solid wedges and bond lines for triple … (#7738)
* Don't do the fancy merging of solid wedges and bond lines for triple bonds.

* Changes after review.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-08-23 17:14:15 +02:00