{
  "id": 225790,
  "title": "Formulas validation",
  "url": "/competitions/bms-molecular-translation/discussion/225790",
  "author_name": "",
  "post_date": "2021-03-14T01:04:36.159353900Z",
  "votes": 7,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Does anyone use any output formulas validation? I mean to check is the obtained formula really exists or not. And in case if not - try to make it real.</p>\n<p>If yes, what approaches are you using and sources of valid formulas?</p>",
  "messages": [
    {
      "id": "1237268",
      "postDate": "03/14/2021 01:04:36",
      "content": "<p>Does anyone use any output formulas validation? I mean to check is the obtained formula really exists or not. And in case if not - try to make it real.</p>\n<p>If yes, what approaches are you using and sources of valid formulas?</p>",
      "rawMarkdown": "Does anyone use any output formulas validation? I mean to check is the obtained formula really exists or not. And in case if not - try to make it real.\n\nIf yes, what approaches are you using and sources of valid formulas?",
      "votes": null
    },
    {
      "id": "1237593",
      "postDate": "03/14/2021 09:32:36",
      "content": "<p>I guess one way of validating the output is to use <code>MolFromInchi</code> conversion. <br>\nHaving a more sophisticated check (\"try to make it real\") may be quite tricky.</p>\n<pre><code>from rdkit import Chem\ninchi = 'InChI=1S/C13H20OS/c1-9(2)8-15-13-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3'\nisinstance(Chem.MolFromInchi(inchi), Chem.rdchem.Mol)  # evaluates to True\n# flip 13 and 15\ninchi_corrupted = 'InChI=1S/C13H20OS/c1-9(2)8-13-15-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3'\nChem.MolFromInchi(inchi_corrupted) is None  # evaluates to True\n# ERROR: *Conversion failed on component(s) 1(C13H20OS)\n</code></pre>",
      "rawMarkdown": "I guess one way of validating the output is to use `MolFromInchi` conversion. \nHaving a more sophisticated check (\"try to make it real\") may be quite tricky.\n```\nfrom rdkit import Chem\ninchi = 'InChI=1S/C13H20OS/c1-9(2)8-15-13-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3'\nisinstance(Chem.MolFromInchi(inchi), Chem.rdchem.Mol)  # evaluates to True\n# flip 13 and 15\ninchi_corrupted = 'InChI=1S/C13H20OS/c1-9(2)8-13-15-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3'\nChem.MolFromInchi(inchi_corrupted) is None  # evaluates to True\n# ERROR: *Conversion failed on component(s) 1(C13H20OS)\n```",
      "votes": null
    },
    {
      "id": "1237669",
      "postDate": "03/14/2021 11:12:18",
      "content": "<p>Interesting thought, it makes the assumption that rdkit can convert from a valid InChI which I guess is alright?</p>",
      "rawMarkdown": "Interesting thought, it makes the assumption that rdkit can convert from a valid InChI which I guess is alright?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1237593,
      "author_name": "maxjeblick",
      "author_url": "",
      "post_date": "03/14/2021 09:32:36",
      "content": "<p>I guess one way of validating the output is to use <code>MolFromInchi</code> conversion. <br>\nHaving a more sophisticated check (\"try to make it real\") may be quite tricky.</p>\n<pre><code>from rdkit import Chem\ninchi = 'InChI=1S/C13H20OS/c1-9(2)8-15-13-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3'\nisinstance(Chem.MolFromInchi(inchi), Chem.rdchem.Mol)  # evaluates to True\n# flip 13 and 15\ninchi_corrupted = 'InChI=1S/C13H20OS/c1-9(2)8-13-15-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3'\nChem.MolFromInchi(inchi_corrupted) is None  # evaluates to True\n# ERROR: *Conversion failed on component(s) 1(C13H20OS)\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 1237669,
          "author_name": "arka47",
          "author_url": "",
          "post_date": "03/14/2021 11:12:18",
          "content": "<p>Interesting thought, it makes the assumption that rdkit can convert from a valid InChI which I guess is alright?</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1237268": "Does anyone use any output formulas validation? I mean to check is the obtained formula really exists or not. And in case if not - try to make it real.\n\nIf yes, what approaches are you using and sources of valid formulas?",
    "1237593": "I guess one way of validating the output is to use `MolFromInchi` conversion. \nHaving a more sophisticated check (\"try to make it real\") may be quite tricky.\n```\nfrom rdkit import Chem\ninchi = 'InChI=1S/C13H20OS/c1-9(2)8-15-13-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3'\nisinstance(Chem.MolFromInchi(inchi), Chem.rdchem.Mol)  # evaluates to True\n# flip 13 and 15\ninchi_corrupted = 'InChI=1S/C13H20OS/c1-9(2)8-13-15-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3'\nChem.MolFromInchi(inchi_corrupted) is None  # evaluates to True\n# ERROR: *Conversion failed on component(s) 1(C13H20OS)\n```",
    "1237669": "Interesting thought, it makes the assumption that rdkit can convert from a valid InChI which I guess is alright?"
  },
  "source": "meta"
}