Skip to content

Releases: cdk/cdk

CDK 2.11

29 Mar 08:49
Compare
Choose a tag to compare

Interim release fixing an issue in CDK 2.10.

What's Changed

  • Fix some suggestions from SonarCloud by @johnmay in #1141
  • Add the option to locate a IChemObject builder using reflection. Enfo… by @johnmay in #1140
  • January 2025 Dependency updates by @egonw in #1144
  • Patch/fixes for jcp by @johnmay in #1145
  • Resolved SonarCloud warning by @javadev in #1147
  • add github workflow to add checksums to release asset by @uli-f in #1148
  • Correct Singlet (2 electron) vs Doublet (1 single electron) by @johnmay in #1149
  • Copy charges of original atoms when creating functional group atoms and add test subroutine for correct charges by @JonasSchaub in #1151
  • migrate FormatStringBuffer to FormatStringBuilder by @uli-f in #1150
  • Newer jna-inchi with InChI 1.07.2 by @egonw in #1152
  • Tweaks for jcp by @johnmay in #1154
  • Ring fill better rxn layout by @johnmay in #1155
  • Patch/fixes mar8 by @johnmay in #1165
  • The free (for OS projects) license hasn't been used for some time now by @egonw in #1166
  • Fix JavaDoc warnings by @Mailaender in #1168
  • Catch the Factory configuration exception in SAX by @johnmay in #1169
  • Better testing by @egonw in #1170
  • @cdk.module and @cdk.githash removal by @egonw in #1171
  • Some small code (clarity) improvements by @egonw in #1172
  • Update some into in PeriodicTable and reorder the Elements enum. by @johnmay in #1173
  • More testing by @egonw in #1175
  • Moved more class tests to the module they are testing by @egonw in #1178

Full Changelog: cdk-2.10...cdk-2.11

CDK 2.10

09 Jan 20:06
Compare
Choose a tag to compare

DOI

New Features/Key Changes

AtomContainer new implementation (IMPORTANT)

The new AtomContainer implementation is now the default after a gradual introduction. You can still use the old implementation but you must explicitly create an AtomContainerLegacy. This should be a seamless change for most but please notify if you have an unexpected error.

SMIRKS

JavaDoc

SMIRKS support with the ability to approximate other implementations (inc. Daylight and RDKit Reaction Smarts). It includes convenience APIs for applying a transform to all places at once (i.e. dt_xapply) and efficient support for hydrogen handling (explicit hydrogen are not required on the input). Overall the speed it good and a transform can be run over all of ChEMBL 35 in only ~30 seconds (see Appendix A1).

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

String smminp = "c1cc(N(=O)=O)ccc1N(=O)=O";
IAtomContainer mol = smipar.parseSmiles(smminp);
Smirks.compile("[N:1](=[OD1+0])=[OD1+0]>>[N+:1](=O)[O-] polar-nitro")
      .apply(mol); // exclusive apply mode
String smiout = smigen.create(mol);  // C1=CC([N+](=O)[O-])=CC=C1[N+](=O)[O-]

More information can be found in the JavaDoc and functionality will be added to the CDK Depict Web Application.

Reaction InChI (RInChI) generation

JavaDoc

A pure Java implementation of Reaction InChI has been added allowing generation of RInChI strings and keys:

IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
SmilesParser smipar = new SmilesParser(bldr);
IReaction reaction = smipar.parseReactionSmiles("CCO.[CH3:1][C:2](=[O:3])[OH:4]>[H+]>CC[O:4][C:2](=[O:3])[CH3:1].O Ethyl esterification [1.7.3]\n");
RInChIGenerator rinchigen = new RInChIGenerator();
rinchigen.generate(reaction);
System.err.println(rinchigen.getRInChI()); // RInChI=1.00.1S/C2H4O2/c1-2(3)4/h1H3,(H,3,4)!C2H6O/c1-2-3/h3H,2H2,1H3<>C4H8O2/c1-3-6-4(2)5/h3H2,1-2H3!H2O/h1H2<>p+1/d+
System.err.println(rinchigen.getShortRInChIKey()); // Short-RInChIKey=SA-FUHFF-JJFIATRHOH-UDXZTNISGZ-GPRLSGONYQ-NUHFF-NUHFF-NUHFF-ZZZ

RDfile reading support

JavaDoc

RDfiles belong to the CT file family formats and allows records with associated experimental data.

RdfileReader rdReader = new RdfileReader(new FileReader("/tmp/pistachio-rxns-2501091627.rd"),
                                         SilentChemObjectBuilder.getInstance(),
                                         true);
