{
  "id": 230473,
  "title": "Stereochemical layer confusion (and clarification)",
  "url": "/competitions/bms-molecular-translation/discussion/230473",
  "author_name": "",
  "post_date": "2021-04-03T22:47:23.310690800Z",
  "votes": 8,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I found that my model recovers relatively well the Main layer (chemical formula, atom numbers and their connections) - much better than I would do myself, but it really struggles with the  Stereochemical layer (/t and /m), which seems to me should be a simpler task - it is almost a binary classification.</p>\n<p>Here are some excerpts from InChI manual, which I don't fully understand, and I will appreciate very much if someone can explain it.<br>\n<img src=\"https://user-images.githubusercontent.com/4602302/113492040-cfce0200-94dd-11eb-8443-7ce3e6c86cdf.png\" alt=\"image\"><br>\n<img src=\"https://user-images.githubusercontent.com/4602302/113492055-e2e0d200-94dd-11eb-8150-036f0e2c2098.png\" alt=\"image\"></p>\n<p>Another source of confusion for me is that, if we take an example molecule from the training dataset, then there will 3 different representations for it, which are somehow equivalent, but that is not obvious for me.</p>\n<p><code>InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1</code></p>\n<table>\n<thead>\n<tr>\n<th>train image</th>\n<th>rdkit generated</th>\n<th>from pubchem</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><img src=\"https://user-images.githubusercontent.com/4602302/113492216-a2358880-94de-11eb-9761-5a85f1066e86.png\" alt=\"image\"></td>\n<td><img src=\"https://user-images.githubusercontent.com/4602302/113492228-ab265a00-94de-11eb-9776-0739bbd192c8.png\" alt=\"image\"></td>\n<td><img src=\"https://user-images.githubusercontent.com/4602302/113492238-b2e5fe80-94de-11eb-8b10-a23399e9d9ac.png\" alt=\"image\"></td>\n</tr>\n</tbody>\n</table>\n<p>So my questions are:</p>\n<ol>\n<li>Is it really possible to unambiguously recover stereo information (/t and /m) from image?</li>\n<li>What are those numbers on Fig. 25 on the right image in the center (bigger ones, smaller - are atom numbers). How are they calculated and how do they affect +/- assignment?</li>\n<li>The rule for assignment of +/- says, if atom numbers of neighbors increase clockwise, we should assign +, but I don't see it holds true for Fig. 25</li>\n<li>Why there are different (equivalent?) ways to display stereo bonds for the same molecule? </li>\n</ol>\n<p><strong>Update:</strong><br>\nOk, after watching some stereochemestry videos, it makes more sense now. You really need to think 3D and have good spatial imagination to be able to identify the handedness. The wedged bonds are \"looking at you\", dashed - \"away from you\", regular bonds - all in the same plane. Then depending where the hydrogen (or atom with lowest number) is, it might be easier or harder to proceed, because sometimes you need to change point of view in your head looking from behind of the plane, and only then you should check whether atom numbers of neighbours increase clockwise or anti-clockwise (in 3D!).</p>\n<p>What I also realized that in train images unlike generated by rdkit or pubchem, hydrogen atom is always drawn explicitly, which actually helps, because anyway you have to imagine all the bonds in space and you need to know their orientation (even hydrogens).</p>\n<p>Also it is more clear now, how different 2d depictions might correspond to the same molecule - it is like depending on POV you might get different 2d projections for the same 3d object - looks like there is no canonical POV.</p>\n<p>Now I'm thinking that it is possible to recover stereo information unambiguously from the image, though it is not always easy to do in your head, and for some reason my model also not very good at spatial thinking.</p>",
  "messages": [
    {
      "id": "1262179",
      "postDate": "04/03/2021 22:47:23",
      "content": "<p>I found that my model recovers relatively well the Main layer (chemical formula, atom numbers and their connections) - much better than I would do myself, but it really struggles with the  Stereochemical layer (/t and /m), which seems to me should be a simpler task - it is almost a binary classification.</p>\n<p>Here are some excerpts from InChI manual, which I don't fully understand, and I will appreciate very much if someone can explain it.<br>\n<img src=\"https://user-images.githubusercontent.com/4602302/113492040-cfce0200-94dd-11eb-8443-7ce3e6c86cdf.png\" alt=\"image\"><br>\n<img src=\"https://user-images.githubusercontent.com/4602302/113492055-e2e0d200-94dd-11eb-8150-036f0e2c2098.png\" alt=\"image\"></p>\n<p>Another source of confusion for me is that, if we take an example molecule from the training dataset, then there will 3 different representations for it, which are somehow equivalent, but that is not obvious for me.</p>\n<p><code>InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1</code></p>\n<table>\n<thead>\n<tr>\n<th>train image</th>\n<th>rdkit generated</th>\n<th>from pubchem</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><img src=\"https://user-images.githubusercontent.com/4602302/113492216-a2358880-94de-11eb-9761-5a85f1066e86.png\" alt=\"image\"></td>\n<td><img src=\"https://user-images.githubusercontent.com/4602302/113492228-ab265a00-94de-11eb-9776-0739bbd192c8.png\" alt=\"image\"></td>\n<td><img src=\"https://user-images.githubusercontent.com/4602302/113492238-b2e5fe80-94de-11eb-8b10-a23399e9d9ac.png\" alt=\"image\"></td>\n</tr>\n</tbody>\n</table>\n<p>So my questions are:</p>\n<ol>\n<li>Is it really possible to unambiguously recover stereo information (/t and /m) from image?</li>\n<li>What are those numbers on Fig. 25 on the right image in the center (bigger ones, smaller - are atom numbers). How are they calculated and how do they affect +/- assignment?</li>\n<li>The rule for assignment of +/- says, if atom numbers of neighbors increase clockwise, we should assign +, but I don't see it holds true for Fig. 25</li>\n<li>Why there are different (equivalent?) ways to display stereo bonds for the same molecule? </li>\n</ol>\n<p><strong>Update:</strong><br>\nOk, after watching some stereochemestry videos, it makes more sense now. You really need to think 3D and have good spatial imagination to be able to identify the handedness. The wedged bonds are \"looking at you\", dashed - \"away from you\", regular bonds - all in the same plane. Then depending where the hydrogen (or atom with lowest number) is, it might be easier or harder to proceed, because sometimes you need to change point of view in your head looking from behind of the plane, and only then you should check whether atom numbers of neighbours increase clockwise or anti-clockwise (in 3D!).</p>\n<p>What I also realized that in train images unlike generated by rdkit or pubchem, hydrogen atom is always drawn explicitly, which actually helps, because anyway you have to imagine all the bonds in space and you need to know their orientation (even hydrogens).</p>\n<p>Also it is more clear now, how different 2d depictions might correspond to the same molecule - it is like depending on POV you might get different 2d projections for the same 3d object - looks like there is no canonical POV.</p>\n<p>Now I'm thinking that it is possible to recover stereo information unambiguously from the image, though it is not always easy to do in your head, and for some reason my model also not very good at spatial thinking.</p>",
      "rawMarkdown": "I found that my model recovers relatively well the Main layer (chemical formula, atom numbers and their connections) - much better than I would do myself, but it really struggles with the  Stereochemical layer (/t and /m), which seems to me should be a simpler task - it is almost a binary classification.\n\nHere are some excerpts from InChI manual, which I don't fully understand, and I will appreciate very much if someone can explain it.\n![image](https://user-images.githubusercontent.com/4602302/113492040-cfce0200-94dd-11eb-8443-7ce3e6c86cdf.png)\n![image](https://user-images.githubusercontent.com/4602302/113492055-e2e0d200-94dd-11eb-8150-036f0e2c2098.png)\n\nAnother source of confusion for me is that, if we take an example molecule from the training dataset, then there will 3 different representations for it, which are somehow equivalent, but that is not obvious for me.\n\n`InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1`\n| train image | rdkit generated | from pubchem |\n| --- | --- |\n| ![image](https://user-images.githubusercontent.com/4602302/113492216-a2358880-94de-11eb-9761-5a85f1066e86.png) |![image](https://user-images.githubusercontent.com/4602302/113492228-ab265a00-94de-11eb-9776-0739bbd192c8.png) | ![image](https://user-images.githubusercontent.com/4602302/113492238-b2e5fe80-94de-11eb-8b10-a23399e9d9ac.png) |\n\nSo my questions are:\n1. Is it really possible to unambiguously recover stereo information (/t and /m) from image?\n2. What are those numbers on Fig. 25 on the right image in the center (bigger ones, smaller - are atom numbers). How are they calculated and how do they affect +/- assignment?\n3. The rule for assignment of +/- says, if atom numbers of neighbors increase clockwise, we should assign +, but I don't see it holds true for Fig. 25\n4. Why there are different (equivalent?) ways to display stereo bonds for the same molecule? \n\n**Update:**\nOk, after watching some stereochemestry videos, it makes more sense now. You really need to think 3D and have good spatial imagination to be able to identify the handedness. The wedged bonds are \"looking at you\", dashed - \"away from you\", regular bonds - all in the same plane. Then depending where the hydrogen (or atom with lowest number) is, it might be easier or harder to proceed, because sometimes you need to change point of view in your head looking from behind of the plane, and only then you should check whether atom numbers of neighbours increase clockwise or anti-clockwise (in 3D!).\n\nWhat I also realized that in train images unlike generated by rdkit or pubchem, hydrogen atom is always drawn explicitly, which actually helps, because anyway you have to imagine all the bonds in space and you need to know their orientation (even hydrogens).\n\nAlso it is more clear now, how different 2d depictions might correspond to the same molecule - it is like depending on POV you might get different 2d projections for the same 3d object - looks like there is no canonical POV.\n\nNow I'm thinking that it is possible to recover stereo information unambiguously from the image, though it is not always easy to do in your head, and for some reason my model also not very good at spatial thinking.",
      "votes": null
    },
    {
      "id": "1262279",
      "postDate": "04/04/2021 04:02:09",
      "content": "<p><a href=\"https://www.kaggle.com/stassl\" target=\"_blank\">@stassl</a> It will be great if a chemistry domain expert (may be from the Organizer's team) answers all these questions.</p>\n<ul>\n<li>Several chemistry concepts require detailed explanation</li>\n<li>InChI documentation is not that easy to read either, say what assumptions are used while generating \"standard\" InChI</li>\n</ul>",
      "rawMarkdown": "stassl It will be great if a chemistry domain expert (may be from the Organizer's team) answers all these questions.\n\n- Several chemistry concepts require detailed explanation\n- InChI documentation is not that easy to read either, say what assumptions are used while generating \"standard\" InChI",
      "votes": null
    },
    {
      "id": "1264787",
      "postDate": "04/06/2021 12:28:00",
      "content": "<p>there are more here in the InChI FAQ<br>\n<a href=\"https://www.inchi-trust.org/download/104/inchi-faq.pdf\" target=\"_blank\">https://www.inchi-trust.org/download/104/inchi-faq.pdf</a></p>\n<p>E.g.</p>\n<p>12.2. Can I compare structures by looking at specific layers from their InChIs? </p>\n<p>To quote the InChI Technical Manual: “Values computed for each layer depend on prior layers.<br>\nAs a consequence, for example, two stereochemical layers for different compounds cannot be<br>\ndirectly compared – comparisons must involve the complete set of preceding layers. On the other<br>\nhand, layers do not depend on successive layers. \"</p>",
      "rawMarkdown": "there are more here in the InChI FAQ\nhttps://www.inchi-trust.org/download/104/inchi-faq.pdf\n\n\nE.g.\n\n12.2. Can I compare structures by looking at specific layers from their InChIs? \n\nTo quote the InChI Technical Manual: “Values computed for each layer depend on prior layers.\nAs a consequence, for example, two stereochemical layers for different compounds cannot be\ndirectly compared – comparisons must involve the complete set of preceding layers. On the other\nhand, layers do not depend on successive layers. \"",
      "votes": null
    },
    {
      "id": "1264883",
      "postDate": "04/06/2021 13:36:36",
      "content": "<p>InChI format is so difficult to understand,<br>\nwhich makes the LB scores (already less than 1.5) very impressive!</p>",
      "rawMarkdown": "InChI format is so difficult to understand,\nwhich makes the LB scores (already less than 1.5) very impressive!",
      "votes": null
    },
    {
      "id": "1265617",
      "postDate": "04/07/2021 04:36:21",
      "content": "<p><a href=\"https://molview.org/\" target=\"_blank\">Here </a> you can see in 3d. <br>\nFor example: <br>\n<a href=\"https://molview.org/?q=InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1\" target=\"_blank\">https://molview.org/?q=InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1</a></p>",
      "rawMarkdown": "[Here ](https://molview.org/) you can see in 3d. \nFor example: \nhttps://molview.org/?q=InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1262279,
      "author_name": "sirishks",
      "author_url": "",
      "post_date": "04/04/2021 04:02:09",
      "content": "<p><a href=\"https://www.kaggle.com/stassl\" target=\"_blank\">@stassl</a> It will be great if a chemistry domain expert (may be from the Organizer's team) answers all these questions.</p>\n<ul>\n<li>Several chemistry concepts require detailed explanation</li>\n<li>InChI documentation is not that easy to read either, say what assumptions are used while generating \"standard\" InChI</li>\n</ul>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1264787,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "04/06/2021 12:28:00",
      "content": "<p>there are more here in the InChI FAQ<br>\n<a href=\"https://www.inchi-trust.org/download/104/inchi-faq.pdf\" target=\"_blank\">https://www.inchi-trust.org/download/104/inchi-faq.pdf</a></p>\n<p>E.g.</p>\n<p>12.2. Can I compare structures by looking at specific layers from their InChIs? </p>\n<p>To quote the InChI Technical Manual: “Values computed for each layer depend on prior layers.<br>\nAs a consequence, for example, two stereochemical layers for different compounds cannot be<br>\ndirectly compared – comparisons must involve the complete set of preceding layers. On the other<br>\nhand, layers do not depend on successive layers. \"</p>",
      "votes": null,
      "replies": [
        {
          "id": 1264883,
          "author_name": "sirishks",
          "author_url": "",
          "post_date": "04/06/2021 13:36:36",
          "content": "<p>InChI format is so difficult to understand,<br>\nwhich makes the LB scores (already less than 1.5) very impressive!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1265617,
      "author_name": "sapr3s",
      "author_url": "",
      "post_date": "04/07/2021 04:36:21",
      "content": "<p><a href=\"https://molview.org/\" target=\"_blank\">Here </a> you can see in 3d. <br>\nFor example: <br>\n<a href=\"https://molview.org/?q=InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1\" target=\"_blank\">https://molview.org/?q=InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1</a></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1262179": "I found that my model recovers relatively well the Main layer (chemical formula, atom numbers and their connections) - much better than I would do myself, but it really struggles with the  Stereochemical layer (/t and /m), which seems to me should be a simpler task - it is almost a binary classification.\n\nHere are some excerpts from InChI manual, which I don't fully understand, and I will appreciate very much if someone can explain it.\n![image](https://user-images.githubusercontent.com/4602302/113492040-cfce0200-94dd-11eb-8443-7ce3e6c86cdf.png)\n![image](https://user-images.githubusercontent.com/4602302/113492055-e2e0d200-94dd-11eb-8150-036f0e2c2098.png)\n\nAnother source of confusion for me is that, if we take an example molecule from the training dataset, then there will 3 different representations for it, which are somehow equivalent, but that is not obvious for me.\n\n`InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1`\n| train image | rdkit generated | from pubchem |\n| --- | --- |\n| ![image](https://user-images.githubusercontent.com/4602302/113492216-a2358880-94de-11eb-9761-5a85f1066e86.png) |![image](https://user-images.githubusercontent.com/4602302/113492228-ab265a00-94de-11eb-9776-0739bbd192c8.png) | ![image](https://user-images.githubusercontent.com/4602302/113492238-b2e5fe80-94de-11eb-8b10-a23399e9d9ac.png) |\n\nSo my questions are:\n1. Is it really possible to unambiguously recover stereo information (/t and /m) from image?\n2. What are those numbers on Fig. 25 on the right image in the center (bigger ones, smaller - are atom numbers). How are they calculated and how do they affect +/- assignment?\n3. The rule for assignment of +/- says, if atom numbers of neighbors increase clockwise, we should assign +, but I don't see it holds true for Fig. 25\n4. Why there are different (equivalent?) ways to display stereo bonds for the same molecule? \n\n**Update:**\nOk, after watching some stereochemestry videos, it makes more sense now. You really need to think 3D and have good spatial imagination to be able to identify the handedness. The wedged bonds are \"looking at you\", dashed - \"away from you\", regular bonds - all in the same plane. Then depending where the hydrogen (or atom with lowest number) is, it might be easier or harder to proceed, because sometimes you need to change point of view in your head looking from behind of the plane, and only then you should check whether atom numbers of neighbours increase clockwise or anti-clockwise (in 3D!).\n\nWhat I also realized that in train images unlike generated by rdkit or pubchem, hydrogen atom is always drawn explicitly, which actually helps, because anyway you have to imagine all the bonds in space and you need to know their orientation (even hydrogens).\n\nAlso it is more clear now, how different 2d depictions might correspond to the same molecule - it is like depending on POV you might get different 2d projections for the same 3d object - looks like there is no canonical POV.\n\nNow I'm thinking that it is possible to recover stereo information unambiguously from the image, though it is not always easy to do in your head, and for some reason my model also not very good at spatial thinking.",
    "1262279": "stassl It will be great if a chemistry domain expert (may be from the Organizer's team) answers all these questions.\n\n- Several chemistry concepts require detailed explanation\n- InChI documentation is not that easy to read either, say what assumptions are used while generating \"standard\" InChI",
    "1264787": "there are more here in the InChI FAQ\nhttps://www.inchi-trust.org/download/104/inchi-faq.pdf\n\n\nE.g.\n\n12.2. Can I compare structures by looking at specific layers from their InChIs? \n\nTo quote the InChI Technical Manual: “Values computed for each layer depend on prior layers.\nAs a consequence, for example, two stereochemical layers for different compounds cannot be\ndirectly compared – comparisons must involve the complete set of preceding layers. On the other\nhand, layers do not depend on successive layers. \"",
    "1264883": "InChI format is so difficult to understand,\nwhich makes the LB scores (already less than 1.5) very impressive!",
    "1265617": "[Here ](https://molview.org/) you can see in 3d. \nFor example: \nhttps://molview.org/?q=InChI=1S/C7H7BrClN/c1-5(9)7-3-2-6(8)4-10-7/h2-5H,1H3/t5-/m0/s1"
  },
  "source": "meta"
}