{ "cells": [ { "cell_type": "markdown", "id": "834aeced-c3c5-42a0-bad1-41e009dd86ee", "metadata": {}, "source": [ "### Preprocessing" ] }, { "cell_type": "code", "execution_count": 16, "id": "86476f6e-802a-463b-a1b0-2ae228bb92af", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": null, "id": "0cde27df-2f77-4e62-8c65-7b7a4e76b404", "metadata": {}, "outputs": [], "source": [ "complex = pd.read_parquet('')" ] }, { "cell_type": "code", "execution_count": 49, "id": "9b2be11c-f4bb-4107-af49-abd78052afcf", "metadata": {}, "outputs": [], "source": [ "df = pd.read_table('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": 50, "id": "16e0fe44-96aa-4d3a-ae42-3609e895418b", "metadata": {}, "outputs": [], "source": [ "from numericalunits import mL, nm" ] }, { "cell_type": "code", "execution_count": 136, "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": 137, "id": "58e5748b-2cea-43ff-ab51-85a5021bd50b", "metadata": {}, "outputs": [], "source": [ "df['affinity_uM'] = df['affinity'].str.split('[=\\~><]').str[1].apply(to_uM)" ] }, { "cell_type": "code", "execution_count": 138, "id": "d92f0004-68c1-4487-94b9-56b4fd598de4", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
nameaffinityaffinity_uM
13zzfKi=400mM4.000000e+05
23gwwIC50=355mM3.550000e+05
31w8lKi=320mM3.200000e+05
43fqaIC50=320mM3.200000e+05
51zsbKd=250mM2.500000e+05
............
176757cpaKi=11fM1.100000e-08
176762xufKd=4.1fM4.100000e-09
176771avdKd=1fM1.000000e-09
176782xuiKd=1.0fM1.000000e-09
176792aviKd=0.6fM6.000000e-10
\n", "

17679 rows × 3 columns

\n", "
" ], "text/plain": [ " name affinity affinity_uM\n", "1 3zzf Ki=400mM 4.000000e+05\n", "2 3gww IC50=355mM 3.550000e+05\n", "3 1w8l Ki=320mM 3.200000e+05\n", "4 3fqa IC50=320mM 3.200000e+05\n", "5 1zsb Kd=250mM 2.500000e+05\n", "... ... ... ...\n", "17675 7cpa Ki=11fM 1.100000e-08\n", "17676 2xuf Kd=4.1fM 4.100000e-09\n", "17677 1avd Kd=1fM 1.000000e-09\n", "17678 2xui Kd=1.0fM 1.000000e-09\n", "17679 2avi Kd=0.6fM 6.000000e-10\n", "\n", "[17679 rows x 3 columns]" ] }, "execution_count": 138, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 139, "id": "d6dda488-f709-4fe7-b372-080042cf7c66", "metadata": {}, "outputs": [], "source": [ "df_complex = pd.read_parquet('data/pdbbind_complex.parquet')" ] }, { "cell_type": "code", "execution_count": 140, "id": "df7929e3-c7fd-4e1b-a165-92f8d53b9011", "metadata": {}, "outputs": [], "source": [ "df_all = df_complex.merge(df,on='name').drop('affinity',axis=1)" ] }, { "cell_type": "code", "execution_count": 141, "id": "4d105c42-0d11-49db-9012-52fafc9cd299", "metadata": {}, "outputs": [], "source": [ "df_all.to_parquet('data/pdbbind.parquet')" ] }, { "cell_type": "code", "execution_count": 142, "id": "2955b056-26dd-45fa-8d74-f17661253a9a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "17652" ] }, "execution_count": 142, "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.8.10" } }, "nbformat": 4, "nbformat_minor": 5 }