Skip to content

CDK 2.12

Latest

Choose a tag to compare

@johnmay johnmay released this 03 Mar 15:14
· 54 commits to main since this release

DOI

Breaking Changes

New Features and APIs

Hydrogen normalisation

A new API has been added to simplify hydrogen representation normalisation. In the past we had the ability to suppress all hydrogens, make them all explicit or remove all non-chiral hydrogens. We now have a single function which does all of this, the caller specifies what you want and it will add/remove hydrogens as needed keeping all internal state correct and in sync.

IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
SmilesParser smipar = new SmilesParser(bldr);
SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Default);

IAtomContainer mol = smipar.parseSmiles("C1[C@@H]2CCC(C[C@H](O)C)C[C@@H]2C(C1)[2H]");
AtomContainerManipulator.normalizeHydrogens(mol, HydrogenState.Depiction);
System.err.println(smigen.create(mol) + " Depiction");
AtomContainerManipulator.normalizeHydrogens(mol, HydrogenState.Stereo);
System.err.println(smigen.create(mol) + " Stereo");
AtomContainerManipulator.normalizeHydrogens(mol, HydrogenState.Minimal);
System.err.println(smigen.create(mol) + " Minimal");
AtomContainerManipulator.normalizeHydrogens(mol, HydrogenState.Unsafe);
System.err.println(smigen.create(mol) + " Minimal (unsafe)");

Result:

C1[C@@]2(CCC(C[C@H](O)C)C[C@@]2(C(C1)[2H])[H])[H] Depiction
C1[C@@]2(CCC(C[C@](O)(C)[H])C[C@@]2(C(C1)[2H])[H])[H] Stereo
C1[C@@H]2CCC(C[C@H](O)C)C[C@@H]2C(C1)[2H] Minimal
C1[C@@H]2CCC(C[C@H](O)C)C[C@@H]2CC1 Minimal (unsafe)
Screenshot 2026-03-03 at 17 18 47

Markush / RGroup support

We already had some basic support for R Group Query files but this was not tied in nicely to the main toolkit. This release adds the ability to work with these files easier as well as support in CXSMILES. It is now possible to load a CXSMILES with R groups and depict it correctly.

IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
SmilesParser smipar = new SmilesParser(bldr);
IAtomContainer mol = smipar.parseSmiles("C1CNCC(*)C1 |$;;;;;R1$,LN:0:1.3,RG:_R1={OC},{Cl},{C#N}|");
new DepictionGenerator().depict(mol).writeTo("/tmp/tmp.svg");
Screenshot 2026-03-03 at 15 04 39

Note: the link node is now also parsed and stored.

Variable Attachment Matching

Added support for matching variable attachments specified via CXSMARTS.

Query: image

n1ccccc1.*Cl.*Br |m:6:0.1.2.3.4.5,8:0.1.2.3.4.5|

Hits: image image image

Atropisomers (via RDKit extension)

We have supported atropisomers for some time but only via 2D coordinates with layouts and CIP naming etc working as expected. RDKit has an extension to allow loading from CXSMILES - although it is not perfect I was at a loss to think of something better and so it makes sense to support it. Currently this is read-only and mainly intended for depiction.

C=CC(=O)N1CCN(c2nc(=O)n(-c3c(C)ccnc3C(C)C)c3nc(-c4c(O)cccc4F)c(F)cc23)[C@@H](C)C1 |wU:12.23| (m)-sotorasib

image (via CDK depict)

API to set wedge bonds

A new API has been added to allow setting of wedge bonds to a structure where the coordinates are already known. Note: This function is called automatically when a layout is generated.

StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.generateWedges(mol);

Sugar Detection Utility

See #1225

image

If you want to see the SugarDetectionUtility in action, check out our MOlecule fRagmenTAtion fRamework (MORTAR) application, the SDU will be part of the next release.

What's Changed

New Contributors

Full Changelog: cdk-2.11...cdk-2.12