Sunday, May 04, 2014

Changes in CDK 1.6 #5: the SMILES generator

User:Fdardel and User: DMacks
CC-BY-SA at Wikipedia.
I won't say much about this, as John already did. It's much faster, more functional that what the CDK had before. Some things to keep in mind, which I ran into when proofreading my Groovy Cheminformatics with the CDK book. Importantly, make sure to read the SMILESGeneration documentation, as it many new cool options, and like much of the new CDK code, performance was a goal and it therefore is faster.

Canonical SMILES
Generating unique SMILES is done slightly differently, but elegantly:

generator = SmilesGenerator.unique();

"Aromatic" SMILES
Because SMILES with lower case element symbols reflecting aromaticity has less explicit information, it is not my suggestion to use. Still, I know that some of you are keen on using it, for various sometimes logical reasons, so here goes. Previously, you would use the setUseAromaticityFlag(true) method for this, but you can now use instead:

generator = SmilesGenerator.generic().aromatic()
smiles = generator.createSMILES(mol)

Of course, you can combine things.

No comments:

Post a Comment