while (rdReader.hasNext()) {
    RdfileRecord record = rdReader.next();
    if (record.isRxnFile()) {
        IReaction reaction = record.getReaction();
    } else {
        IAtomContainer container = record.getAtomContainer();
    }
}

Faster ring and aromaticity perception

JavaDoc

Faster ring membership and aromaticity assignment. The move to AtomContainer2 (see above) allows additional optimizations to these algorithms. The APIs will run faster however for aromaticity you must use Cycles.all() on it's own. There is also a new static method for convenience and improved aromatic model encoding.

// new way, no checked exception
Cycles.markRingAtomsAndBonds(molecule); // prerequisite 
if (!Aromaticity.apply(Aromaticity.Model.Daylight, molecule)) {
  // return false = too many cycles to check
}

// old way (will still be faster)
Aromaticity aromaticity = new Aromaticity(ElectronDonation.daylight(),
                                          Cycles.all());
IAtomContainer container = ...;
try {
  if (aromaticity.apply(molecule)) {
    //
  }
} catch (CDKException e) {
  // cycle computation was intractable
}

Improved inorganic stereochemistry

It is now possible to represent degenerate inorganic stereochemistry where one or more neighbours are missing/implicit. For example, we can describe a square pyramidal structure as an octahedral without a missing ligand. Support for implicit/explicit hydrogens around theses atoms has also been improved.

[NH3][Co@OH25](Cl)(Cl)(Cl)(Cl) sqpyr
[NH3][Co@OH4](Cl)(Cl)[NH3] seesaw

You can also use this in SMARTS to match across atoms and equatorial using the following patterns:

Cl[Co@OH1]Cl across


Cl[Co@OH3]Cl equatorial


Functional Group Finder

JavaDoc

A functional group finder has been added based on Peter Ertl's algorithm.

Peter Ertl. 2017
Fritsch et al. 2019

The API allows you generate the functional groups as fragments or my favorite which is fill an array with identifier numbers - this is then very easy to depict.

IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
SmilesParser smipar = new SmilesParser(bldr);

String smiles = "C2C(NC)=NC3=C(C(C1=CC=CC=C1)=N2=O)C=C(Cl)C=C3";
IAtomContainer mol = smipar.parseSmiles(smiles);
FunctionalGroupsFinder fgFinder = FunctionalGroupsFinder.withNoEnvironment();

Cycles.markRingAtomsAndBonds(mol);
Aromaticity.apply(Aromaticity.Model.Daylight, mol);

// extract the groups as new fragments
List<IAtomContainer> functionalGroupsList = fgFinder.extract(mol);


// fill an array with numbers that indicate which functional group something belongs to
int[] fgrps = new int[mol.getAtomCount()];
fgFinder.find(fgrps, mol);

// Set the group as the atom map/class in SMILES
for (IAtom atom : mol.atoms())
    atom.setMapIdx(1+fgrps[atom.getIndex()]);    
System.out.println(new SmilesGenerator(SmiFlavor.AtomAtomMap).create(mol));

Sugar Moiety Removal

JavaDoc.

The Sugar Removal Utility (SRU) implements a generalized algorithm for automated detection of circular and linear sugars in molecular structures and their removal.

Schaub et al 2020

Convenience APIs

  • Iterate over molecules of a reaction and sets
  • Creating atoms/bonds in the context of molecules with: mol.newAtom() and mol.newBond() and others.
  • Better IO error handling

Contributors

  55 Egon Willighagen
   8 Felix Bänsch
   3 Jean Marois
 245 John Mayfield
  43 Jonas Schaub
   2 Matthias Mailänder
   5 Tyler Peryea
  123 Uli Fechner
   3 Valentyn Kolesnikov
   3 Stefan Kuhn

Overview of Pull Requests

  • SonarCloud is not reporting test coverage correctly because it was no… by @johnmay in #1000
  • Improved the abbreviation handling over atom sets, this is useful for… by @johnmay in #996
  • Fix - avoid placing a wedge on the right-angled bond when a centre is… by @johnmay in #998
  • Quality of life API interfaces. The IAtomContainerSet and IReaction c… by @johnmay in #997
  • Sonar settings for aggregated test coverage. by @johnmay in #1001
  • CMLXOM 4.6 by @egonw in #1004
  • Redo @parit's changes for net/undirected reaction depiction on the ne… by @johnmay in #1009
  • Smiles 0 isotope by @johnmay in #1007
  • When atoms/bonds are aware of the container they are in - it is usefu… by @johnmay in #1010
  • Fix the CDK C.plus atom type, there was already comment in the test t… by @johnmay in #1011
  • Query bond funcs by @johnmay in #938
  • Read the atom-atom mapping info from a V3000 file. by @johnmay in #1012
  • Fixes cdk/depict#76. We do not like -C=CO a… by @johnmay in #1015
  • Added an API for fatal IO errors by @egonw in #1019
  • Java21...
