{ "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", " | name | \n", "affinity | \n", "affinity_uM | \n", "
---|---|---|---|
1 | \n", "3zzf | \n", "Ki=400mM | \n", "4.000000e+05 | \n", "
2 | \n", "3gww | \n", "IC50=355mM | \n", "3.550000e+05 | \n", "
3 | \n", "1w8l | \n", "Ki=320mM | \n", "3.200000e+05 | \n", "
4 | \n", "3fqa | \n", "IC50=320mM | \n", "3.200000e+05 | \n", "
5 | \n", "1zsb | \n", "Kd=250mM | \n", "2.500000e+05 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "
17675 | \n", "7cpa | \n", "Ki=11fM | \n", "1.100000e-08 | \n", "
17676 | \n", "2xuf | \n", "Kd=4.1fM | \n", "4.100000e-09 | \n", "
17677 | \n", "1avd | \n", "Kd=1fM | \n", "1.000000e-09 | \n", "
17678 | \n", "2xui | \n", "Kd=1.0fM | \n", "1.000000e-09 | \n", "
17679 | \n", "2avi | \n", "Kd=0.6fM | \n", "6.000000e-10 | \n", "
17679 rows × 3 columns
\n", "