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>
* 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
* 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>
* 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>
* 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>
* 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>
* 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.
* 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>
* - When depictions are made using the useMolBlockWedging flag, make sure that kekulization is done after original wedging has been applied to reduce the odds that bond wedges are placed on double bonds
- Refactored MinimalLib code to avoid code duplication
- get_molblock() should reapplyMolBlockWedging on a copy of the passed molecule rather than on the original
- Added unit tests
* Update Code/MinimalLib/jswrapper.cpp
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
---------
Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* support wedging in double and aromatic bonds
This is a first pass and the testing isn't really there.
* add expected test results (from windows...)
switch to not using freetype for the tests
* response to review
* 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
* Before making a wedged bond meet a single bond, check if they're co-linear and skip if so.
* Write the file before the test so we can still look at it if the test fails.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
* 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>
* Revert "Revert "Removed some code duplication between Depictor.cpp and common.h (#6368)" (#6797)"
This reverts commit 824616c5b9.
* security blanket: add back tests of the current usage pattern
* - fixed bug in get_sss_json() (#6806)
- added unit test for the above
Co-authored-by: ptosco <paolo.tosco@novartis.com>
---------
Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
Co-authored-by: ptosco <paolo.tosco@novartis.com>
* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true) to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications
* Fix chirality handling when the chiral atom is the first one in a SMARTS (#6730)
* Set _SmilesStart when parsing SMARTS.
* SmartsWriter should also invert first atoms, like SMILES.
* Update test cases now these SMILES match themselves as SMARTS.
* rerun bison
* cleanup a possible repeated define
* When an atom moves from the first to second position winding should flip in SMARTS (i.e. same as SMILES).
---------
Co-authored-by: greg landrum <greg.landrum@gmail.com>
* Some small cleanups from the UGM Hackathon (#6744)
* move definition of a couple global constants from a .h to a .cpp
* careful removal of some redundant atom PRECONDITIONS
* careful remove of some redundant ROMol PRECONDITIONS
a bit of additional cleanup
* optimization masquerading as modernization
* some more tidying
* a bit more atom cleanup
* change in response to review
* Fixes#6756 (#6780)
* update release notes and cmakelists for beta (#6788)
* move problematic functions to Chirality namespace
* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true) to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications
* move problematic functions to Chirality namespace
* added missing dependency
* let's check what is going wrong
* CoordGen tests should not run if CoordGen support is not available in the build
---------
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
Co-authored-by: John Mayfield <john@nextmovesoftware.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
* Make reaction drawings deal with padding properly.
* Move large lambdas into anonymous namespace.
Correct totWidth after scaling plusWidth.
* Update some hashcodes.
* Take out debugging setting. Bugger.
* Padding on height as well.
* Hash codes.
* Delay padding use in flexiCanvas.
* More centring.
* Light grey background in side_by_side table.
* Tweak agents layout for testReactionCoords.
* Fully ignore missing reagents and products.
* Hash codes.
* Const references.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
* Fix bug where large padding gave a legend font size of 0.
The padding is now implemented by making a smaller, offset drawing area within the width_ and height_, dimensions drawWidth_, drawHeight_. The previous drawHeight_ has been replaced by molHeight_.
* Update test results.
* Update hash codes.
* Update test results.
* Update test results for no freetype.
* Update hash codes for no freetype.
* Update hash codes for freetype.
* Update hash codes for no freetype.
* Update hash codes for freetype.
* Update expected test results.
* Update hash codes.
* Fix contour plots not being lined up with atoms.
* Fix shrinkToFit.
* Update expected test result.
* Fix typo in test name.
* Update expected test result.
* Update expected test result.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Test for Github6160
* Basic fix. Problem caused by 4 coordinate sulfur.
* Get the test right.
* Fix truncation of double bonds to atom symbols.
* Fix double bond lines if both ends have atomic symbol.
* Tidy.
Add hash codes.
* Response to review.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
* enable optional visualization of complex query atoms in a more compact form
* disable alpha channel support on legacy browsers
* - changes in response to review
- added metal queries
- fixed a docstring
* fix Windows build
* gave up and tested indirectly as I really do not want to export internal functions
---------
Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
* Adapt allene drawing code to cope with other linear groups.
* Remove stray debugging write.
* Over-eager tidying remove key aspect of the fix. Doh.
* Changes after review.
* Better solution that doesn't change the public API.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>