Egon’s introductory talk about getting started with CDK

After my opening talk at the CDK workshop, Egon Willighagen gave an introduction on how to get started with the CDK. He uses the scripting environment Groovy to demonstrate things.

Egon has prepared a LaTeX document with his teaching material as well as the code examples on at Turns out that Groovy scripting is a really nice environment for writing CDK code. You can say things like

import org.openscience.cdk.interfaces.*;
import org.openscience.cdk.*;
import org.openscience.cdk.atomtype.*;
import org.openscience.cdk.config.*;
import javax.vecmath.Point3d;

molecule = new Molecule();
atom = new Atom(Elements.CARBON);
matcher = CDKAtomTypeMatcher.getInstance(
type = matcher.findMatchingAtomType(molecule, atom);
AtomTypeManipulator.configure(atom, type);
println “Atom type: $type.atomTypeName”

As you can see, you do not need to handle things like Exceptions or Data Types. Groovy, like most other scripting environments will handle that for you.

If CDK.jar is in your CLASSPATH, you can run this code inside GroovyConsole and you’ll get “C.sp3” as an output.

Egon’s course material have many more examples.

Categorised as: Chemistry Development Kit, Chemoinformatics, Conferences and Meetings, Life of Chris, Open Science, People, Scientific Culture

Leave a Reply

Your email address will not be published. Required fields are marked *