{ "cells": [ { "cell_type": "markdown", "id": "834aeced-c3c5-42a0-bad1-41e009dd86ee", "metadata": {}, "source": [ "### Preprocessing" ] }, { "cell_type": "code", "execution_count": 27, "id": "86476f6e-802a-463b-a1b0-2ae228bb92af", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 45, "id": "9b2be11c-f4bb-4107-af49-abd78052afcf", "metadata": {}, "outputs": [], "source": [ "df = pd.read_table('pdbbind/data/index/INDEX_general_PL_data.2020',skiprows=4,sep=r'\\s+',usecols=[0,4]).drop(0)\n", "df = df.rename(columns={'#': 'name','release': 'affinity'})\n", "df_refined = pd.read_table('pdbbind/data/index/INDEX_refined_data.2020',skiprows=4,sep=r'\\s+',usecols=[0,4]).drop(0)\n", "df_refined = df_refined.rename(columns={'#': 'name','release': 'affinity'})\n", "df = pd.concat([df,df_refined])" ] }, { "cell_type": "code", "execution_count": 46, "id": "68983ab8-bf11-4ed6-ba06-f962dbdc077e", "metadata": {}, "outputs": [], "source": [ "quantities = ['ki','kd','ka','k1/2','kb','ic50','ec50']" ] }, { "cell_type": "code", "execution_count": 47, "id": "3acbca3c-9c0b-43a1-a45e-331bf153bcfa", "metadata": {}, "outputs": [], "source": [ "from pint import UnitRegistry\n", "ureg = UnitRegistry()\n", "\n", "def to_uM(affinity):\n", " val = ureg(affinity)\n", " try:\n", " return val.m_as(ureg.uM)\n", " except Exception:\n", " pass\n", " \n", " try:\n", " return 1/val.m_as(1/ureg.uM)\n", " except Exception:\n", " pass" ] }, { "cell_type": "code", "execution_count": 48, "id": "58e5748b-2cea-43ff-ab51-85a5021bd50b", "metadata": {}, "outputs": [], "source": [ "df['affinity_uM'] = df['affinity'].str.split('[=\\~><]').str[1].apply(to_uM)\n", "df['affinity_quantity'] = df['affinity'].str.split('[=\\~><]').str[0]" ] }, { "cell_type": "code", "execution_count": 49, "id": "d92f0004-68c1-4487-94b9-56b4fd598de4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 49, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD4CAYAAADsKpHdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAQdUlEQVR4nO3df6zdd13H8efLVkYpFjfHbpp22BKL2m1B3GVWiOSSGncFYveHM8XhOrOkYZk4ZYnp+Adj0mQkoLDFjVTBdjiYdZC0OoYuhStR98MWiKUrywqb22WXlR8ydxHHOt/+cT7Vw+3p7XrOvfe03ucjOTnf8/5+Pt/v5+Z+e173+/l+z2mqCkmSfmTYA5AknRkMBEkSYCBIkhoDQZIEGAiSpGbpsAfQr/PPP7/WrFnTV9/vfe97LF++fG4HJDUeX5pvgxxjBw4c+FZVvbLXurM2ENasWcP+/fv76jsxMcHY2NjcDkhqPL403wY5xpL828nWOWUkSQIMBElSYyBIkgADQZLUGAiSJMBAkCQ1pwyEJB9NcjTJl7tq5yW5L8mj7fncrnU3JTmS5JEkl3fVL01ysK27JUla/Zwkf9XqDyZZM8c/oyTpRXgxZwg7gfEZtW3AvqpaB+xrr0myHtgMXNT63JZkSetzO7AVWNcex7d5LfDvVfVTwJ8A7+v3h5Ek9e+UgVBVnwe+M6O8CdjVlncBV3TV76qq56rqMeAIcFmSlcCKqrq/Ov8Bwx0z+hzf1t3AxuNnD5KkhdPvJ5VHqmoKoKqmklzQ6quAB7raTbba8215Zv14nyfbto4leQb4CeBbM3eaZCudswxGRkaYmJjoa/DT09N995VOxeNrcTj49WeGtu+1r1gyL8fYXH91Ra+/7GuW+mx9TixW7QB2AIyOjla/H932qwU0nzy+Fodrtt0ztH3vHF8+L8dYv3cZPd2mgWjPR1t9Eriwq91q4KlWX92j/kN9kiwFXsGJU1SSpHnWbyDsBba05S3Anq765nbn0Fo6F48fatNLzybZ0K4PXD2jz/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fmal+LZsoIOAfYA1xRVV8Z9mB0VrsYODDL+rVJvpjkH9o/Zuh8PctkV5vJVpNmc7L3rQ8Bt1fV64FvzNXOFlMgPA/8M3DtsAei/9emgFdV1euAdwMfT7KCF/n1LNIMJ3vfeiPwibb8sbna2WIKhP8GfgN4fZL3DHswOqsdAi7ttaKqnquqb7flA8BXgdfQOSNY3dXUr2fRizHb+9ac/0GxmAKBqvpP4G3AVUk8U1C/Pg68Iclbjxfaf/B0SZJXtv/fgySvBtYBX6uqKeDZJBva3UVX05kKkGZ1kvetf6LzFT8AV83VvhbVRWWAqvpOknHg80mG8hXFOrtV1feTvA34YJIP0jmt/1fgBuBNwB8lOQa8ALyzqr7Tul4H7ASW0bmY7AVlvSg93rduoDMdeQPwybnaj19dIUkCFtmUkSTp5AwESRJgIEiSGgNBkgQYCJKkxkCQJAEGgiSp+R+8kn6fv7jc8QAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "df['affinity_quantity'].hist()" ] }, { "cell_type": "code", "execution_count": 50, "id": "aa358835-55f3-4551-9217-e76a15de4fe8", "metadata": {}, "outputs": [], "source": [ "df_filter = df[df['affinity_quantity'].str.lower().isin(quantities)]" ] }, { "cell_type": "code", "execution_count": 51, "id": "d6dda488-f709-4fe7-b372-080042cf7c66", "metadata": {}, "outputs": [], "source": [ "df_complex = pd.read_parquet('data/pdbbind_complex.parquet')" ] }, { "cell_type": "code", "execution_count": 52, "id": "df7929e3-c7fd-4e1b-a165-92f8d53b9011", "metadata": {}, "outputs": [], "source": [ "df_all = df_complex.merge(df_filter,on='name').drop('affinity',axis=1)" ] }, { "cell_type": "code", "execution_count": 53, "id": "4d105c42-0d11-49db-9012-52fafc9cd299", "metadata": {}, "outputs": [], "source": [ "df_all.to_parquet('data/pdbbind.parquet')" ] }, { "cell_type": "code", "execution_count": 54, "id": "2955b056-26dd-45fa-8d74-f17661253a9a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "24759" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_all)" ] }, { "cell_type": "code", "execution_count": null, "id": "ed3fe035-6035-4d39-b072-d12dc0a95857", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.9.4" } }, "nbformat": 4, "nbformat_minor": 5 }