{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "chem-bla-ics",
  "description": "Chemblaics (pronounced chem-bla-ics) is the science that uses open science and computers to solve problems in chemistry, biochemistry and related fields.",
  "home_page_url": "https://chem-bla-ics.linkedchemistry.info/",
  "feed_url": "https://chem-bla-ics.linkedchemistry.info/2010/09/26/using-pubchem-to-create-cdk-unit-tests.json",
  "icon": "https://chem-bla-ics.linkedchemistry.info/assets/images/chem-bla-ics_logo.png",
  "language": "en",
  "authors": [
    {
      "name": "Egon Willighagen",
      "url": "https://orcid.org/0000-0001-7542-0286",
      "_orcid": "0000-0001-7542-0286"
    }
  ],
  "items": [

    {
      "id": "https://doi.org/10.59350/9bw3h-3mr91",
      "url": "https://chem-bla-ics.linkedchemistry.info/2010/09/26/using-pubchem-to-create-cdk-unit-tests.html",
      "title": "Using PubChem to create CDK unit tests",
      "content_html": "<p>In 2008 I posted about <a href=\"https://chem-bla-ics.linkedchemistry.info/2008/05/03/wicked-chemistry-and-unit-testing.html\">Wicked chemistry and unit testing <i class=\"fa-solid fa-recycle fa-xs\"></i></a>\nand was using <a href=\"https://en.wikipedia.org/wiki/BeanShell\">BeanShell</a> at the time\nto convert a structure on <a href=\"https://pubchem.ncbi.nlm.nih.gov/\">PubChem</a> into <a href=\"http://cdk.sf.net\">CDK</a>\nsource code. But since I rather use <a href=\"https://en.wikipedia.org/wiki/Groovy_%28programming_language%29\">Groovy</a>\nnow, I have updated the code. I used <a href=\"https://chem-bla-ics.blogspot.com/2010/09/cdk-137-changes-authors-and-reviewers.html\">CDK 1.3.6</a>\nand the PubChem XML format now:</p>\n\n<pre>import org.openscience.cdk.Molecule;\nimport org.openscience.cdk.io.*;\n\nif (args.length == 0 || args[0] == null) {\n  System.out.println(\"Syntax: pc2ut.groovy [CID]\\n\");\n  System.exit(0);\n}\n\nString cid = args[0];\nString urlString =\n  \"http://pubchem.ncbi.nlm.nih.gov/summary/\" +\n  \"summary.cgi?disopt=SaveXML&amp;cid=\" + cid;\n\nURL url = new URL(urlString);\n\nPCCompoundXMLReader reader =\n  new PCCompoundXMLReader(url.openStream());\nMolecule mol = reader.read(new Molecule());\n\nStringWriter stringWriter = new StringWriter();\nCDKSourceCodeWriter writer =\n  new CDKSourceCodeWriter(stringWriter);\nwriter.write(mol);\nwriter.close();\n\nSystem.out.print(stringWriter.toString());\n</pre>\n\n<p><strong>Update</strong> An observant reader would have noticed that the output of the current\nCDKSourceCodeWriter is actually producing code that does not compile. The CDK\nAPI has changed, but the created output was not updated accordingly. Apparently,\nno one is actually using this class, or those who have were not interested in\nthat piece of functionality to file a bug report.</p>",
      "summary": "In 2008 I posted about Wicked chemistry and unit testing and was using BeanShell at the time to convert a structure on PubChem into CDK source code. But since I rather use Groovy now, I have updated the code. I used CDK 1.3.6 and the PubChem XML format now:",
      
      "date_published": "2010-09-26T00:00:00+00:00",
      "date_modified": "2026-10-02T00:00:00+00:00",
      "tags": ["cdk","pubchem","mcprinciples"],
      
      
      
      
      
      
        "authors": [ { "name": "Egon Willighagen", "url": "https://orcid.org/0000-0001-7542-0286" } ]
      
    }

  ]
}
