{"id":897,"date":"2023-02-18T00:00:00","date_gmt":"2023-02-18T05:00:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=897"},"modified":"2023-02-18T04:06:22","modified_gmt":"2023-02-18T09:06:22","slug":"how-to-convert-between-smiles-and-inchl-formats","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/how-to-convert-between-smiles-and-inchl-formats\/","title":{"rendered":"How to convert between SMILES and InChl formats"},"content":{"rendered":"\n<p>SMILES (Simplified Molecular Input Line Entry System) and InChI (International Chemical Identifier) are both methods of representing chemical structures in a machine-readable form.<\/p>\n\n\n\n<p>SMILES is a string-based representation of a molecule, where each element and bond is represented by a set of symbols. SMILES strings are concise and can be easily read by humans, making them a useful format for exchanging chemical information.<\/p>\n\n\n\n<p>InChI is a more standardized representation of a chemical structure, designed to be machine-readable and unambiguous. InChI strings provide a unique identifier for a chemical substance, and they can be used to encode molecular structure information, including the arrangement of atoms, the bond order, and the stereochemistry of the molecule.<\/p>\n\n\n\n<p>Here is an example of a Python code to convert between SMILES and InChI using the RDKit library:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>from rdkit import Chem\n\ndef smiles_to_inchi(smiles):\n    mol = Chem.MolFromSmiles(smiles)\n    inchi = Chem.MolToInchi(mol)\n    return inchi\n\ndef inchi_to_smiles(inchi):\n    mol = Chem.MolFromInchi(inchi)\n    smiles = Chem.MolToSmiles(mol)\n    return smiles<\/code><\/code><\/pre>\n\n\n\n<p>In this example, the <code>Chem.MolFromSmiles<\/code> function is used to create a molecular object from a SMILES string, and the <code>Chem.MolToInchi<\/code> function is used to convert the molecular object to an InChI string. Similarly, the <code>Chem.MolFromInchi<\/code> function is used to create a molecular object from an InChI string, and the <code>Chem.MolToSmiles<\/code> function is used to convert the molecular object to a SMILES string.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SMILES (Simplified Molecular Input Line Entry System) and InChI (International Chemical Identifier) are both methods of representing chemical structures in a machine-readable form. SMILES is a string-based representation of a molecule, where each element and bond is represented by a set of symbols. SMILES strings are concise and can be easily read by humans, making [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":923,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[203,299],"tags":[312,137,311],"class_list":["post-897","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-science","tag-inchl","tag-python","tag-smiles"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=897"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/897\/revisions"}],"predecessor-version":[{"id":898,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/897\/revisions\/898"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media\/923"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}