Read more

CDK 2.9

21 Aug 19:50
Compare
Choose a tag to compare

DOI

Summary

  • Improved abbreviation handling
  • More arrow types
  • Multi-step Reaction SMILES
  • Reaction Set and Multi-step depiction
  • More correct PubChemFingerprinter
  • Universal (InChI) SMILES for large molecules
  • Dependency updates and stability improvements, huge kudos to @uli-f for finding some longstanding issues

Improved abbreviation handling

#991. The Abbreviation handling has been tweaked with more and cleaner options:

Abbreviations  abbreviations = new Abbreviations();
// abbreviations.setContractToSingleLabel(true); // old (still supported)
abbreviations.with(Abbreviations.Option.ALLOW_SINGLETON); // new
// abbreviations.setContractOnHetero(true); // old (still supported)
abbreviations.with(Abbreviations.Option.AUTO_CONTRACT_HETERO); // new

The full options are described here: Abbreviations.Option.

More arrow types

Now includes NoGo/Equilibrium/RetroSynthetic - #927. See IReaction.Direction. Examples:

#1 (2)

#1 (3)

Multi-step Reaction SMILES

#986

An new entry point to the SMILES parser has been added to parse into a "multi-step" reaction where by the product of one step is the reactant the the next. The basic idea is to allow more than two '>'. Parts at even positions are reactants/products and odd positions are agents/catalysts/solvents.

Basic idea:

SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance());
IReactionSet rset = sp.parseReactionSetSmiles("[Pb]>>[Ag]>>[Au] lead-to-silver-to-gold");

Real example (see next bullet for depiction):

ClC1=NC=2N(C(=C1)N(CC3=CC=CC=C3)CC4=CC=CC=C4)N=CC2C(OCC)=O>C1(=CC(=CC(=N1)C)N)N2C[C@H](CCC2)O.O1CCOCC1.CC1(C2=C(C(=CC=C2)P(C3=CC=CC=C3)C4=CC=CC=C4)OC5=C(C=CC=C15)P(C6=CC=CC=C6)C7=CC=CC=C7)C.C=1C=CC(=CC1)\C=C\C(=O)\C=C\C2=CC=CC=C2.C=1C=CC(=CC1)\C=C\C(=O)\C=C\C2=CC=CC=C2.C=1C=CC(=CC1)\C=C\C(=O)\C=C\C2=CC=CC=C2.[Pd].[Pd].[Cs]OC(=O)O[Cs]>C1(=CC(=CC(=N1)C)NC2=NC=3N(C(=C2)N(CC4=CC=CC=C4)CC5=CC=CC=C5)N=CC3C(OCC)=O)N6C[C@H](CCC6)O>CO.C1CCOC1.O.O[Li]>C1(=CC(=CC(=N1)C)NC2=NC=3N(C(=C2)N(CC4=CC=CC=C4)CC5=CC=CC=C5)N=CC3C(O)=O)N6C[C@H](CCC6)O>CN(C)C(=[N+](C)C)ON1C2=C(C=CC=N2)N=N1.F[P-](F)(F)(F)(F)F.[NH4+].[Cl-].CN(C)C=O.CCN(C(C)C)C(C)C>C1(=CC(=CC(=N1)C)NC2=NC=3N(C(=C2)N(CC4=CC=CC=C4)CC5=CC=CC=C5)N=CC3C(N)=O)N6C[C@H](CCC6)O>>C1(=CC(=CC(=N1)C)NC2=NC=3N(C(=C2)N)N=CC3C(N)=O)N4C[C@H](CCC4)O |f:4.5.6.7.8,16.17,18.19|  US20190241576A1

Reaction Set and Multi-step depiction

#986

The DepictionGenerator has been extended to depict reaction sets. If the product of the previous reaction is the same as the reactant in the next (object identity) it is omitted for a terser depiction:

US20190241576A1 (3)

More correct PubChemFingerprinter

Explicit hydrogens are not longer required and there is an option to use a more correct ring set definition matching closer the original CACTVS substructure keys. This is now on by default:

