{
  "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/01/30/validating-mdl-sd-files-and-symyx.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/zwv8r-yey62",
      "url": "https://chem-bla-ics.linkedchemistry.info/2010/01/30/validating-mdl-sd-files-and-symyx.html",
      "title": "Validating MDL SD files and Symyx molfiles with the CDK",
      "content_html": "<p><a href=\"http://www.bioclipse.net/\">Bioclipse</a> 2.0 introduced a new, powerful <a href=\"http://bioclipse.blogspot.com/2009/07/working-with-large-sdfiles-in-bioclipse.html\">molecular table support</a>,\nand we have been eager to test that on large SD files. A recent <a href=\"http://www.blogger.com/www.ebi.ac.uk/chebi/\">ChEBI</a> <a href=\"ftp://ftp.ebi.ac.uk/pub/databases/chebi/SDF/\">SD file</a>\nfailed to open, and eyes were immediately at the <a href=\"http://cdk.sf.net/\">CDK</a>, which is the cheminformatics library used in Bioclipse.</p>\n\n<p>After careful investigations, it turned out that the ChEBI file contained a few entries which were not MDL molfiles, but queries for the ISISBase system. Those cannot be\nread by the CDK <a href=\"http://pele.farmbio.uu.se/nightly/cdk-javadoc-1.3.1.git/org/openscience/cdk/io/MDLV2000Reader.html\">MDLV2000Reader</a>. However, it crashed on it, instead\nof failing more savely. That’s not nice, and fixed. But, the problem is rather recurrent, and the reason why I like <a href=\"http://en.wikipedia.org/wiki/Chemical_Markup_Language\">CML</a>\nso much: invalid input. CML, based on XML, has several general validation approaches that give in-depth error messages of what is wrong with the file.</p>\n\n<p>So, I <a href=\"http://blueobelisk.stackexchange.com/questions/125/how-do-i-validate-if-my-mdl-sd-file-is-correct\">asked on the BOx</a> what the Open Source cheminformatics community\nhad to offer for this. Turns out that several tools find problems in the files, but none could report where the error occurred.</p>\n\n<h2 id=\"validation\">Validation</h2>\n\n<p>Now, some time ago, I played with two reading modes, RELAXED and STRICT, as faulty files is core cheminformatics material, and the software is blamed if the QSAR model\nresulting from it is not good (seriously). Anyways, a small API change in the CDK would make a validating MDLV2000Reader quite a step closer, but I had not followed up\non it until last Friday where I patch I was reviewing caused 6 new unit test fails. The new fails were caused by a assumption which turned out the be false in the test\nfiles used in those 6 unit tests.</p>\n\n<p>The MDL (or Symyx) <a href=\"http://www.google.se/search?ie=UTF-8&amp;q=ctfile.pdf\">molfile specifications</a> (not an Open Specification) defines an atom block line as:</p>\n\n<div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>xxxxx.xxxxyyyyy.yyyyzzzzz.zzzz aaaddcccssshhhbbbvvvHHHrrriiimmmnnneee\n</code></pre></div></div>\n\n<p>but does not specify which fields are optional. And indeed, many tools around save MDL molfiles with one or more fields missing, leading to shorter than expected\nline lengths. And, as you might have expected, the failing unit tests had files with lines missing the field introduced by the patch, causing Exceptions being thrown around.\n<em>I have yet to make up my mind of the lack of those fields is a problem in the file, or allowed by the format.</em> In either case, the information from that field is not\navailable, and the reader could safely ignore the missing information. Per user demand.</p>\n\n<p>Now, personally, I rather send the file back to the user with a proper error report and show them what is wrong with the file. Or better, provide them with a MDL V2000\ntext editor (e.g. in Bioclipse) which would graphically highlight errors, as many of us are used to with Eclipse:</p>\n\n<p><img src=\"/assets/images/errorReporting.png\" alt=\"\" /></p>\n\n<h2 id=\"cdk-patch\">CDK Patch</h2>\n\n<p>So, I am hacking up a patch for CDK master to allow error reporting by <a href=\"http://pele.farmbio.uu.se/nightly-1.2.3/cdk-javadoc-1.2.4/org/openscience/cdk/io/IChemObjectReader.html\">IChemObjectReaders</a>.\nThe initial version of the API update and use in the MDLV2000Reader are available as <a href=\"http://gist.github.com/290659\">Gist 290659</a>. They are not final yet, as I realized\nwhen making the above screenshot, that merely int col is not enough, and that I actually need the <em>startCol</em> and <em>endCol</em> positions instead. Also, there are only\nan error level at this moment, and no warning level as in the screenshot.</p>\n\n<p>That said, I created a jar (<em>ant dist-large</em>) and saved it as mdlCheck.jar, and wrote a bit of Groovy:</p>\n\n<p>which defines a class implementing the new <em>IChemObjectReaderErrorHandler</em> and then reads a MDL molfile. And the output looks like it fulfills\nmy needs (<a href=\"http://cdk.git.sourceforge.net/git/gitweb.cgi?p=cdk/cdk;a=blob;f=src/test/data/mdl/test6.sdf;h=7f738c30899e6b6f13d57ff920be4f6f7342ede9;hb=HEAD\">test6.sf</a>):</p>\n\n<div class=\"language-shell highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nv\">$ CLASSPATH</span><span class=\"o\">=</span>mdlCheck.jar groovy mdlCheck.groovy src/test/data/mdl/test6.sdf\nlocation: 5, 35: Could not parse mass difference field.\n  -&gt; For input string: <span class=\"s2\">\"\"</span>\nlocation: 6, 35: Could not parse mass difference field.\n  -&gt; For input string: <span class=\"s2\">\"\"</span>\n</code></pre></div></div>\n\n<p><em>Note to myself, that atom block does not like like a MDL molfile atom block at all!</em> Every second line outputs the Exception\npassed to the error handler. I have to say, those messages are rather cryptic, but resulting from a NumberFormatException, if not mistaken.</p>\n\n<p>Or, another common found issue (using D and T as element symbols; <a href=\"http://cdk.git.sourceforge.net/git/gitweb.cgi?p=cdk/cdk;a=blob;f=src/test/data/mdl/hisotopes.mol;h=ff0c5aeaea88818938630af632b730d987ed9f2d;hb=HEAD\">hisotopes.mol</a>):</p>\n\n<div class=\"language-shell highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nv\">$ CLASSPATH</span><span class=\"o\">=</span>mdlCheck.jar groovy mdlCheck.groovy src/test/data/mdl/hisotopes.mol\nlocation: 6, 32: Invalid element type. Must be an existing element, or one <span class=\"k\">in</span>: A, Q, L, LP, <span class=\"k\">*</span><span class=\"nb\">.</span>\nlocation: 7, 32: Invalid element type. Must be an existing element, or one <span class=\"k\">in</span>: A, Q, L, LP, <span class=\"k\">*</span><span class=\"nb\">.</span>\n</code></pre></div></div>\n\n<p>Enough for now… dinner time.</p>",
      "summary": "Bioclipse 2.0 introduced a new, powerful molecular table support, and we have been eager to test that on large SD files. A recent ChEBI SD file failed to open, and eyes were immediately at the CDK, which is the cheminformatics library used in Bioclipse.",
      "image": "https://chem-bla-ics.linkedchemistry.info/assets/images/errorReporting.png",
      "date_published": "2010-01-30T00:10:00+00:00",
      "date_modified": "2010-01-30T00:10:00+00:00",
      "tags": ["cdk","chemistry"],
      
      
      
      
      
      
        "authors": [ { "name": "Egon Willighagen", "url": "https://orcid.org/0000-0001-7542-0286" } ]
      
    }

  ]
}
