{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "negative-sussex",
   "metadata": {},
   "outputs": [],
   "source": [
    "from rdkit import Chem\n",
    "from rdkit.Chem import PandasTools\n",
    "from rdkit import RDConfig\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "complete-conversation",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AMW</th>\n",
       "      <th>CLOGP</th>\n",
       "      <th>CP</th>\n",
       "      <th>CR</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>122.12344</td>\n",
       "      <td>0.79</td>\n",
       "      <td>0.727;-0P;4.71</td>\n",
       "      <td>2.963;-40R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>332.495</td>\n",
       "      <td>4.66</td>\n",
       "      <td>4.316;-0P;4.71</td>\n",
       "      <td>9.384;-0R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>218.553</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>2.239;-57P;4.71</td>\n",
       "      <td>4.556;-0R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>145.14184</td>\n",
       "      <td>-2.01</td>\n",
       "      <td>0.519;-59P;4.71</td>\n",
       "      <td>3.267;-42R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>223.231</td>\n",
       "      <td>2.43</td>\n",
       "      <td>1.869;-0P;4.71</td>\n",
       "      <td>6.390;-0R;4.71</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         AMW  CLOGP               CP               CR\n",
       "0  122.12344   0.79   0.727;-0P;4.71  2.963;-40R;4.71\n",
       "1    332.495   4.66   4.316;-0P;4.71   9.384;-0R;4.71\n",
       "2    218.553  -2.61  2.239;-57P;4.71   4.556;-0R;4.71\n",
       "3  145.14184  -2.01  0.519;-59P;4.71  3.267;-42R;4.71\n",
       "4    223.231   2.43   1.869;-0P;4.71   6.390;-0R;4.71"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = PandasTools.LoadSDF(os.path.join(RDConfig.RDDataDir,'NCI','first_200.props.sdf'))\n",
    "df[['AMW','CLOGP','CP','CR']].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "63de62cc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "permanent-liechtenstein",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['AMW',\n",
       " 'CLOGP',\n",
       " 'CP',\n",
       " 'CR',\n",
       " 'DAYLIGHT.FPG',\n",
       " 'DAYLIGHT_CLOGP',\n",
       " 'FP',\n",
       " 'ISM',\n",
       " 'LIPINSKI_VIOLATIONS',\n",
       " 'NUM_HACCEPTORS',\n",
       " 'NUM_HDONORS',\n",
       " 'NUM_HETEROATOMS',\n",
       " 'NUM_LIPINSKIHACCEPTORS',\n",
       " 'NUM_LIPINSKIHDONORS',\n",
       " 'NUM_RINGS',\n",
       " 'NUM_ROTATABLEBONDS',\n",
       " 'NUM_ROTATABLEBONDS_O',\n",
       " 'P1',\n",
       " 'SMILES',\n",
       " 'ID',\n",
       " 'ROMol']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(df.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "careful-netherlands",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<module 'rdkit.Chem.PandasTools' from '/localhome/glandrum/RDKit_git/rdkit/Chem/PandasTools.py'>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# NBVAL_IGNORE_OUTPUT\n",
    "import importlib\n",
    "importlib.reload(PandasTools)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "identical-finder",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AMW</th>\n",
       "      <th>CLOGP</th>\n",
       "      <th>CP</th>\n",
       "      <th>CR</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>122.12344</td>\n",
       "      <td>0.79</td>\n",
       "      <td>0.727;-0P;4.71</td>\n",
       "      <td>2.963;-40R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>332.495</td>\n",
       "      <td>4.66</td>\n",
       "      <td>4.316;-0P;4.71</td>\n",
       "      <td>9.384;-0R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>218.553</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>2.239;-57P;4.71</td>\n",
       "      <td>4.556;-0R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>145.14184</td>\n",
       "      <td>-2.01</td>\n",
       "      <td>0.519;-59P;4.71</td>\n",
       "      <td>3.267;-42R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>223.231</td>\n",
       "      <td>2.43</td>\n",
       "      <td>1.869;-0P;4.71</td>\n",
       "      <td>6.390;-0R;4.71</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         AMW  CLOGP               CP               CR\n",
       "0  122.12344   0.79   0.727;-0P;4.71  2.963;-40R;4.71\n",
       "1    332.495   4.66   4.316;-0P;4.71   9.384;-0R;4.71\n",
       "2    218.553  -2.61  2.239;-57P;4.71   4.556;-0R;4.71\n",
       "3  145.14184  -2.01  0.519;-59P;4.71  3.267;-42R;4.71\n",
       "4    223.231   2.43   1.869;-0P;4.71   6.390;-0R;4.71"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[['AMW','CLOGP','CP','CR']].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7cea7bba",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py312_build",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
