{
  "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/2008/08/31/creating-cmlreact-from-usefulchem-ugi.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/32fcj-fd465",
      "url": "https://chem-bla-ics.linkedchemistry.info/2008/08/31/creating-cmlreact-from-usefulchem-ugi.html",
      "title": "Creating CMLReact from UsefulChem Ugi Reactions",
      "content_html": "<p><a href=\"http://blog.openwetware.org/scienceintheopen/\">Cameron</a>, <a href=\"http://usefulchem.blogspot.com/\">Jean-Claude</a> and I were invited to\n<a href=\"http://wwmm.ch.cam.ac.uk/blogs/murrayrust/\">Peter</a>’s place in Cambridge, where we are now hacking on CMLReact for the\n<a href=\"http://usefulchem.wikispaces.com/exp023\">Ugi reactions</a> Jean-Claude has been working on. I just finished a script that uses the\nCDK and Sam’s interface to the <a href=\"http://cheminfo.informatics.indiana.edu/~rguha/code/java/nightly/api/org/openscience/cdk/inchi/package-frame.html\">InChI library</a>\nto convert a list of four reactants and one Ugi product into CMLReact (doi:<a href=\"http://dx.doi.org/10.1021/ci0502698\">10.1021/ci0502698</a>).\nThe full <a href=\"https://en.wikipedia.org/wiki/BeanShell\">BeanShell</a> script looks like:</p>\n\n<pre><code class=\"language-beanshell\">#!/usr/bin/bsh\n\nimport java.io.File;\nimport java.io.FileReader;\nimport java.io.BufferedReader;\n\nimport org.openscience.cdk.*;\nimport org.openscience.cdk.exception.*;\nimport org.openscience.cdk.inchi.*;\nimport org.openscience.cdk.interfaces.*;\nimport org.openscience.cdk.io.CMLWriter;\n\nimport org.openscience.cdk.libio.cml.Convertor;\nimport org.xmlcml.cml.element.CMLReaction;\n\nimport net.sf.jniinchi.INCHI_RET;\n\nInChIGeneratorFactory factory = new InChIGeneratorFactory();\n// Get InChIToStructure\n\nFile file = new File(\"inchi.ugi.txt\"); // five inchis expected, last being the product\nBufferedReader reader = new BufferedReader(new FileReader(file));\n\nString first = reader.readLine();\nString second = reader.readLine();\nString third = reader.readLine();\nString fourth = reader.readLine();\nString product = reader.readLine();\n\nSystem.out.println(\"First: \" + first);\nIMolecule firstAC;\n{\n  InChIToStructure intostruct = factory.getInChIToStructure(first, DefaultChemObjectBuilder.getInstance());\n\n  INCHI_RET ret = intostruct.getReturnStatus();\n  if (ret == INCHI_RET.WARNING) {\n    // Structure generated, but with warning message\n    System.out.println(\"InChI warning: \" + intostruct.getMessage());\n  } else if (ret != INCHI_RET.OKAY) {\n    // Structure generation failed\n    throw new CDKException(\"Structure generation failed failed: \" + ret.toString()\n      + \" [\" + intostruct.getMessage() + \"]\");\n  }\n\n  firstAC = new Molecule(intostruct.getAtomContainer());\n}\n\nSystem.out.println(\"Second: \" + second);\nIMolecule secondAC;\n{\n  InChIToStructure intostruct = factory.getInChIToStructure(second, DefaultChemObjectBuilder.getInstance());\n\n  INCHI_RET ret = intostruct.getReturnStatus();\n  if (ret == INCHI_RET.WARNING) {\n    // Structure generated, but with warning message\n    System.out.println(\"InChI warning: \" + intostruct.getMessage());\n  } else if (ret != INCHI_RET.OKAY) {\n    // Structure generation failed\n    throw new CDKException(\"Structure generation failed failed: \" + ret.toString()\n      + \" [\" + intostruct.getMessage() + \"]\");\n  }\n\n  secondAC = new Molecule(intostruct.getAtomContainer());\n}\n\nSystem.out.println(\"Third: \" + third);\nIMolecule thirdAC;\n{\n  InChIToStructure intostruct = factory.getInChIToStructure(third, DefaultChemObjectBuilder.getInstance());\n\n  INCHI_RET ret = intostruct.getReturnStatus();\n  if (ret == INCHI_RET.WARNING) {\n    // Structure generated, but with warning message\n    System.out.println(\"InChI warning: \" + intostruct.getMessage());\n  } else if (ret != INCHI_RET.OKAY) {\n    // Structure generation failed\n    throw new CDKException(\"Structure generation failed failed: \" + ret.toString()\n      + \" [\" + intostruct.getMessage() + \"]\");\n  }\n\n  thirdAC = new Molecule(intostruct.getAtomContainer());\n}\n\nSystem.out.println(\"Fourth: \" + fourth);\nIMolecule fourthAC;\n{\n  InChIToStructure intostruct = factory.getInChIToStructure(fourth, DefaultChemObjectBuilder.getInstance());\n\n  INCHI_RET ret = intostruct.getReturnStatus();\n  if (ret == INCHI_RET.WARNING) {\n    // Structure generated, but with warning message\n    System.out.println(\"InChI warning: \" + intostruct.getMessage());\n  } else if (ret != INCHI_RET.OKAY) {\n    // Structure generation failed\n    throw new CDKException(\"Structure generation failed failed: \" + ret.toString()\n      + \" [\" + intostruct.getMessage() + \"]\");\n  }\n\n  fourthAC = new Molecule(intostruct.getAtomContainer());\n}\n\nSystem.out.println(\"Product: \" + product);\nIMolecule productAC;\n{\n  InChIToStructure intostruct = factory.getInChIToStructure(product, DefaultChemObjectBuilder.getInstance());\n\n  INCHI_RET ret = intostruct.getReturnStatus();\n  if (ret == INCHI_RET.WARNING) {\n    // Structure generated, but with warning message\n    System.out.println(\"InChI warning: \" + intostruct.getMessage());\n  } else if (ret != INCHI_RET.OKAY) {\n    // Structure generation failed\n    throw new CDKException(\"Structure generation failed failed: \" + ret.toString()\n      + \" [\" + intostruct.getMessage() + \"]\");\n  }\n\n  productAC = new Molecule(intostruct.getAtomContainer());\n}\n\nIReaction ugiReaction = new Reaction();\nugiReaction.addReactant(firstAC);\nugiReaction.addReactant(secondAC);\nugiReaction.addReactant(thirdAC);\nugiReaction.addReactant(fourthAC);\nugiReaction.addProduct(productAC);\n\nStringWriter stringWriter = new StringWriter();\nCMLWriter cmlWriter = new CMLWriter(stringWriter);\n\ncmlWriter.write(ugiReaction);\ncmlWriter.close();\nSystem.out.println(stringWriter.toString());\n</code></pre>\n\n<p>My apologies for the code duplication, but never tried inline functions in BeanShell yet… You can\nmonitor the efforts at <a href=\"http://docs.google.com/Doc?id=dq5m5bs_12hb8d2wcw\">Google Docs</a>.</p>\n\n<h4>References</h4>\n<div class=\"csl-bib-body\">\n    <div class=\"csl-entry\">Holliday, G. L., Murray-Rust, P., &#38; Rzepa, H. S. (2005). Chemical Markup, XML, and the World Wide Web. 6. CMLReact, an XML Vocabulary for Chemical Reactions. <i>Journal of Chemical Information and Modeling</i>, <i>46</i>(1), 145–157. https://doi.org/10.1021/ci0502698 <a href=\"https://doi.org/10.1021/ci0502698\">CrossRef</a> <a href=\"https://qlever.scholia.wiki/doi/10.1021/ci0502698\">Scholia</a></div>\n  </div>",
      "summary": "Cameron, Jean-Claude and I were invited to Peter’s place in Cambridge, where we are now hacking on CMLReact for the Ugi reactions Jean-Claude has been working on. I just finished a script that uses the CDK and Sam’s interface to the InChI library to convert a list of four reactants and one Ugi product into CMLReact (doi:10.1021/ci0502698). The full BeanShell script looks like:",
      
      "date_published": "2008-08-31T00:20:00+00:00",
      "date_modified": "2025-10-11T00:00:00+00:00",
      "tags": ["cml","cdk","inchi","usefulchem"],
      "_references": [
        
          
          
            { "url": "https://doi.org/10.1021/ci0502698", "doi": "10.1021/ci0502698"
             }
            
          
        ],
      
      
      
      
      
      
        "authors": [ { "name": "Egon Willighagen", "url": "https://orcid.org/0000-0001-7542-0286" } ]
      
    }

  ]
}