IChemObject builder = SilentChemObjectBuilder.getInstance();
new PubchemFingerprinter(builder); // new - default is to use "ESSSR-like" ring set
new PubchemFingerprinter(builder, false); // old - for backwards compatible with FP generated with older CDK versions

Universal (InChI) SMILES for large molecules

#979.

The InChI now supports > 999 atoms, we have the option to generate a SMILES using the InChI canonical labelling, it makes sense to use the larger molecules flag and support more.

New Contributors

All Contributors

  75 John Mayfield
  17 Egon Willighagen
   6 Uli Fechner
   4 Mark J. Williamson
   3 Mark Williamson
   1 Parit Bansal
   1 Matthias Mailänder

Full Changelog: cdk-2.8...cdk-2.9

CDK 2.8

14 Sep 14:44
Compare
Choose a tag to compare

DOI

Key Changes

  • JDK Versions:
    • JDK 8 (minimum)
    • JDK 11 (minimum if not using cdk-iordf)
    • JDK 17 (recommended)
  • The project is now built with Java 11+ but compiled to target Java 8. If you have any issues please let us know.
  • The master branch has been renamed to main.
  • logj4-core is no longer a dependency of cdk-log4j, you should include these separately if you intend to use Log4j
  • A new cdk-slf4j module allows connecting logging to SLF4J
  • MayGen structure generator, provides the ability to generate millions and millions of structures that have a given formulae.
Maygen maygen = new Maygen(SilentChemObjectBuilder.getInstance());
maygen.setFormula("C3Cl2H4");
maygen.setConsumer(new SmiOutputConsumer(new OutputStreamWriter(System.out)));
maygen.run();

Maygen is pure Java, if you need more speed consider Surge by the same author.

  • New Smallest Ring utilities for single atom/bond
if (Cycles.smallRingSize(atom, 7) != 0) {
 // atom is in a ring 7 or smaller
}
if (Cycles.smallRingSize(bond, 7) != 0) {
  // bond is in a ring 7 or smaller
}
  • RAW/Count Path Fingerprints
IFingerprinter fpr = new Fingerprinter();
Map<String, Integer> feats = fpr.getRawFingerprint(mol);
  • Where possible "Re-inflate" convex rings on cyclcophanes:
    Before:Screenshot 2022-09-16 at 09 38 14 now: Screenshot 2022-09-16 at 09 38 10

  • New substructure/copy utility that allows a whole or part of a structure to be copied. Atoms are bonds are selected by providing a predicate:

IAtomContainer dst = builder.newAtomContainer();
AtomContainerManipulator.copy(dst, src, a -> a.isInRing(), b -> b.isInRing()); //  select the cyclic part of a molecule

// select atoms in a set, the bonds will also be selected
Set<IAtom> subset = ...
AtomContainerManipulator.copy(dst, src, a -> subset.contains(a)); 
  • New exclusive atoms filter that provides non-overlapping substructure matches, note the input order can determine which matches are selected.
for (int[] mapping : Pattern.findSubstructure(query).matchAll(mol).exclusiveAtoms()) {
   // ...
}
  • Stereo perception corner-cases. Reject:
    Screenshot 2022-09-16 at 09 45 22,
    Screenshot 2022-09-16 at 09 46 22, ok:

Screenshot 2022-09-16 at 09 46 24

