{
  "id": 223503,
  "title": "Target InChI Notation Explained With Examples , And some pointers about Problem !",
  "url": "/competitions/bms-molecular-translation/discussion/223503",
  "author_name": "",
  "post_date": "2021-03-04T05:38:07.657228100Z",
  "votes": 32,
  "comment_count": 7,
  "views": 0,
  "content": "<p>This seems to be a very interesting and challenging competition in which we have to predict the InChI notation for various chemical molecules , Chemistry being my favourite subject I decided to read up some resources on InChI Notation briefly and also make a note of Potential challenges with the task at hand ! Doing so will help us come up with better modelling strategies rather than coming up with black box models , This is to help someone who hasn't studied chemistry or would like to understand task better!</p>\n<p><strong>InChI Purpose:</strong> InChI is a way to textually represent Formula of Organic Compounds (Those having Carbon and Hydrogen Bonds) , This is done as Organic Chemists represent compounds using  a 3D representation of  compounds  , Refer <a href=\"https://www.google.com/search?q=benzene&amp;sxsrf=ALeKk01Cz9Ds7BpKQnPqqKnAJVExHyIIiA:1614836146006&amp;tbm=isch&amp;source=iu&amp;ictx=1&amp;fir=zEik1pkP6BYYhM%252CrMH63lxC9_L8rM%252C_&amp;vet=1&amp;usg=AI4_-kQeVoXu5gT3-8jH8p-m6YnasjS1-A&amp;sa=X&amp;ved=2ahUKEwiInOm29ZXvAhVCWX0KHeg4DwYQ_h16BAgVEAE#imgrc=zEik1pkP6BYYhM\" target=\"_blank\">this </a>image to understand how benzene (a popular compound in organic chemistry is represented) ,  However in Research Papers and across Databases Text search is used rather than image search so InChI representation is used to effectively represent Molecular compounds with text representation , than image representations.</p>\n<p>** Some of the Advantages of InChI Structures : **</p>\n<ol>\n<li><p>Stereo Centers can be represented effectively using InChI structures  ( For the unaware stereo chemistry refers to how atoms are arranged in 3 D space , this can impact chemical reactions and how they occur )</p></li>\n<li><p>Isomers can be represented effectively using this notation (Isomers are the compounds having identical molecular formula but differ in arrangements of atoms in space they do not share identical physical or chemical properties)</p></li>\n</ol>\n<p><strong>Some Disadvantages of InChI Structures :</strong></p>\n<ol>\n<li><p>They are required to be generated manually or using some algorithm , which is quite error prone.</p></li>\n<li><p>It becomes difficult for Humans to comprehend the structure , <strong>Understanding structure in InChI notation is difficult even for experienced people infact he would rather prefer the 3D representation</strong> .</p></li>\n<li><p>It becomes difficult to search for appropriate substructure as we have multiple layers for representing (we will get there in a while just  bear with me)</p></li>\n</ol>\n<p><strong>InChI Explained with some  examples:</strong></p>\n<p><strong>Example 1:</strong><br>\nLet us now see some examples , let us start with a simple example of ethanol(C2H5OH) , for someone familiar with organic chemistry this is quite common compound which is derivative of alcohol that occurs most frequently and is used in perfumes , varnishes , preservatives and drugs , the molecular  3 D represenation of ethanol can be found <a href=\"https://www.google.com/search?q=ethanol&amp;sxsrf=ALeKk03pGojU_uIi1uw6_fWC2yzsWR7T8w:1614837497678&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ved=2ahUKEwiw1Ky7-pXvAhUMT30KHeiOCgsQ_AUoAnoECBMQBA&amp;biw=1536&amp;bih=698#imgrc=4DRm6Efr_V49aM\" target=\"_blank\">here</a> .</p>\n<p>In InChI we have multiple layers which are further having sublayers</p>\n<ol>\n<li><p>Main Layer<br>\nConsists of following sublayers<br>\n    a. Chemical formula (no prefix) : Occurs in almost every InChI representation , it describes the main formula<br>\n    b.Atom connections (prefix: \"c\"). The atoms in the chemical formula (except for hydrogens) are numbered in sequence; this sublayer <br>\n                                                            describes which atoms are connected by bonds to which other ones.<br>\n    c. Hydrogen atoms (prefix: \"h\"). Describes how many hydrogen atoms are connected to each of the other atoms.</p></li>\n<li><p>Charge Layer </p></li>\n</ol>\n<p>Consists of following sublayers.<br>\n        a. charge sublayer (prefix: \"q\")<br>\n        b. proton sublayer (prefix: \"p\" for \"protons\")</p>\n<ol>\n<li><p>Stereochemical layer (Important for understanding 3D arrangement of atoms)<br>\n    a. double bonds and cumulenes (prefix: \"b\")<br>\n    b. tetrahedral stereochemistry of atoms and allenes (prefixes: \"t\", \"m\")<br>\n    c. type of stereochemistry information (prefix: \"s\")</p></li>\n<li><p>Isotopic layer (prefixes: \"i\", \"h\", as well as \"b\", \"t\", \"m\", \"s\" for isotopic stereochemistry)</p></li>\n<li><p>Fixed-H layer (prefix: \"f\"); contains some or all of the above types of layers except atom connections; may end with \"o\" sublayer; never included in standard InChI</p></li>\n<li><p>Reconnected layer (prefix: \"r\"); contains the whole InChI of a structure with reconnected metal atoms; never included in standard InChI</p></li>\n</ol>\n<p>As you can see by doing this kind of structuring of compounds it becomes easy to apply pattern search and it becomes easier for databases to store and retrieve this information.</p>\n<p>Let us get back to the Example 1 , I will be discussing only Main Layer as discussing other layers are out of my understanding and they require quite detail understanding of chemistry , hence let us focus on Main Layer only . (<strong>Please Keep Image of Ethanol Formula open besides you while reading this explanation</strong>)</p>\n<ol>\n<li><p>First we start with InChI = 1S , here 1 is version number and S is standard , next we go to main layer but before that we have to separate it with '/' and also there are multiple sublayers in main layer</p></li>\n<li><p>Main Layer Sublayer 1: Here we just represent the formula which is used in usual chemistry notation it is simple C2H6O (2 Atoms of C , 6 Atoms of H , and 1 of O)</p></li>\n<li><p>Main Layer Sublayer 2 : Here we index (starting with 1 ) all atoms other than Hydrogen and represent with '-' with atoms are connected , Note that prefix 'c' implies it is connection layer and not carbon layer(just to avoid confusion for some folks) , Hence we have output as \"c1-2-3\"  (As at index 1 we have Carbon atom connected to Carbon Atom at index 2 and which in turn is connected to oxygen atom at index 3)</p></li>\n<li><p>Main Sublayer 3 : This is related to 'H' atoms (Hydrogen) hence they start with prefix 'h' and it indicates how many hydrogen atoms are connected to each other hydrogen atoms . We have output as \"h3H,2H2,1H3\" . This simply means (Reading backwards) atom at index 1 (carbon) is connected to 3 H atoms , atom at index 2(Again carbon) is connected to 2 H atoms , finally 3H means  atom at 3rd location (Oxygen atom ) is connected to 1 H atom . </p></li>\n</ol>\n<p><strong>Example 2 :</strong><br>\nAnother simple and bit tricky example  involving Acetic Acid can be found in the video <a href=\"https://www.youtube.com/watch?v=V9HHnRAS5BA\" target=\"_blank\">here</a> ,<br>\nIf you just want to get to the main stuff skip to 13:47 :)</p>\n<p><strong>Example 3 :</strong><br>\nInChI notations aren't easy to come up with for example for Ascorbic Acid (Vitamin C) , whose 3 D representation can be found <a href=\"https://www.google.com/search?q=ascorbic+acid&amp;tbm=isch&amp;sxsrf=ALeKk02d7LMr6TpujswSvyxl1SfDWyUL7w:1614839158204&amp;source=lnms&amp;sa=X&amp;ved=0ahUKEwisjZPTgJbvAhVXb30KHVFPB4kQ_AUIlgMoAQ&amp;biw=1536&amp;bih=698#imgrc=X1L166vQskyyJM\" target=\"_blank\">here </a> , its InChI notation is \"InChI=1S/C6H8O6/c7-1-2(8)5-3(9)4(10)6(11)12-5/h2,5,7-8,10-11H,1H2/t2-,5+/m0/s1\" , as we can see its not quite easy to come up with </p>\n<p><strong>My Understanding of Problem :</strong></p>\n<ol>\n<li>As per my understanding this problem can be broken down into Image to Text subproblem.</li>\n<li>Here Text can be of variable lengths </li>\n<li>Notice that here we have different text representation for each layer based on Image Input</li>\n</ol>\n<p><strong>Challenges one might face :</strong><br>\nFollowing are key challenges one might face</p>\n<ol>\n<li>Coming up with a good validation strategy</li>\n<li>Handling different layers output (i.e. different InChI layers ouput)</li>\n<li>Dealing with difficult images (i.e. those having lot of branches and chains)</li>\n<li>Dealing with Isomers and Stereoisomers </li>\n</ol>\n<p>Credits :<br>\nWikipedia : <a href=\"https://en.wikipedia.org/wiki/International_Chemical_Identifier\" target=\"_blank\">https://en.wikipedia.org/wiki/International_Chemical_Identifier</a><br>\nYoutube Video : <a href=\"https://www.youtube.com/watch?v=V9HHnRAS5BA\" target=\"_blank\">https://www.youtube.com/watch?v=V9HHnRAS5BA</a></p>\n<p>Best of Luck 😄 !</p>",
  "messages": [
    {
      "id": "1225974",
      "postDate": "03/04/2021 05:38:07",
      "content": "<p>This seems to be a very interesting and challenging competition in which we have to predict the InChI notation for various chemical molecules , Chemistry being my favourite subject I decided to read up some resources on InChI Notation briefly and also make a note of Potential challenges with the task at hand ! Doing so will help us come up with better modelling strategies rather than coming up with black box models , This is to help someone who hasn't studied chemistry or would like to understand task better!</p>\n<p><strong>InChI Purpose:</strong> InChI is a way to textually represent Formula of Organic Compounds (Those having Carbon and Hydrogen Bonds) , This is done as Organic Chemists represent compounds using  a 3D representation of  compounds  , Refer <a href=\"https://www.google.com/search?q=benzene&amp;sxsrf=ALeKk01Cz9Ds7BpKQnPqqKnAJVExHyIIiA:1614836146006&amp;tbm=isch&amp;source=iu&amp;ictx=1&amp;fir=zEik1pkP6BYYhM%252CrMH63lxC9_L8rM%252C_&amp;vet=1&amp;usg=AI4_-kQeVoXu5gT3-8jH8p-m6YnasjS1-A&amp;sa=X&amp;ved=2ahUKEwiInOm29ZXvAhVCWX0KHeg4DwYQ_h16BAgVEAE#imgrc=zEik1pkP6BYYhM\" target=\"_blank\">this </a>image to understand how benzene (a popular compound in organic chemistry is represented) ,  However in Research Papers and across Databases Text search is used rather than image search so InChI representation is used to effectively represent Molecular compounds with text representation , than image representations.</p>\n<p>** Some of the Advantages of InChI Structures : **</p>\n<ol>\n<li><p>Stereo Centers can be represented effectively using InChI structures  ( For the unaware stereo chemistry refers to how atoms are arranged in 3 D space , this can impact chemical reactions and how they occur )</p></li>\n<li><p>Isomers can be represented effectively using this notation (Isomers are the compounds having identical molecular formula but differ in arrangements of atoms in space they do not share identical physical or chemical properties)</p></li>\n</ol>\n<p><strong>Some Disadvantages of InChI Structures :</strong></p>\n<ol>\n<li><p>They are required to be generated manually or using some algorithm , which is quite error prone.</p></li>\n<li><p>It becomes difficult for Humans to comprehend the structure , <strong>Understanding structure in InChI notation is difficult even for experienced people infact he would rather prefer the 3D representation</strong> .</p></li>\n<li><p>It becomes difficult to search for appropriate substructure as we have multiple layers for representing (we will get there in a while just  bear with me)</p></li>\n</ol>\n<p><strong>InChI Explained with some  examples:</strong></p>\n<p><strong>Example 1:</strong><br>\nLet us now see some examples , let us start with a simple example of ethanol(C2H5OH) , for someone familiar with organic chemistry this is quite common compound which is derivative of alcohol that occurs most frequently and is used in perfumes , varnishes , preservatives and drugs , the molecular  3 D represenation of ethanol can be found <a href=\"https://www.google.com/search?q=ethanol&amp;sxsrf=ALeKk03pGojU_uIi1uw6_fWC2yzsWR7T8w:1614837497678&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ved=2ahUKEwiw1Ky7-pXvAhUMT30KHeiOCgsQ_AUoAnoECBMQBA&amp;biw=1536&amp;bih=698#imgrc=4DRm6Efr_V49aM\" target=\"_blank\">here</a> .</p>\n<p>In InChI we have multiple layers which are further having sublayers</p>\n<ol>\n<li><p>Main Layer<br>\nConsists of following sublayers<br>\n    a. Chemical formula (no prefix) : Occurs in almost every InChI representation , it describes the main formula<br>\n    b.Atom connections (prefix: \"c\"). The atoms in the chemical formula (except for hydrogens) are numbered in sequence; this sublayer <br>\n                                                            describes which atoms are connected by bonds to which other ones.<br>\n    c. Hydrogen atoms (prefix: \"h\"). Describes how many hydrogen atoms are connected to each of the other atoms.</p></li>\n<li><p>Charge Layer </p></li>\n</ol>\n<p>Consists of following sublayers.<br>\n        a. charge sublayer (prefix: \"q\")<br>\n        b. proton sublayer (prefix: \"p\" for \"protons\")</p>\n<ol>\n<li><p>Stereochemical layer (Important for understanding 3D arrangement of atoms)<br>\n    a. double bonds and cumulenes (prefix: \"b\")<br>\n    b. tetrahedral stereochemistry of atoms and allenes (prefixes: \"t\", \"m\")<br>\n    c. type of stereochemistry information (prefix: \"s\")</p></li>\n<li><p>Isotopic layer (prefixes: \"i\", \"h\", as well as \"b\", \"t\", \"m\", \"s\" for isotopic stereochemistry)</p></li>\n<li><p>Fixed-H layer (prefix: \"f\"); contains some or all of the above types of layers except atom connections; may end with \"o\" sublayer; never included in standard InChI</p></li>\n<li><p>Reconnected layer (prefix: \"r\"); contains the whole InChI of a structure with reconnected metal atoms; never included in standard InChI</p></li>\n</ol>\n<p>As you can see by doing this kind of structuring of compounds it becomes easy to apply pattern search and it becomes easier for databases to store and retrieve this information.</p>\n<p>Let us get back to the Example 1 , I will be discussing only Main Layer as discussing other layers are out of my understanding and they require quite detail understanding of chemistry , hence let us focus on Main Layer only . (<strong>Please Keep Image of Ethanol Formula open besides you while reading this explanation</strong>)</p>\n<ol>\n<li><p>First we start with InChI = 1S , here 1 is version number and S is standard , next we go to main layer but before that we have to separate it with '/' and also there are multiple sublayers in main layer</p></li>\n<li><p>Main Layer Sublayer 1: Here we just represent the formula which is used in usual chemistry notation it is simple C2H6O (2 Atoms of C , 6 Atoms of H , and 1 of O)</p></li>\n<li><p>Main Layer Sublayer 2 : Here we index (starting with 1 ) all atoms other than Hydrogen and represent with '-' with atoms are connected , Note that prefix 'c' implies it is connection layer and not carbon layer(just to avoid confusion for some folks) , Hence we have output as \"c1-2-3\"  (As at index 1 we have Carbon atom connected to Carbon Atom at index 2 and which in turn is connected to oxygen atom at index 3)</p></li>\n<li><p>Main Sublayer 3 : This is related to 'H' atoms (Hydrogen) hence they start with prefix 'h' and it indicates how many hydrogen atoms are connected to each other hydrogen atoms . We have output as \"h3H,2H2,1H3\" . This simply means (Reading backwards) atom at index 1 (carbon) is connected to 3 H atoms , atom at index 2(Again carbon) is connected to 2 H atoms , finally 3H means  atom at 3rd location (Oxygen atom ) is connected to 1 H atom . </p></li>\n</ol>\n<p><strong>Example 2 :</strong><br>\nAnother simple and bit tricky example  involving Acetic Acid can be found in the video <a href=\"https://www.youtube.com/watch?v=V9HHnRAS5BA\" target=\"_blank\">here</a> ,<br>\nIf you just want to get to the main stuff skip to 13:47 :)</p>\n<p><strong>Example 3 :</strong><br>\nInChI notations aren't easy to come up with for example for Ascorbic Acid (Vitamin C) , whose 3 D representation can be found <a href=\"https://www.google.com/search?q=ascorbic+acid&amp;tbm=isch&amp;sxsrf=ALeKk02d7LMr6TpujswSvyxl1SfDWyUL7w:1614839158204&amp;source=lnms&amp;sa=X&amp;ved=0ahUKEwisjZPTgJbvAhVXb30KHVFPB4kQ_AUIlgMoAQ&amp;biw=1536&amp;bih=698#imgrc=X1L166vQskyyJM\" target=\"_blank\">here </a> , its InChI notation is \"InChI=1S/C6H8O6/c7-1-2(8)5-3(9)4(10)6(11)12-5/h2,5,7-8,10-11H,1H2/t2-,5+/m0/s1\" , as we can see its not quite easy to come up with </p>\n<p><strong>My Understanding of Problem :</strong></p>\n<ol>\n<li>As per my understanding this problem can be broken down into Image to Text subproblem.</li>\n<li>Here Text can be of variable lengths </li>\n<li>Notice that here we have different text representation for each layer based on Image Input</li>\n</ol>\n<p><strong>Challenges one might face :</strong><br>\nFollowing are key challenges one might face</p>\n<ol>\n<li>Coming up with a good validation strategy</li>\n<li>Handling different layers output (i.e. different InChI layers ouput)</li>\n<li>Dealing with difficult images (i.e. those having lot of branches and chains)</li>\n<li>Dealing with Isomers and Stereoisomers </li>\n</ol>\n<p>Credits :<br>\nWikipedia : <a href=\"https://en.wikipedia.org/wiki/International_Chemical_Identifier\" target=\"_blank\">https://en.wikipedia.org/wiki/International_Chemical_Identifier</a><br>\nYoutube Video : <a href=\"https://www.youtube.com/watch?v=V9HHnRAS5BA\" target=\"_blank\">https://www.youtube.com/watch?v=V9HHnRAS5BA</a></p>\n<p>Best of Luck 😄 !</p>",
      "rawMarkdown": "This seems to be a very interesting and challenging competition in which we have to predict the InChI notation for various chemical molecules , Chemistry being my favourite subject I decided to read up some resources on InChI Notation briefly and also make a note of Potential challenges with the task at hand ! Doing so will help us come up with better modelling strategies rather than coming up with black box models , This is to help someone who hasn't studied chemistry or would like to understand task better!\n\n**InChI Purpose:** InChI is a way to textually represent Formula of Organic Compounds (Those having Carbon and Hydrogen Bonds) , This is done as Organic Chemists represent compounds using  a 3D representation of  compounds  , Refer [this ](https://www.google.com/search?q=benzene&sxsrf=ALeKk01Cz9Ds7BpKQnPqqKnAJVExHyIIiA:1614836146006&tbm=isch&source=iu&ictx=1&fir=zEik1pkP6BYYhM%252CrMH63lxC9_L8rM%252C_&vet=1&usg=AI4_-kQeVoXu5gT3-8jH8p-m6YnasjS1-A&sa=X&ved=2ahUKEwiInOm29ZXvAhVCWX0KHeg4DwYQ_h16BAgVEAE#imgrc=zEik1pkP6BYYhM)image to understand how benzene (a popular compound in organic chemistry is represented) ,  However in Research Papers and across Databases Text search is used rather than image search so InChI representation is used to effectively represent Molecular compounds with text representation , than image representations.\n\n\n** Some of the Advantages of InChI Structures : **\n1. Stereo Centers can be represented effectively using InChI structures  ( For the unaware stereo chemistry refers to how atoms are arranged in 3 D space , this can impact chemical reactions and how they occur )\n\n2. Isomers can be represented effectively using this notation (Isomers are the compounds having identical molecular formula but differ in arrangements of atoms in space they do not share identical physical or chemical properties)\n\n\n**Some Disadvantages of InChI Structures :**\n1. They are required to be generated manually or using some algorithm , which is quite error prone.\n\n2. It becomes difficult for Humans to comprehend the structure , **Understanding structure in InChI notation is difficult even for experienced people infact he would rather prefer the 3D representation** .\n\n3. It becomes difficult to search for appropriate substructure as we have multiple layers for representing (we will get there in a while just  bear with me)\n\n**InChI Explained with some  examples:**\n\n**Example 1:**\nLet us now see some examples , let us start with a simple example of ethanol(C2H5OH) , for someone familiar with organic chemistry this is quite common compound which is derivative of alcohol that occurs most frequently and is used in perfumes , varnishes , preservatives and drugs , the molecular  3 D represenation of ethanol can be found [here](https://www.google.com/search?q=ethanol&sxsrf=ALeKk03pGojU_uIi1uw6_fWC2yzsWR7T8w:1614837497678&source=lnms&tbm=isch&sa=X&ved=2ahUKEwiw1Ky7-pXvAhUMT30KHeiOCgsQ_AUoAnoECBMQBA&biw=1536&bih=698#imgrc=4DRm6Efr_V49aM) .\n\nIn InChI we have multiple layers which are further having sublayers\n\n1. Main Layer\nConsists of following sublayers\n        a. Chemical formula (no prefix) : Occurs in almost every InChI representation , it describes the main formula\n        b.Atom connections (prefix: \"c\"). The atoms in the chemical formula (except for hydrogens) are numbered in sequence; this sublayer \n                                                                describes which atoms are connected by bonds to which other ones.\n        c. Hydrogen atoms (prefix: \"h\"). Describes how many hydrogen atoms are connected to each of the other atoms.\n\n2. Charge Layer \n\nConsists of following sublayers.\n        a. charge sublayer (prefix: \"q\")\n        b. proton sublayer (prefix: \"p\" for \"protons\")\n\n\n3. Stereochemical layer (Important for understanding 3D arrangement of atoms)\n        a. double bonds and cumulenes (prefix: \"b\")\n        b. tetrahedral stereochemistry of atoms and allenes (prefixes: \"t\", \"m\")\n        c. type of stereochemistry information (prefix: \"s\")\n\n4. Isotopic layer (prefixes: \"i\", \"h\", as well as \"b\", \"t\", \"m\", \"s\" for isotopic stereochemistry)\n\n5. Fixed-H layer (prefix: \"f\"); contains some or all of the above types of layers except atom connections; may end with \"o\" sublayer; never included in standard InChI\n\n6. Reconnected layer (prefix: \"r\"); contains the whole InChI of a structure with reconnected metal atoms; never included in standard InChI\n\nAs you can see by doing this kind of structuring of compounds it becomes easy to apply pattern search and it becomes easier for databases to store and retrieve this information.\n\nLet us get back to the Example 1 , I will be discussing only Main Layer as discussing other layers are out of my understanding and they require quite detail understanding of chemistry , hence let us focus on Main Layer only . (**Please Keep Image of Ethanol Formula open besides you while reading this explanation**)\n\n1. First we start with InChI = 1S , here 1 is version number and S is standard , next we go to main layer but before that we have to separate it with '/' and also there are multiple sublayers in main layer\n\n2.  Main Layer Sublayer 1: Here we just represent the formula which is used in usual chemistry notation it is simple C2H6O (2 Atoms of C , 6 Atoms of H , and 1 of O)\n\n3. Main Layer Sublayer 2 : Here we index (starting with 1 ) all atoms other than Hydrogen and represent with '-' with atoms are connected , Note that prefix 'c' implies it is connection layer and not carbon layer(just to avoid confusion for some folks) , Hence we have output as \"c1-2-3\"  (As at index 1 we have Carbon atom connected to Carbon Atom at index 2 and which in turn is connected to oxygen atom at index 3)\n\n4. Main Sublayer 3 : This is related to 'H' atoms (Hydrogen) hence they start with prefix 'h' and it indicates how many hydrogen atoms are connected to each other hydrogen atoms . We have output as \"h3H,2H2,1H3\" . This simply means (Reading backwards) atom at index 1 (carbon) is connected to 3 H atoms , atom at index 2(Again carbon) is connected to 2 H atoms , finally 3H means  atom at 3rd location (Oxygen atom ) is connected to 1 H atom . \n\n**Example 2 :**\nAnother simple and bit tricky example  involving Acetic Acid can be found in the video [here](https://www.youtube.com/watch?v=V9HHnRAS5BA) ,\nIf you just want to get to the main stuff skip to 13:47 :)\n\n**Example 3 :**\nInChI notations aren't easy to come up with for example for Ascorbic Acid (Vitamin C) , whose 3 D representation can be found [here ](https://www.google.com/search?q=ascorbic+acid&tbm=isch&sxsrf=ALeKk02d7LMr6TpujswSvyxl1SfDWyUL7w:1614839158204&source=lnms&sa=X&ved=0ahUKEwisjZPTgJbvAhVXb30KHVFPB4kQ_AUIlgMoAQ&biw=1536&bih=698#imgrc=X1L166vQskyyJM) , its InChI notation is \"InChI=1S/C6H8O6/c7-1-2(8)5-3(9)4(10)6(11)12-5/h2,5,7-8,10-11H,1H2/t2-,5+/m0/s1\" , as we can see its not quite easy to come up with \n\n\n**My Understanding of Problem :**\n1. As per my understanding this problem can be broken down into Image to Text subproblem.\n2. Here Text can be of variable lengths \n3. Notice that here we have different text representation for each layer based on Image Input\n\n**Challenges one might face :**\nFollowing are key challenges one might face\n1. Coming up with a good validation strategy\n2. Handling different layers output (i.e. different InChI layers ouput)\n3. Dealing with difficult images (i.e. those having lot of branches and chains)\n4. Dealing with Isomers and Stereoisomers \n\nCredits :\nWikipedia : https://en.wikipedia.org/wiki/International_Chemical_Identifier\nYoutube Video : https://www.youtube.com/watch?v=V9HHnRAS5BA\n\nBest of Luck 😄 !",
      "votes": null
    },
    {
      "id": "1226579",
      "postDate": "03/04/2021 17:00:40",
      "content": "<p>Great compilation, thanks!    </p>\n<p>One question: How are numerical indexes assigned to atoms for a specific element? e.g. is there any reason why a specific carbon atom in a molecule is labeled as '1' and another is labeled as '2', instead of vice-versa?   Let's use the example you cited: </p>\n<blockquote>\n  <p>Main Layer Sublayer 2 : Here we index (starting with 1 ) all atoms other than Hydrogen and represent with '-' with atoms are connected , Note that prefix 'c' implies it is connection layer and not carbon layer(just to avoid confusion for some folks) , <strong>Hence we have output as \"c1-2-3\" (As at index 1 we have Carbon atom connected to Carbon Atom at index 2 and which in turn is connected to oxygen atom at index 3)</strong></p>\n</blockquote>\n<p>In the example, there are 2 carbon atoms, and the connectivity is c1-2-3.   But what decides <em>which</em> carbon atom gets the index '1' vs '2'?   If the carbon labels were reversed then wouldn't the equivalent connectivity in the InChI be  c2-1-3? </p>\n<p>Generally, is there a convention for assigning indexes to multiple atoms of a given element? </p>\n<p>I thought the InChI is unique, so the assignment can't be arbitrary.  However, after briefly looking for an answer to this question, I haven't found one yet… plus I'm not a chemist. </p>\n<p>Any thoughts or resources, anyone? Thanks!</p>",
      "rawMarkdown": "Great compilation, thanks!    \n\nOne question: How are numerical indexes assigned to atoms for a specific element? e.g. is there any reason why a specific carbon atom in a molecule is labeled as '1' and another is labeled as '2', instead of vice-versa?   Let's use the example you cited: \n\n>Main Layer Sublayer 2 : Here we index (starting with 1 ) all atoms other than Hydrogen and represent with '-' with atoms are connected , Note that prefix 'c' implies it is connection layer and not carbon layer(just to avoid confusion for some folks) , **Hence we have output as \"c1-2-3\" (As at index 1 we have Carbon atom connected to Carbon Atom at index 2 and which in turn is connected to oxygen atom at index 3)**\n\nIn the example, there are 2 carbon atoms, and the connectivity is c1-2-3.   But what decides *which* carbon atom gets the index '1' vs '2'?   If the carbon labels were reversed then wouldn't the equivalent connectivity in the InChI be  c2-1-3? \n\nGenerally, is there a convention for assigning indexes to multiple atoms of a given element? \n\nI thought the InChI is unique, so the assignment can't be arbitrary.  However, after briefly looking for an answer to this question, I haven't found one yet... plus I'm not a chemist. \n\nAny thoughts or resources, anyone? Thanks!",
      "votes": null
    },
    {
      "id": "1226612",
      "postDate": "03/04/2021 17:24:14",
      "content": "<p>This set of Khan Academy videos gives a start for how to name molecules, which involves numbering the atoms. It don't think it gives the full story, but it's a start. </p>\n<p><a href=\"https://www.khanacademy.org/science/organic-chemistry/bond-line-structures-alkanes-cycloalkanes/naming-alkanes/v/organic-chemistry-naming-examples-3\" target=\"_blank\">https://www.khanacademy.org/science/organic-chemistry/bond-line-structures-alkanes-cycloalkanes/naming-alkanes/v/organic-chemistry-naming-examples-3</a></p>",
      "rawMarkdown": "This set of Khan Academy videos gives a start for how to name molecules, which involves numbering the atoms. It don't think it gives the full story, but it's a start. \n\nhttps://www.khanacademy.org/science/organic-chemistry/bond-line-structures-alkanes-cycloalkanes/naming-alkanes/v/organic-chemistry-naming-examples-3",
      "votes": null
    },
    {
      "id": "1226616",
      "postDate": "03/04/2021 17:30:38",
      "content": "<p>Based on the examples I have seen I feel that indexing is done usual left to right way . If you have taken any organic chemistry course you would be familiar that this is what we follow in IUPAC Nomenclature also .</p>",
      "rawMarkdown": "Based on the examples I have seen I feel that indexing is done usual left to right way . If you have taken any organic chemistry course you would be familiar that this is what we follow in IUPAC Nomenclature also .",
      "votes": null
    },
    {
      "id": "1226658",
      "postDate": "03/04/2021 18:05:14",
      "content": "<p>Thanks, I've forgotten all my chemistry, so I'll have to dig into those Khan Academy videos to learn more. </p>\n<p>Update: The video says to start with the largest structure (ring, chain) and also that the IUPAC convention is to number a ring such that the substituents have the lowest numbers possible. Now it makes more sense. </p>",
      "rawMarkdown": "Thanks, I've forgotten all my chemistry, so I'll have to dig into those Khan Academy videos to learn more. \n\nUpdate: The video says to start with the largest structure (ring, chain) and also that the IUPAC convention is to number a ring such that the substituents have the lowest numbers possible. Now it makes more sense.",
      "votes": null
    },
    {
      "id": "1226682",
      "postDate": "03/04/2021 18:31:23",
      "content": "<p>Yes that was exactly the rule I remember 😃</p>",
      "rawMarkdown": "Yes that was exactly the rule I remember 😃",
      "votes": null
    },
    {
      "id": "1233840",
      "postDate": "03/10/2021 18:02:32",
      "content": "<p>What is missing in this competition is a proper and clear explanation of how the atoms are ordered/numbered to come up with a unique chemical id from the molecular graph. </p>",
      "rawMarkdown": "What is missing in this competition is a proper and clear explanation of how the atoms are ordered/numbered to come up with a unique chemical id from the molecular graph.",
      "votes": null
    },
    {
      "id": "1233862",
      "postDate": "03/10/2021 18:25:02",
      "content": "<p>Perhaps <a href=\"https://www.kaggle.com/c/bms-molecular-translation/discussion/224375\" target=\"_blank\">this </a>is what you are looking for (\"…how the atoms are ordered/numbered\")</p>",
      "rawMarkdown": "Perhaps [this ](https://www.kaggle.com/c/bms-molecular-translation/discussion/224375)is what you are looking for (\"...how the atoms are ordered/numbered\")",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1226579,
      "author_name": "chefele",
      "author_url": "",
      "post_date": "03/04/2021 17:00:40",
      "content": "<p>Great compilation, thanks!    </p>\n<p>One question: How are numerical indexes assigned to atoms for a specific element? e.g. is there any reason why a specific carbon atom in a molecule is labeled as '1' and another is labeled as '2', instead of vice-versa?   Let's use the example you cited: </p>\n<blockquote>\n  <p>Main Layer Sublayer 2 : Here we index (starting with 1 ) all atoms other than Hydrogen and represent with '-' with atoms are connected , Note that prefix 'c' implies it is connection layer and not carbon layer(just to avoid confusion for some folks) , <strong>Hence we have output as \"c1-2-3\" (As at index 1 we have Carbon atom connected to Carbon Atom at index 2 and which in turn is connected to oxygen atom at index 3)</strong></p>\n</blockquote>\n<p>In the example, there are 2 carbon atoms, and the connectivity is c1-2-3.   But what decides <em>which</em> carbon atom gets the index '1' vs '2'?   If the carbon labels were reversed then wouldn't the equivalent connectivity in the InChI be  c2-1-3? </p>\n<p>Generally, is there a convention for assigning indexes to multiple atoms of a given element? </p>\n<p>I thought the InChI is unique, so the assignment can't be arbitrary.  However, after briefly looking for an answer to this question, I haven't found one yet… plus I'm not a chemist. </p>\n<p>Any thoughts or resources, anyone? Thanks!</p>",
      "votes": null,
      "replies": [
        {
          "id": 1226612,
          "author_name": "setcha",
          "author_url": "",
          "post_date": "03/04/2021 17:24:14",
          "content": "<p>This set of Khan Academy videos gives a start for how to name molecules, which involves numbering the atoms. It don't think it gives the full story, but it's a start. </p>\n<p><a href=\"https://www.khanacademy.org/science/organic-chemistry/bond-line-structures-alkanes-cycloalkanes/naming-alkanes/v/organic-chemistry-naming-examples-3\" target=\"_blank\">https://www.khanacademy.org/science/organic-chemistry/bond-line-structures-alkanes-cycloalkanes/naming-alkanes/v/organic-chemistry-naming-examples-3</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1226616,
          "author_name": "sayedathar11",
          "author_url": "",
          "post_date": "03/04/2021 17:30:38",
          "content": "<p>Based on the examples I have seen I feel that indexing is done usual left to right way . If you have taken any organic chemistry course you would be familiar that this is what we follow in IUPAC Nomenclature also .</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1226658,
          "author_name": "chefele",
          "author_url": "",
          "post_date": "03/04/2021 18:05:14",
          "content": "<p>Thanks, I've forgotten all my chemistry, so I'll have to dig into those Khan Academy videos to learn more. </p>\n<p>Update: The video says to start with the largest structure (ring, chain) and also that the IUPAC convention is to number a ring such that the substituents have the lowest numbers possible. Now it makes more sense. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1226682,
          "author_name": "sayedathar11",
          "author_url": "",
          "post_date": "03/04/2021 18:31:23",
          "content": "<p>Yes that was exactly the rule I remember 😃</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1233840,
          "author_name": "datanewb",
          "author_url": "",
          "post_date": "03/10/2021 18:02:32",
          "content": "<p>What is missing in this competition is a proper and clear explanation of how the atoms are ordered/numbered to come up with a unique chemical id from the molecular graph. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1233862,
          "author_name": "sapr3s",
          "author_url": "",
          "post_date": "03/10/2021 18:25:02",
          "content": "<p>Perhaps <a href=\"https://www.kaggle.com/c/bms-molecular-translation/discussion/224375\" target=\"_blank\">this </a>is what you are looking for (\"…how the atoms are ordered/numbered\")</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1225974": "This seems to be a very interesting and challenging competition in which we have to predict the InChI notation for various chemical molecules , Chemistry being my favourite subject I decided to read up some resources on InChI Notation briefly and also make a note of Potential challenges with the task at hand ! Doing so will help us come up with better modelling strategies rather than coming up with black box models , This is to help someone who hasn't studied chemistry or would like to understand task better!\n\n**InChI Purpose:** InChI is a way to textually represent Formula of Organic Compounds (Those having Carbon and Hydrogen Bonds) , This is done as Organic Chemists represent compounds using  a 3D representation of  compounds  , Refer [this ](https://www.google.com/search?q=benzene&sxsrf=ALeKk01Cz9Ds7BpKQnPqqKnAJVExHyIIiA:1614836146006&tbm=isch&source=iu&ictx=1&fir=zEik1pkP6BYYhM%252CrMH63lxC9_L8rM%252C_&vet=1&usg=AI4_-kQeVoXu5gT3-8jH8p-m6YnasjS1-A&sa=X&ved=2ahUKEwiInOm29ZXvAhVCWX0KHeg4DwYQ_h16BAgVEAE#imgrc=zEik1pkP6BYYhM)image to understand how benzene (a popular compound in organic chemistry is represented) ,  However in Research Papers and across Databases Text search is used rather than image search so InChI representation is used to effectively represent Molecular compounds with text representation , than image representations.\n\n\n** Some of the Advantages of InChI Structures : **\n1. Stereo Centers can be represented effectively using InChI structures  ( For the unaware stereo chemistry refers to how atoms are arranged in 3 D space , this can impact chemical reactions and how they occur )\n\n2. Isomers can be represented effectively using this notation (Isomers are the compounds having identical molecular formula but differ in arrangements of atoms in space they do not share identical physical or chemical properties)\n\n\n**Some Disadvantages of InChI Structures :**\n1. They are required to be generated manually or using some algorithm , which is quite error prone.\n\n2. It becomes difficult for Humans to comprehend the structure , **Understanding structure in InChI notation is difficult even for experienced people infact he would rather prefer the 3D representation** .\n\n3. It becomes difficult to search for appropriate substructure as we have multiple layers for representing (we will get there in a while just  bear with me)\n\n**InChI Explained with some  examples:**\n\n**Example 1:**\nLet us now see some examples , let us start with a simple example of ethanol(C2H5OH) , for someone familiar with organic chemistry this is quite common compound which is derivative of alcohol that occurs most frequently and is used in perfumes , varnishes , preservatives and drugs , the molecular  3 D represenation of ethanol can be found [here](https://www.google.com/search?q=ethanol&sxsrf=ALeKk03pGojU_uIi1uw6_fWC2yzsWR7T8w:1614837497678&source=lnms&tbm=isch&sa=X&ved=2ahUKEwiw1Ky7-pXvAhUMT30KHeiOCgsQ_AUoAnoECBMQBA&biw=1536&bih=698#imgrc=4DRm6Efr_V49aM) .\n\nIn InChI we have multiple layers which are further having sublayers\n\n1. Main Layer\nConsists of following sublayers\n        a. Chemical formula (no prefix) : Occurs in almost every InChI representation , it describes the main formula\n        b.Atom connections (prefix: \"c\"). The atoms in the chemical formula (except for hydrogens) are numbered in sequence; this sublayer \n                                                                describes which atoms are connected by bonds to which other ones.\n        c. Hydrogen atoms (prefix: \"h\"). Describes how many hydrogen atoms are connected to each of the other atoms.\n\n2. Charge Layer \n\nConsists of following sublayers.\n        a. charge sublayer (prefix: \"q\")\n        b. proton sublayer (prefix: \"p\" for \"protons\")\n\n\n3. Stereochemical layer (Important for understanding 3D arrangement of atoms)\n        a. double bonds and cumulenes (prefix: \"b\")\n        b. tetrahedral stereochemistry of atoms and allenes (prefixes: \"t\", \"m\")\n        c. type of stereochemistry information (prefix: \"s\")\n\n4. Isotopic layer (prefixes: \"i\", \"h\", as well as \"b\", \"t\", \"m\", \"s\" for isotopic stereochemistry)\n\n5. Fixed-H layer (prefix: \"f\"); contains some or all of the above types of layers except atom connections; may end with \"o\" sublayer; never included in standard InChI\n\n6. Reconnected layer (prefix: \"r\"); contains the whole InChI of a structure with reconnected metal atoms; never included in standard InChI\n\nAs you can see by doing this kind of structuring of compounds it becomes easy to apply pattern search and it becomes easier for databases to store and retrieve this information.\n\nLet us get back to the Example 1 , I will be discussing only Main Layer as discussing other layers are out of my understanding and they require quite detail understanding of chemistry , hence let us focus on Main Layer only . (**Please Keep Image of Ethanol Formula open besides you while reading this explanation**)\n\n1. First we start with InChI = 1S , here 1 is version number and S is standard , next we go to main layer but before that we have to separate it with '/' and also there are multiple sublayers in main layer\n\n2.  Main Layer Sublayer 1: Here we just represent the formula which is used in usual chemistry notation it is simple C2H6O (2 Atoms of C , 6 Atoms of H , and 1 of O)\n\n3. Main Layer Sublayer 2 : Here we index (starting with 1 ) all atoms other than Hydrogen and represent with '-' with atoms are connected , Note that prefix 'c' implies it is connection layer and not carbon layer(just to avoid confusion for some folks) , Hence we have output as \"c1-2-3\"  (As at index 1 we have Carbon atom connected to Carbon Atom at index 2 and which in turn is connected to oxygen atom at index 3)\n\n4. Main Sublayer 3 : This is related to 'H' atoms (Hydrogen) hence they start with prefix 'h' and it indicates how many hydrogen atoms are connected to each other hydrogen atoms . We have output as \"h3H,2H2,1H3\" . This simply means (Reading backwards) atom at index 1 (carbon) is connected to 3 H atoms , atom at index 2(Again carbon) is connected to 2 H atoms , finally 3H means  atom at 3rd location (Oxygen atom ) is connected to 1 H atom . \n\n**Example 2 :**\nAnother simple and bit tricky example  involving Acetic Acid can be found in the video [here](https://www.youtube.com/watch?v=V9HHnRAS5BA) ,\nIf you just want to get to the main stuff skip to 13:47 :)\n\n**Example 3 :**\nInChI notations aren't easy to come up with for example for Ascorbic Acid (Vitamin C) , whose 3 D representation can be found [here ](https://www.google.com/search?q=ascorbic+acid&tbm=isch&sxsrf=ALeKk02d7LMr6TpujswSvyxl1SfDWyUL7w:1614839158204&source=lnms&sa=X&ved=0ahUKEwisjZPTgJbvAhVXb30KHVFPB4kQ_AUIlgMoAQ&biw=1536&bih=698#imgrc=X1L166vQskyyJM) , its InChI notation is \"InChI=1S/C6H8O6/c7-1-2(8)5-3(9)4(10)6(11)12-5/h2,5,7-8,10-11H,1H2/t2-,5+/m0/s1\" , as we can see its not quite easy to come up with \n\n\n**My Understanding of Problem :**\n1. As per my understanding this problem can be broken down into Image to Text subproblem.\n2. Here Text can be of variable lengths \n3. Notice that here we have different text representation for each layer based on Image Input\n\n**Challenges one might face :**\nFollowing are key challenges one might face\n1. Coming up with a good validation strategy\n2. Handling different layers output (i.e. different InChI layers ouput)\n3. Dealing with difficult images (i.e. those having lot of branches and chains)\n4. Dealing with Isomers and Stereoisomers \n\nCredits :\nWikipedia : https://en.wikipedia.org/wiki/International_Chemical_Identifier\nYoutube Video : https://www.youtube.com/watch?v=V9HHnRAS5BA\n\nBest of Luck 😄 !",
    "1226579": "Great compilation, thanks!    \n\nOne question: How are numerical indexes assigned to atoms for a specific element? e.g. is there any reason why a specific carbon atom in a molecule is labeled as '1' and another is labeled as '2', instead of vice-versa?   Let's use the example you cited: \n\n>Main Layer Sublayer 2 : Here we index (starting with 1 ) all atoms other than Hydrogen and represent with '-' with atoms are connected , Note that prefix 'c' implies it is connection layer and not carbon layer(just to avoid confusion for some folks) , **Hence we have output as \"c1-2-3\" (As at index 1 we have Carbon atom connected to Carbon Atom at index 2 and which in turn is connected to oxygen atom at index 3)**\n\nIn the example, there are 2 carbon atoms, and the connectivity is c1-2-3.   But what decides *which* carbon atom gets the index '1' vs '2'?   If the carbon labels were reversed then wouldn't the equivalent connectivity in the InChI be  c2-1-3? \n\nGenerally, is there a convention for assigning indexes to multiple atoms of a given element? \n\nI thought the InChI is unique, so the assignment can't be arbitrary.  However, after briefly looking for an answer to this question, I haven't found one yet... plus I'm not a chemist. \n\nAny thoughts or resources, anyone? Thanks!",
    "1226612": "This set of Khan Academy videos gives a start for how to name molecules, which involves numbering the atoms. It don't think it gives the full story, but it's a start. \n\nhttps://www.khanacademy.org/science/organic-chemistry/bond-line-structures-alkanes-cycloalkanes/naming-alkanes/v/organic-chemistry-naming-examples-3",
    "1226616": "Based on the examples I have seen I feel that indexing is done usual left to right way . If you have taken any organic chemistry course you would be familiar that this is what we follow in IUPAC Nomenclature also .",
    "1226658": "Thanks, I've forgotten all my chemistry, so I'll have to dig into those Khan Academy videos to learn more. \n\nUpdate: The video says to start with the largest structure (ring, chain) and also that the IUPAC convention is to number a ring such that the substituents have the lowest numbers possible. Now it makes more sense.",
    "1226682": "Yes that was exactly the rule I remember 😃",
    "1233840": "What is missing in this competition is a proper and clear explanation of how the atoms are ordered/numbered to come up with a unique chemical id from the molecular graph.",
    "1233862": "Perhaps [this ](https://www.kaggle.com/c/bms-molecular-translation/discussion/224375)is what you are looking for (\"...how the atoms are ordered/numbered\")"
  },
  "source": "meta"
}