{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "ecce356e-321b-441e-8a5d-a20bf72f8691",
"metadata": {},
"outputs": [],
"source": [
"import dask.dataframe as dd"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "89cbcd82-4ca2-4aba-95b7-e58c0ceed770",
"metadata": {},
"outputs": [],
"source": [
"cols = ['Ligand SMILES', 'IC50 (nM)','KEGG ID of Ligand','Ki (nM)', 'Kd (nM)','EC50 (nM)']"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a870d8d7-374b-4474-b9ee-305bbf9f17a9",
"metadata": {},
"outputs": [],
"source": [
"import tqdm.notebook"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "e9f76b32-e8f0-47ee-b592-a91a88f4f93e",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c988bc89781242ec8c8b7f8fd0b1c233",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/13 [00:00, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for i in tqdm.notebook.tqdm(range(0,13)):\n",
" mycol = 'BindingDB Target Chain Sequence.{}'.format(i)\n",
" allseq = ['BindingDB Target Chain Sequence']+['BindingDB Target Chain Sequence.{}'.format(j) for j in range(1,13)]\n",
" dtypes = {'BindingDB Target Chain Sequence.{}'.format(i): 'object' for i in range(1,13)}\n",
" dtypes.update({'BindingDB Target Chain Sequence': 'object',\n",
" 'IC50 (nM)': 'object',\n",
" 'KEGG ID of Ligand': 'object',\n",
" 'Ki (nM)': 'object',\n",
" 'Kd (nM)': 'object',\n",
" 'EC50 (nM)': 'object',\n",
" 'koff (s-1)': 'object'})\n",
" ddf = dd.read_csv('bindingdb/data/BindingDB_All.tsv',sep='\\t',error_bad_lines=False,blocksize=16*1024*1024,\n",
" usecols=cols+allseq,\n",
" dtype=dtypes)\n",
" ddf = ddf.reset_index()\n",
" ddf = ddf.rename(columns={'BindingDB Target Chain Sequence.{}'.format(j): 'seq_{}'.format(j) for j in range(1,13)})\n",
" ddf = ddf.rename(columns={'BindingDB Target Chain Sequence': 'seq_0'})\n",
" ddf = ddf.drop(columns={'seq_{}'.format(j) for j in range(0,13) if i != j})\n",
" ddf[cols+['seq_{}'.format(i)]].to_parquet('bindingdb/parquet_data/target{}'.format(i),schema='infer')"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "be79bbcf-0622-4d1e-8f08-a723a4167d8b",
"metadata": {},
"outputs": [],
"source": [
"ddfs = []\n",
"for i in range(0,13):\n",
" ddf = dd.read_parquet('bindingdb/parquet_data/target{}'.format(i))\n",
" ddf = ddf.rename(columns={'seq_{}'.format(i): 'seq'})\n",
" ddfs.append(ddf)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "35ca09cb-6264-4526-b504-0d29236a03c1",
"metadata": {},
"outputs": [],
"source": [
"ddf = dd.concat(ddfs)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "ba518a9a-0d15-47be-977b-e2dfe2511529",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Ligand SMILES | \n",
" IC50 (nM) | \n",
" KEGG ID of Ligand | \n",
" Ki (nM) | \n",
" Kd (nM) | \n",
" EC50 (nM) | \n",
" seq | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 | \n",
" None | \n",
" None | \n",
" 0.24 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
" 1 | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... | \n",
" None | \n",
" None | \n",
" 0.25 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
" 2 | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... | \n",
" None | \n",
" None | \n",
" 0.41 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
" 3 | \n",
" OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... | \n",
" None | \n",
" None | \n",
" 0.8 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
" 4 | \n",
" OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... | \n",
" None | \n",
" None | \n",
" 0.99 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Ligand SMILES IC50 (nM) \\\n",
"0 COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 None \n",
"1 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... None \n",
"2 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... None \n",
"3 OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... None \n",
"4 OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... None \n",
"\n",
" KEGG ID of Ligand Ki (nM) Kd (nM) EC50 (nM) \\\n",
"0 None 0.24 None None \n",
"1 None 0.25 None None \n",
"2 None 0.41 None None \n",
"3 None 0.8 None None \n",
"4 None 0.99 None None \n",
"\n",
" seq \n",
"0 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"1 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"2 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"3 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"4 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... "
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ddf.head()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "f504d7aa-dfc1-4346-a136-8814c4b5d979",
"metadata": {},
"outputs": [],
"source": [
"ddf.repartition(partition_size='25MB').to_parquet('bindingdb/parquet_data/all_targets',schema='infer')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "d7eafa69-4606-4b34-ae8f-8c6462dcb004",
"metadata": {},
"outputs": [],
"source": [
"ddf = dd.read_parquet('../binding_affinity/bindingdb/parquet_data/all_targets')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "b151868a-0cd6-405e-8401-f79918fb0b07",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"Dask DataFrame Structure:
\n",
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Ligand SMILES | \n",
" IC50 (nM) | \n",
" KEGG ID of Ligand | \n",
" Ki (nM) | \n",
" Kd (nM) | \n",
" EC50 (nM) | \n",
" seq | \n",
"
\n",
" \n",
" npartitions=483 | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" | \n",
" object | \n",
" object | \n",
" object | \n",
" object | \n",
" object | \n",
" object | \n",
" object | \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",
"Dask Name: read-parquet, 483 tasks
"
],
"text/plain": [
"Dask DataFrame Structure:\n",
" Ligand SMILES IC50 (nM) KEGG ID of Ligand Ki (nM) Kd (nM) EC50 (nM) seq\n",
"npartitions=483 \n",
" object object object object object object object\n",
" ... ... ... ... ... ... ...\n",
"... ... ... ... ... ... ... ...\n",
" ... ... ... ... ... ... ...\n",
" ... ... ... ... ... ... ...\n",
"Dask Name: read-parquet, 483 tasks"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ddf"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "c00102b8-f4be-4ebd-8d30-7a2c7fc2d05e",
"metadata": {},
"outputs": [],
"source": [
"ddf_nonnull = ddf[~ddf.seq.isnull()].copy()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "c5337e06-1e45-4180-90ed-49ac9ecdd24a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Ligand SMILES | \n",
" IC50 (nM) | \n",
" KEGG ID of Ligand | \n",
" Ki (nM) | \n",
" Kd (nM) | \n",
" EC50 (nM) | \n",
" seq | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 | \n",
" None | \n",
" None | \n",
" 0.24 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
" 1 | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... | \n",
" None | \n",
" None | \n",
" 0.25 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
" 2 | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... | \n",
" None | \n",
" None | \n",
" 0.41 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
" 3 | \n",
" OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... | \n",
" None | \n",
" None | \n",
" 0.8 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
" 4 | \n",
" OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... | \n",
" None | \n",
" None | \n",
" 0.99 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Ligand SMILES IC50 (nM) \\\n",
"0 COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 None \n",
"1 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... None \n",
"2 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... None \n",
"3 OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... None \n",
"4 OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... None \n",
"\n",
" KEGG ID of Ligand Ki (nM) Kd (nM) EC50 (nM) \\\n",
"0 None 0.24 None None \n",
"1 None 0.25 None None \n",
"2 None 0.41 None None \n",
"3 None 0.8 None None \n",
"4 None 0.99 None None \n",
"\n",
" seq \n",
"0 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"1 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"2 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"3 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"4 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ddf_nonnull.head()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "7b423365-4989-4325-a5a5-845d852d52e9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2512985"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(ddf_nonnull)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "872edb84-3459-43d9-8e0e-e2a6b5d281eb",
"metadata": {},
"outputs": [],
"source": [
"from pint import UnitRegistry\n",
"import numpy as np\n",
"import re\n",
"ureg = UnitRegistry()\n",
"\n",
"def to_uM(affinities):\n",
" ic50, Ki, Kd, ec50 = affinities\n",
"\n",
" vals = []\n",
" \n",
" try:\n",
" ic50 = ureg(str(ic50)+'nM').m_as(ureg.uM)\n",
" vals.append(ic50)\n",
" except:\n",
" pass\n",
"\n",
" try:\n",
" Ki = ureg(str(Ki)+'nM').m_as(ureg.uM)\n",
" vals.append(Ki)\n",
" except:\n",
" pass\n",
"\n",
" try:\n",
" Kd = ureg(str(Kd)+'nM').m_as(ureg.uM)\n",
" vals.append(Kd)\n",
" except:\n",
" pass\n",
"\n",
" try:\n",
" ec50 = ureg(str(ec50)+'nM').m_as(ureg.uM)\n",
" vals.append(ec50)\n",
" except:\n",
" pass\n",
"\n",
" if len(vals) > 0:\n",
" vals = np.array(vals)\n",
" return np.mean(vals[~np.isnan(vals)])\n",
" \n",
" return None"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "b3cff13c-19b2-4413-a84b-d99062f516a7",
"metadata": {},
"outputs": [],
"source": [
"df_nonnull = ddf_nonnull.compute()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "ca9795de-e821-4dc3-a7bf-70ade9e4c7f0",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: Pandarallel will run on 32 workers.\n",
"INFO: Pandarallel will use Memory file system to transfer data between the main process and workers.\n"
]
}
],
"source": [
"from pandarallel import pandarallel\n",
"pandarallel.initialize()\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "4356a3e2-fede-48e7-a486-343661fe0a0a",
"metadata": {},
"outputs": [],
"source": [
"df_affinity = df_nonnull.copy()\n",
"df_affinity['affinity_uM'] = df_affinity[['IC50 (nM)', 'Ki (nM)', 'Kd (nM)','EC50 (nM)']].parallel_apply(to_uM,axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "e91c3af8-84a5-42a2-9e25-49cb2f320b0b",
"metadata": {},
"outputs": [],
"source": [
"df_affinity[~df_affinity['affinity_uM'].isnull()].to_parquet('data/bindingdb.parquet')"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "f3a9173e-d574-4314-9cea-f8c0a66766c0",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"df_affinity = pd.read_parquet('data/bindingdb.parquet')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "f602fdbe-7083-436c-9eac-9d97fbc8be67",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2510716"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(df_affinity)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "27194288-cf3e-4c30-ad55-3b0998fdf939",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Ligand SMILES | \n",
" IC50 (nM) | \n",
" KEGG ID of Ligand | \n",
" Ki (nM) | \n",
" Kd (nM) | \n",
" EC50 (nM) | \n",
" seq | \n",
" affinity_uM | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 | \n",
" None | \n",
" None | \n",
" 0.24 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00024 | \n",
"
\n",
" \n",
" 1 | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... | \n",
" None | \n",
" None | \n",
" 0.25 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00025 | \n",
"
\n",
" \n",
" 2 | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... | \n",
" None | \n",
" None | \n",
" 0.41 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00041 | \n",
"
\n",
" \n",
" 3 | \n",
" OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... | \n",
" None | \n",
" None | \n",
" 0.8 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00080 | \n",
"
\n",
" \n",
" 4 | \n",
" OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... | \n",
" None | \n",
" None | \n",
" 0.99 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00099 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Ligand SMILES IC50 (nM) \\\n",
"0 COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 None \n",
"1 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... None \n",
"2 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... None \n",
"3 OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... None \n",
"4 OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... None \n",
"\n",
" KEGG ID of Ligand Ki (nM) Kd (nM) EC50 (nM) \\\n",
"0 None 0.24 None None \n",
"1 None 0.25 None None \n",
"2 None 0.41 None None \n",
"3 None 0.8 None None \n",
"4 None 0.99 None None \n",
"\n",
" seq affinity_uM \n",
"0 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00024 \n",
"1 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00025 \n",
"2 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00041 \n",
"3 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00080 \n",
"4 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00099 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_affinity.head()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "603fd298-0aa6-4097-b298-c55db013548c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2510716"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(df_affinity)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "d95ad9a9-d4ca-4679-8a33-235fe6e7047f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2510716"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(df_affinity[~df_affinity['affinity_uM'].isnull()])"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "b21c4683-0fe1-4a0a-a55c-c0dc80193f36",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Ligand SMILES | \n",
" IC50 (nM) | \n",
" KEGG ID of Ligand | \n",
" Ki (nM) | \n",
" Kd (nM) | \n",
" EC50 (nM) | \n",
" seq | \n",
" affinity_uM | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 | \n",
" None | \n",
" None | \n",
" 0.24 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00024 | \n",
"
\n",
" \n",
" 1 | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... | \n",
" None | \n",
" None | \n",
" 0.25 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00025 | \n",
"
\n",
" \n",
" 2 | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... | \n",
" None | \n",
" None | \n",
" 0.41 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00041 | \n",
"
\n",
" \n",
" 3 | \n",
" OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... | \n",
" None | \n",
" None | \n",
" 0.8 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00080 | \n",
"
\n",
" \n",
" 4 | \n",
" OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... | \n",
" None | \n",
" None | \n",
" 0.99 | \n",
" None | \n",
" None | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" 0.00099 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 5112 | \n",
" COc1ccc(NC(=O)N2CCC(CC2)C(=O)N[C@@H](CC(C)C)C(... | \n",
" 17 | \n",
" None | \n",
" None | \n",
" None | \n",
" None | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" 0.01700 | \n",
"
\n",
" \n",
" 5113 | \n",
" CC(C)C[C@H](NC(=O)C1CCN(CC1)C(=O)Nc1cnccn1)C(=... | \n",
" 76 | \n",
" None | \n",
" None | \n",
" None | \n",
" None | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" 0.07600 | \n",
"
\n",
" \n",
" 5313 | \n",
" C[C@H](NC(=O)[C@H](Cc1ccccc1)NC(=O)OCc1ccccc1)... | \n",
" >100000 | \n",
" None | \n",
" None | \n",
" None | \n",
" None | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" 100.00000 | \n",
"
\n",
" \n",
" 5314 | \n",
" FCC(=O)CNC(=O)[C@H](Cc1ccccc1)NC(=O)c1cccc2ccc... | \n",
" >100000 | \n",
" None | \n",
" None | \n",
" None | \n",
" None | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" 100.00000 | \n",
"
\n",
" \n",
" 5361 | \n",
" FCC(=O)CNC(=O)[C@H](Cc1ccccc1)NC(=O)c1ccccc1 | \n",
" >100000 | \n",
" None | \n",
" None | \n",
" None | \n",
" None | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" 100.00000 | \n",
"
\n",
" \n",
"
\n",
"
2510716 rows × 8 columns
\n",
"
"
],
"text/plain": [
" Ligand SMILES IC50 (nM) \\\n",
"0 COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 None \n",
"1 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... None \n",
"2 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... None \n",
"3 OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... None \n",
"4 OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... None \n",
"... ... ... \n",
"5112 COc1ccc(NC(=O)N2CCC(CC2)C(=O)N[C@@H](CC(C)C)C(... 17 \n",
"5113 CC(C)C[C@H](NC(=O)C1CCN(CC1)C(=O)Nc1cnccn1)C(=... 76 \n",
"5313 C[C@H](NC(=O)[C@H](Cc1ccccc1)NC(=O)OCc1ccccc1)... >100000 \n",
"5314 FCC(=O)CNC(=O)[C@H](Cc1ccccc1)NC(=O)c1cccc2ccc... >100000 \n",
"5361 FCC(=O)CNC(=O)[C@H](Cc1ccccc1)NC(=O)c1ccccc1 >100000 \n",
"\n",
" KEGG ID of Ligand Ki (nM) Kd (nM) EC50 (nM) \\\n",
"0 None 0.24 None None \n",
"1 None 0.25 None None \n",
"2 None 0.41 None None \n",
"3 None 0.8 None None \n",
"4 None 0.99 None None \n",
"... ... ... ... ... \n",
"5112 None None None None \n",
"5113 None None None None \n",
"5313 None None None None \n",
"5314 None None None None \n",
"5361 None None None None \n",
"\n",
" seq affinity_uM \n",
"0 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00024 \n",
"1 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00025 \n",
"2 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00041 \n",
"3 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00080 \n",
"4 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... 0.00099 \n",
"... ... ... \n",
"5112 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... 0.01700 \n",
"5113 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... 0.07600 \n",
"5313 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... 100.00000 \n",
"5314 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... 100.00000 \n",
"5361 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... 100.00000 \n",
"\n",
"[2510716 rows x 8 columns]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_affinity"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "20690729",
"metadata": {},
"outputs": [],
"source": [
"import rdkit.Chem as Chem"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "48114dcc",
"metadata": {},
"outputs": [],
"source": [
"df_pdb = df[~df['PDB ID(s) for Ligand-Target Complex'].isnull()][['PDB ID(s) for Ligand-Target Complex','Ligand SMILES']]"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "caa0497c",
"metadata": {},
"outputs": [],
"source": [
"def make_canonical(smi):\n",
" return Chem.MolToSmiles(Chem.MolFromSmiles(smi))\n",
"\n",
"df_pdb['can_smiles'] = df_pdb['Ligand SMILES'].apply(make_canonical)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "e82d64f3",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" PDB ID(s) for Ligand-Target Complex | \n",
" Ligand SMILES | \n",
" can_smiles | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 2IVU | \n",
" COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 | \n",
" COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 | \n",
"
\n",
" \n",
" 29 | \n",
" 1HWR | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC=C)C(=O)... | \n",
" C=CCN1C(=O)N(CC=C)[C@H](Cc2ccccc2)[C@H](O)[C@@... | \n",
"
\n",
" \n",
" 34 | \n",
" 6DGY,6DH1,6DH4,6DH7,3O99 | \n",
" CC[C@H](C)CN(C[C@@H](O)[C@H](Cc1ccccc1)NC(=O)O... | \n",
" CC[C@H](C)CN(C[C@@H](O)[C@H](Cc1ccccc1)NC(=O)O... | \n",
"
\n",
" \n",
" 129 | \n",
" 1MES,1MEU,1MET,1BVG,1BVE,3JVW,1QBS | \n",
" OCc1ccc(CN2[C@H](Cc3ccccc3)[C@H](O)[C@@H](O)[C... | \n",
" O=C1N(Cc2ccc(CO)cc2)[C@H](Cc2ccccc2)[C@H](O)[C... | \n",
"
\n",
" \n",
" 130 | \n",
" 1MER,1DMP,1RQ9 | \n",
" Nc1cccc(CN2[C@H](Cc3ccccc3)[C@H](O)[C@@H](O)[C... | \n",
" Nc1cccc(CN2C(=O)N(Cc3cccc(N)c3)[C@H](Cc3ccccc3... | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 2333375 | \n",
" 1MUI,2RKG,2RKF,1RV7,2Q5K,2O4S,6DJ1,6DJ2,3OGQ,2... | \n",
" CC(C)[C@H](N1CCCNC1=O)C(=O)N[C@H](C[C@H](O)[C@... | \n",
" Cc1cccc(C)c1OCC(=O)N[C@@H](Cc1ccccc1)[C@@H](O)... | \n",
"
\n",
" \n",
" 2333376 | \n",
" 4NPT,4DQH,4DQE,5E5J,3JW2,6OPU,6OPX,2HS2,2HS1,2... | \n",
" CC(C)CN(C[C@@H](O)[C@H](Cc1ccccc1)NC(=O)O[C@H]... | \n",
" CC(C)CN(C[C@@H](O)[C@H](Cc1ccccc1)NC(=O)O[C@H]... | \n",
"
\n",
" \n",
" 2333380 | \n",
" 6EKZ,1DY4,5FUK,6PS5 | \n",
" CC(C)NCC(O)COc1cccc2ccccc12 | \n",
" CC(C)NCC(O)COc1cccc2ccccc12 | \n",
"
\n",
" \n",
" 2333384 | \n",
" 6EKZ,1DY4,5FUK,6PS5 | \n",
" CC(C)NCC(O)COc1cccc2ccccc12 | \n",
" CC(C)NCC(O)COc1cccc2ccccc12 | \n",
"
\n",
" \n",
" 2333385 | \n",
" 6A60,3DCT | \n",
" CC(C)c1onc(c1COc1ccc(\\C=C\\c2cccc(c2)C(O)=O)c(C... | \n",
" CC(C)c1onc(-c2c(Cl)cccc2Cl)c1COc1ccc(/C=C/c2cc... | \n",
"
\n",
" \n",
"
\n",
"
123385 rows × 3 columns
\n",
"
"
],
"text/plain": [
" PDB ID(s) for Ligand-Target Complex \\\n",
"0 2IVU \n",
"29 1HWR \n",
"34 6DGY,6DH1,6DH4,6DH7,3O99 \n",
"129 1MES,1MEU,1MET,1BVG,1BVE,3JVW,1QBS \n",
"130 1MER,1DMP,1RQ9 \n",
"... ... \n",
"2333375 1MUI,2RKG,2RKF,1RV7,2Q5K,2O4S,6DJ1,6DJ2,3OGQ,2... \n",
"2333376 4NPT,4DQH,4DQE,5E5J,3JW2,6OPU,6OPX,2HS2,2HS1,2... \n",
"2333380 6EKZ,1DY4,5FUK,6PS5 \n",
"2333384 6EKZ,1DY4,5FUK,6PS5 \n",
"2333385 6A60,3DCT \n",
"\n",
" Ligand SMILES \\\n",
"0 COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 \n",
"29 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC=C)C(=O)... \n",
"34 CC[C@H](C)CN(C[C@@H](O)[C@H](Cc1ccccc1)NC(=O)O... \n",
"129 OCc1ccc(CN2[C@H](Cc3ccccc3)[C@H](O)[C@@H](O)[C... \n",
"130 Nc1cccc(CN2[C@H](Cc3ccccc3)[C@H](O)[C@@H](O)[C... \n",
"... ... \n",
"2333375 CC(C)[C@H](N1CCCNC1=O)C(=O)N[C@H](C[C@H](O)[C@... \n",
"2333376 CC(C)CN(C[C@@H](O)[C@H](Cc1ccccc1)NC(=O)O[C@H]... \n",
"2333380 CC(C)NCC(O)COc1cccc2ccccc12 \n",
"2333384 CC(C)NCC(O)COc1cccc2ccccc12 \n",
"2333385 CC(C)c1onc(c1COc1ccc(\\C=C\\c2cccc(c2)C(O)=O)c(C... \n",
"\n",
" can_smiles \n",
"0 COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 \n",
"29 C=CCN1C(=O)N(CC=C)[C@H](Cc2ccccc2)[C@H](O)[C@@... \n",
"34 CC[C@H](C)CN(C[C@@H](O)[C@H](Cc1ccccc1)NC(=O)O... \n",
"129 O=C1N(Cc2ccc(CO)cc2)[C@H](Cc2ccccc2)[C@H](O)[C... \n",
"130 Nc1cccc(CN2C(=O)N(Cc3cccc(N)c3)[C@H](Cc3ccccc3... \n",
"... ... \n",
"2333375 Cc1cccc(C)c1OCC(=O)N[C@@H](Cc1ccccc1)[C@@H](O)... \n",
"2333376 CC(C)CN(C[C@@H](O)[C@H](Cc1ccccc1)NC(=O)O[C@H]... \n",
"2333380 CC(C)NCC(O)COc1cccc2ccccc12 \n",
"2333384 CC(C)NCC(O)COc1cccc2ccccc12 \n",
"2333385 CC(C)c1onc(-c2c(Cl)cccc2Cl)c1COc1ccc(/C=C/c2cc... \n",
"\n",
"[123385 rows x 3 columns]"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_pdb"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "593c9aec",
"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
}