{ "cells": [ { "cell_type": "markdown", "id": "834aeced-c3c5-42a0-bad1-41e009dd86ee", "metadata": {}, "source": [ "### Preprocessing" ] }, { "cell_type": "code", "execution_count": 3, "id": "86476f6e-802a-463b-a1b0-2ae228bb92af", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 5, "id": "9b2be11c-f4bb-4107-af49-abd78052afcf", "metadata": {}, "outputs": [], "source": [ "df = pd.read_table('../binding_datasets/pdbbind/data/plain-text-index/index/INDEX_general_PL_data.2019',skiprows=4,sep=r'\\s+',usecols=[0,4]).drop(0)\n", "df = df.rename(columns={'#': 'name','release': 'affinity'})" ] }, { "cell_type": "code", "execution_count": 6, "id": "16e0fe44-96aa-4d3a-ae42-3609e895418b", "metadata": {}, "outputs": [], "source": [ "from numericalunits import mL, nm" ] }, { "cell_type": "code", "execution_count": 13, "id": "68983ab8-bf11-4ed6-ba06-f962dbdc077e", "metadata": {}, "outputs": [], "source": [ "quantities = ['ki','kd','ka','k1/2','kb']" ] }, { "cell_type": "code", "execution_count": 14, "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": 15, "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": 12, "id": "d92f0004-68c1-4487-94b9-56b4fd598de4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result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BL894FHgB8F/nmSc8AHwE9X1bda14eA/cB6Ft/A9U1cjWRIdj3C4tLhI8CvrcYY/gyDJHXkqlvekSRdnKEvSR0x9CWpI4a+JHXE0Jekjhj6ktQRQ1+SOvL/AHBjFAv0jqiXAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "df['affinity_quantity'].hist()" ] }, { "cell_type": "code", "execution_count": 24, "id": "aa358835-55f3-4551-9217-e76a15de4fe8", "metadata": {}, "outputs": [], "source": [ "df_filter = df[df['affinity_quantity'].str.lower().isin(quantities)]" ] }, { "cell_type": "code", "execution_count": 25, "id": "d6dda488-f709-4fe7-b372-080042cf7c66", "metadata": {}, "outputs": [], "source": [ "df_complex = pd.read_parquet('../binding_datasets/data/pdbbind_complex.parquet')" ] }, { "cell_type": "code", "execution_count": 26, "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": 27, "id": "4d105c42-0d11-49db-9012-52fafc9cd299", "metadata": {}, "outputs": [], "source": [ "df_all.to_parquet('data/pdbbind.parquet')" ] }, { "cell_type": "code", "execution_count": 28, "id": "2955b056-26dd-45fa-8d74-f17661253a9a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "11099" ] }, "execution_count": 28, "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 }