{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exploring Chemical Identity" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "J. Cuadros\n", "August 5th, 2019" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Objectives" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Understand the problem of chemical identity.\n", "- Explore some chemical substances identifiers.\n", "- Understand the layered model of the InChI as a model to chemical identity." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. The Problem of Chemical Identity" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since the XVIII century, when chemists started to understand chemical substances have a fixed composition, we have faced the need to identify and discriminate them.\n", "In the analogic word, we use names (both traditional and systematic) and formulas to fullfill this role. In the digital world, registry numbers and line notations are commonly \n", "used for substance identification" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Chemistry information and documentation recurrently face the problem of having to classify substance records (data pieces) in a systematic way.\n", "But as we will explore in this activity, this is trickier than it seems." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let’s start facing the problem. You are given 18 substance records (that’s not much, PubChem holds more than 200 milions of these,\n", "https://pubchemdocs.ncbi.nlm.nih.gov/statistics) and you are asked to decide which correspond to the same substance (and why)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here are the records:\n", "\n", "https://pubchem.ncbi.nlm.nih.gov/substance/227885365,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/242744695,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/329830556,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/341141642,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/341193751,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/342898240,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/355138175,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/355178551,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/369730804,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/376125581,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/376145687,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/376602811,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/383210891,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/383219135,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/383428756,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/384452886,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/384647147,\n", "https://pubchem.ncbi.nlm.nih.gov/substance/385112115" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 1a:** Browse these records and make a table that includes, for each record, the given name, its molecular formula and its structural formula (smiles?)." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "'# Number of SIDs: 18'" ], "text/latex": [ "'\\# Number of SIDs: 18'" ], "text/markdown": [ "'# Number of SIDs: 18'" ], "text/plain": [ "[1] \"# Number of SIDs: 18\"" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "'# Number of CIDs: 6'" ], "text/latex": [ "'\\# Number of CIDs: 6'" ], "text/markdown": [ "'# Number of CIDs: 6'" ], "text/plain": [ "[1] \"# Number of CIDs: 6\"" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " CID IUPACName MolecularFormula\n", "1 13828518 2-hydroxy-2-(hydroxymethyl)propanedioic acid C4H6O6\n", "2 90696293 2-deuteriooxy-3-hydroxybutanedioic acid C4H6O6\n", "3 439655 (2S,3S)-2,3-dihydroxybutanedioic acid C4H6O6\n", "4 163030 2,2-dihydroxybutanedioic acid C4H6O6\n", "5 447315 (2R,3S)-2,3-dihydroxybutanedioic acid C4H6O6\n", "6 875 2,3-dihydroxybutanedioic acid C4H6O6\n", " IsomericSMILES\n", "1 C(C(C(=O)O)(C(=O)O)O)O\n", "2 [2H]OC(C(C(=O)O)O)C(=O)O\n", "3 [C@H]([C@@H](C(=O)O)O)(C(=O)O)O\n", "4 C(C(=O)O)C(C(=O)O)(O)O\n", "5 [C@@H]([C@@H](C(=O)O)O)(C(=O)O)O\n", "6 C(C(C(=O)O)O)(C(=O)O)O\n" ] } ], "source": [ "sids <- c(227885365, 242744695, 329830556, 341141642, 341193751, 342898240, 355138175, 355178551, 369730804, 376125581, 376145687,\n", " 376602811, 383210891, 383219135, 383428756, 384452886, 384647147, 385112115)\n", "\n", "paste(\"# Number of SIDs:\", length(sids) )\n", "\n", "pugrest <- \"https://pubchem.ncbi.nlm.nih.gov/rest/pug\"\n", "pugoper <- \"cids\"\n", "pugout <- \"txt\"\n", "\n", "pugin <- paste(\"substance/sid/\", paste(sids[1:length(sids)],collapse=\",\"),sep=\"\")\n", "url <- paste(pugrest,pugin,pugoper,pugout,sep=\"/\")\n", "cids <- readLines(url)\n", "\n", "cids <- (unique(cids))\n", "paste(\"# Number of CIDs:\", length(cids) )\n", "\n", "pugin <- paste(\"compound/cid/\", paste(cids[1:length(cids)],collapse=\",\"),sep=\"\")\n", "pugoper <- \"property/IUPACName,MolecularFormula,IsomericSMILES\"\n", "pugout <- \"csv\"\n", "url <- paste(pugrest,pugin,pugoper,pugout,sep=\"/\")\n", "\n", "df <- read.table(url,sep=\",\",header=TRUE)\n", "print(df)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 1b:** How many different substances do you think there are in this set? How would you classify them?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Digital Identifiers" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the digital world, identity is usually associated with the use of an identifier; when two identifiers coincide when we can say that both data pieces belong to the same entity.\n", "\n", "For substance, and besides registry numbers, two common identifiers are SMILES and InChI." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 2a:** For each record, check if the data providers included any SMILES or InChI information. Collect this information when available." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 2b:** For each record, use a molecular drawing program to compute the SMILES, the standard InChI and the InChIKey. \n", "Make a table with them. If you don’t have a molecular drawing program at hand, you may consider using MolView (http://molview.org/)\n", "or the drawing tool included in the Chemical Identifier Resolver (https://cactus.nci.nih.gov/chemical/structure)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 2c:** Compare the provider identifiers with the computed ones. Do you see any differences?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 2d:** Would you reconsider the classification you decided in exercise 1b?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. The InChI Layered Notation and Identity Matching" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you look carefully at the InChI for the different records, you will notice that some of the identifiers are more similar then others.\n", "\n", "Some match completely, while some others may match only for some of the layers, especially for the main layer. Sometimes, we consider to \n", "be the same substance, any substance where the InChI main layer is coincident. For other applications, some other layers need to be taken \n", " into account; for instance, stereochemical information is critical in health-related uses." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 3a:** Classify the records according to the main layer of the InChI." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 3b:** Classify the records again according to the full InChI." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Substance records in PubChem are grouped into compound records. This information appears in each one of the elements of the set." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 3c:** Compare the classification used in PubChem with the InChI-based classifications done in 3a and 3b." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "R", "language": "R", "name": "ir" }, "language_info": { "codemirror_mode": "r", "file_extension": ".r", "mimetype": "text/x-r-source", "name": "R", "pygments_lexer": "r", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 4 }