{"id":24,"date":"2007-08-14T00:25:00","date_gmt":"2007-08-13T22:25:00","guid":{"rendered":"http:\/\/www.steinbeck-molecular.de\/steinblog\/?p=24"},"modified":"2007-09-06T13:39:57","modified_gmt":"2007-09-06T11:39:57","slug":"structure-diagram-generation-sdg-2d-layout-in-the-chemistry-development-kit-part-1","status":"publish","type":"post","link":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/2007\/08\/14\/structure-diagram-generation-sdg-2d-layout-in-the-chemistry-development-kit-part-1\/","title":{"rendered":"Structure Diagram Generation (SDG), 2D Layout, in the Chemistry Development Kit (Part 1)"},"content":{"rendered":"<p>Recent Bug Fixes and Improvements in the <a href=\"http:\/\/cdk.svn.sourceforge.net\/viewvc\/cdk\/trunk\/cdk\/src\/org\/openscience\/cdk\/layout\/StructureDiagramGenerator.java\" title=\"2D Layout in CDK\">StructureDiagramGenerator (SDG)<\/a> class of the <a href=\"http:\/\/cdk.sourceforge.net\" title=\"Chemistry Development Kit (CDK)\">Chemistry Development Kit (CDK)<\/a> initiated a discussion on the need to refactor the CDK SDG code in order to make it more maintainable and extensible. This motivates me to write a series of blog items on the subject. This is the first one, with some general remarks on the topic and a basic overview on how the CDK SDG works.<\/p>\n<p><!--more-->I was extremely pleased when I read <a href=\"http:\/\/depth-first.com\/\">Rich Apodaca<\/a>&#8216;s remark on the SDG being the &#8220;crown jewel&#8221; of CDK and of course I think he&#8217;s right :-).<br \/>\nChemoinformatics software frequently comes up with chemical structures in the form of connection tables without 2D or 3D coordinates.  For those, 2D structure diagrams need to be produced in order to present them to the chemist on screen or on paper. Chemists have created rather uniform set of conventions on how these 2D diagrams should look like, as can be seen from a brief inspection of a regular organic chemistry book (we are talking Lewis notation here).<br \/>\nThe process of producing 2D coordinates for coordinate-less chemical graphs is known as Structure Diagram Generation and has been extensively <a href=\"http:\/\/dx.doi.org\/10.1002\/9780470125908.ch6\" title=\"SDG Review\">reviewed by Harold Helson of CambridgeSoft<\/a>.<br \/>\nThe state of the art has recently been <a href=\"http:\/\/dx.doi.org\/10.1021\/ci050550m\" title=\"State of the Art in SDG\">set and published by Alex Clark et al in JCIM<\/a>.<\/p>\n<p>I wrote the CDK version of SDG in 2002 pretty much from scratch in just a few weeks and the code remained largely untouched since then. Before, I had used the only existing open source SDG code by Ugi and Dengler, MDRAW, which had been publish in printed form in the micro fiche edition of Journal of Chemical Research (M):2601-2689. <a href=\"http:\/\/depth-first.com\/articles\/2007\/04\/11\/structure-diagram-generation\">Rich had blogged about SDG earlier this year<\/a> and a couple of people  commented on free versions of SDG. Be it as it is, the MDRAW code worked but was C and had other shortcomings, which made me start a Java version.<\/p>\n<p>The basic components of SDG are quickly sketched:<\/p>\n<ul>\n<li>The connection table needs to be scanned for rings<\/li>\n<li>If rings are found, they need to be partitioned into ring systems.<\/li>\n<li>Ring systems are laid out individually. This is done by a class called the RingPlacer.<\/li>\n<li>For some bridged ring systems, no known algorithm leads to a good solution and therefore, a template mechanism is needed for them. In CDK, the TemplateHandler class does this job.<\/li>\n<li>Atoms which are ring substitutents are now attached to the laid out ring. If applicable, starting from those, chains are grown.<\/li>\n<li>If no rings exist, the longest chain is identified and laid out horizontally.<\/li>\n<li>Non-ring parts of the molecule are laid out in an extended geometry to avoid folding back onto the rest of the molecule. Layout of chain (non-ring) parts are performed<br \/>\nby the AtomPlacer class.<\/li>\n<li>The above procedure may lead to overlap of atoms in the end. The OverlapResolver class checks for those clashes and tries to revolve them.<\/li>\n<\/ul>\n<p>A result of this is shown for SMILES &#8220;C1=CC=C(C=C1)CC2CCC(CC2)CC56(C=3C=CC=CC=3C(C4=CC=CC=C45)C6)&#8221;.<br \/>\n<a href=\"http:\/\/www.steinbeck-molecular.de\/steinblog\/wp-content\/uploads\/2007\/09\/sdg_demo.png\" title=\"CDK SDG Demo\"><img decoding=\"async\" src=\"http:\/\/www.steinbeck-molecular.de\/steinblog\/wp-content\/uploads\/2007\/09\/sdg_demo.png\" alt=\"CDK SDG Demo\" \/><\/a><br \/>\nThis simple set of rules yields very good results for more than 90% of all cases. The rest is a problem and, with respect to the algorithms on<br \/>\nthe market, separates the men from the boys. CDK still plays in the junior league here, but does a decent job for the majority of layout problems.<br \/>\nI will continue this series later with insights into the various parts of the CDK SDG code. <a href=\"https:\/\/puttygen.in\">putty download windows<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recent Bug Fixes and Improvements in the StructureDiagramGenerator (SDG) class of the Chemistry Development Kit (CDK) initiated a discussion on the need to refactor the CDK SDG code in order to make it more maintainable and extensible. This motivates me to write a series of blog items on the subject. This is the first one, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-chemoinformatics","category-open-science"],"_links":{"self":[{"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/posts\/24"}],"collection":[{"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":0,"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.steinbeck-molecular.de\/steinblog\/index.php\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}