Summary

  • Merged all PRs and resolved all open issues related to bugs
  • InChINumbersTools: Use JNA InChI options by @johnmay in #799
  • Avoid integer overflow in MF by @johnmay in #808, #810
  • Ensure correct stereo consistency (Fix #812) by @johnmay in #813
  • SMILES: Fix an issue with stereochemistry being lost on generic atoms - @johnmay in #814, #866
  • Maygen structure generator by @MehmetAzizYirik in #811
  • Weighted path descriptor performance improvements by @johnmay in #817
  • Depiction: Fix missing bond annotations by @johnmay in #819
  • Utility functions for determining the smallest ring size of an atom/b… by @johnmay in #820
  • Better consistentcy in Stereochemistry and Sgroups when removing atoms by @johnmay in #821
  • Unify MOLfile V2000/V3000 options by @johnmay in #824, #852
  • Improved stereochemistry perception by @johnmay in #826, #839
  • Replace Atom symbol (String) comparison with atomic number (integer) by @johnmay in #827
  • Improved/fix bugs with XLogP, PiContact, and BCUT, HuLuIndex descriptors by @johnmay in #833, #656, #822, #832
  • Additional Raw and count path fingerprints by @johnmay in #834
  • "Re-inflate" convex rings in macrocycles. The macrocycle layout can en… by @johnmay in #836
  • Fix a corner case in repeat crossing bonds when we have variable atta… by @johnmay in #835
  • Restore space as delimiter for string-based definition of InChI options by @marco-foscato in #846
  • Update to Apache Jena 4.2 (requires JDK 11) by @egonw in #748
  • Fix localisation of alpha channel floats in SVG by @egonw in #868
  • Check string bounds on PDB COMPND line. Fixes #870 by @johnmay in #871
  • Methods to manipulate atom types in ReactionManipulator by @uli-f in #883, #879
  • Added ChemObjectBuilder.newReaction() by @uli-f in #888
  • Utilities for selecting a substructure of a molecule. by @johnmay in #889
  • Improved CDK Log4J/SLF4J interactions by @johnmay in #878, #876
  • Additional SMARTS/matching utilities by @johnmay in #896, #900
  • Use Junit5 by @johnmay in #901
  • Fix issue with hose code nesting by @johnmay in #828

Authors

 278 John Mayfield
  13 Egon Willighagen
  11 Uli Fechner
   5 Mark Williamson
   3 Valentyn Kolesnikov
   2 MehmetAzizYirik
   2 Marco Foscato
   1 dependabot[bot]
   1 Tim Dudgeon
   1 Otto Brinkhaus
   1 Christoph Steinbeck
   1 Alex

New Contributors

Full Changelog: cdk-2.7.1...cdk-2.8

CDK 2.7.1

11 Jan 11:47
Compare
Choose a tag to compare

DOI

This page documents the changes for CDK v2.7 and v2.7.1. The patch version was made after some minor issues with how the new InChI code was organised were discovered by downstream projects.

Features

Switch from JNI to JNA InChI.

There are two main technologies for calling native code JNI (Java Native Interface) and JNA (Java Native Access). JNI requires writing a custom native wrapper which is then bound to Java code, JNA allows you to call the native methods of an existing SO/DYLIB directly. Essentially what this means is to expose the native InChI library in Java one needs to first write (and maintain) a native wrapper, with JNA we can just drop the InChI SO directly in. JNI InChI exposed InChI v1.03 and worked well for many years - unfortunately this project was no longer maintained and as newer more stable versions of InChI were released (now v1.06) an alternative was needed. A few years ago Daniel Lowe started JNA InChI and recently made it feature complete and released v1.0.

ChemAxon have also independently used the JNA path to integrated newer InChI libraries into their tools: (slides). It is not clear if this was made available, it is not listed on GitHub/ChemAxon.

Build on Java 17

The Maven plugins were updated to allow building on Java 17

Verify declared dependencies

The maven modules were checked for unused declared dependencies and used undeclared dependencies (mvn dependency:analyze).

Organise and restructure test-jar and testdata

CDK was originally built with the ant build tool, under this scheme there was a jar for the main/ code and one the test/ code. Test modules could share an inherit dependencies. To replicate this in maven we install and deploy "test-jar" artefacts. The project test code was restructured to put all common test code in the "cdk-test" module.

All test data was stored in a cdk-testdata module, this data has now been relocated to the test/resources of each module where it is used. This meant some data was duplicated but means the ~18MB test-jar no longer needs to be uplodaded to maven central.

Remove Guava dependency

We have removed the use of Guava, the functionality could mostly be directly replaced with newer JDK idioms (Function/Predicate/Stream) which were not available in the past.

Use XorShift PRNG in ShortestPathFingerprinter (different fingerprint)

Commons Math3 was used in a single place to hash paths (Mersenne Twister) in the ShortestPathFingerprinter. Since this fingerprint method is not widely used and the hashes do not need to be cryptographically secure a simple https://en.wikipedia.org/wiki/Xorshift random generate is now used instead. This allows us to remove the dependency on Commons Math3. This does mean the fingerprint bits have changed, note the CDK version description is accessible via the Fingerprinter.getVersionDescription() method.

Authors

 137 John Mayfield
   6 Egon Willighagen
   1 dependabot[bot]

Full Change Log

Read more

CDK 2.7

11 Jan 11:46
Compare
Choose a tag to compare

Please use v2.7.1

CDK 2.6

14 Dec 08:59
Compare
Choose a tag to compare

CDK 2.5

11 May 10:34
Compare
Choose a tag to compare

CDK 2.3

09 Aug 13:35
Compare
Choose a tag to compare

CDK 2.2

30 Oct 09:23
Compare
Choose a tag to compare

DOI

Please see 2.2 Release Notes for full details.