{ "cells": [ { "cell_type": "code", "execution_count": 3, "id": "26bc18a2-a6eb-49d3-be80-876ddc7dd8e1", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "markdown", "id": "dbef8a5d-8603-4f40-aa98-fe50aa1160f6", "metadata": {}, "source": [ "the binding affinities are **only** present in the 2013 snapshot, not in the updated ones" ] }, { "cell_type": "code", "execution_count": 48, "id": "3b59cfb4-c42a-425d-9653-44f07f9e864e", "metadata": {}, "outputs": [], "source": [ "df = pd.read_table('biolip/data/BioLiP_2013-03-6_nr.txt',sep='\\t',header=None,usecols=[0,4,5,6,13,14,15,16,19])\n", "df = df.rename(columns={0:'pdb',4:'chain',5:'l_id',6:'l_chain',\n", " 13: 'affinity_lit',14: 'affinity_moad',15: 'affinity_pdbbind-cn',16:'affinity_bindingdb',\n", " 19: 'seq'})" ] }, { "cell_type": "code", "execution_count": 49, "id": "01123edd-2b98-4fcc-a2e9-28213b9bed82", "metadata": {}, "outputs": [], "source": [ "base = 'biolip/data/ligand/'\n", "df['ligand_fn'] = base + df['pdb']+'_'+df['chain']+'_'+df['l_id'].astype(str)+'_'+df['l_chain'].astype(str)+'.pdb'" ] }, { "cell_type": "code", "execution_count": 50, "id": "bd8671da-66ad-40ad-b221-e33228be65f4", "metadata": {}, "outputs": [], "source": [ "df_complex = pd.read_parquet('data/biolip_complex.parquet')" ] }, { "cell_type": "code", "execution_count": 51, "id": "08b04d75-c01e-4b26-ae2d-622efae3bd1f", "metadata": {}, "outputs": [], "source": [ "df_affinity = df_complex[~df_complex['affinity_lit'].isnull() | ~df_complex['affinity_moad'].isnull() \n", " | ~df_complex['affinity_pdbbind-cn'].isnull() | ~df_complex['affinity_bindingdb'].isnull()].copy()" ] }, { "cell_type": "code", "execution_count": 57, "id": "97af5533-10fe-4419-a998-ed80b7d26690", "metadata": {}, "outputs": [], "source": [ "from pint import UnitRegistry\n", "import numpy as np\n", "import re\n", "ureg = UnitRegistry()\n", "\n", "quantities = ['ki','kd','ka','k1/2','kb','ic50','ec50','km']\n", "\n", "others = set()\n", "def to_uM(affinities):\n", " lit, moad, pdbbind, bindingdb = affinities\n", "\n", " vals = []\n", " try:\n", " q = re.split('[=~<>]',str(lit))[0].lower()\n", " if q not in quantities:\n", " others.add(q)\n", " raise\n", " val = re.split('[=~<>]',str(lit))[1].split(' ')[0]\n", " val = ureg(val).m_as(ureg.uM)\n", " vals.append(val)\n", " except:\n", " pass\n", "\n", " try:\n", " q = re.split('[=~<>]',str(lit))[0].lower()\n", " if q not in quantities:\n", " others.add(q)\n", " raise\n", " val = re.split('[=~<>]',str(lit))[1].split(' ')[0]\n", " val = ureg(val).m_as(1/ureg.uM)\n", " vals.append(1/val)\n", " except:\n", " pass\n", "\n", " try:\n", " q = re.split('[=~<>]',str(moad))[0].lower()\n", " if q not in quantities:\n", " others.add(q)\n", " raise\n", " val = re.split('[=~<>]',str(moad))[1].split(' ')[0]\n", " val = ureg(val).m_as(ureg.uM)\n", " vals.append(val)\n", " except:\n", " pass\n", "\n", " try:\n", " q = re.split('[=~<>]',str(moad))[0].lower()\n", " if q not in quantities:\n", " others.add(q)\n", " raise\n", " val = re.split('[=~<>]',str(moad))[1].split(' ')[0]\n", " val = ureg(val).m_as(1/ureg.uM)\n", " vals.append(1/moad)\n", " except:\n", " pass\n", "\n", " try:\n", " q = re.split('[=~<>]',str(pdbbind))[0].lower()\n", " if q not in quantities:\n", " others.add(q)\n", " raise\n", " val = re.split('[=~<>]',str(pdbbind))[1].split(' ')[0]\n", " val = ureg(val).m_as(ureg.uM)\n", " vals.append(val)\n", " except:\n", " pass\n", "\n", " try:\n", " q = re.split('[=~<>]',str(pdbbind))[0].lower()\n", " if q not in quantities:\n", " others.add(q)\n", " raise\n", " val = re.split('[=~<>]',str(pdbbind))[1].split(' ')[0]\n", " val = ureg(val).m_as(1/ureg.uM)\n", " vals.append(1/val)\n", " except:\n", " pass\n", "\n", " try:\n", " q = re.split('[=~<>]',str(bindingdb))[0].lower()\n", " if q not in quantities:\n", " others.add(q)\n", " raise\n", " val = re.split('[=~<>]',str(bindingdb))[1].split(' ')[0]\n", " val = ureg(val).m_as(ureg.uM)\n", " vals.append(val)\n", " except:\n", " pass\n", "\n", " try:\n", " q = re.split('[=~<>]',str(bindingdb))[0].lower()\n", " if q not in quantities:\n", " others.add(q)\n", " raise\n", " val = re.split('[=~<>]',str(bindingdb))[1].split(' ')[0]\n", " val = ureg(val).m_as(1/ureg.uM)\n", " vals.append(1/val)\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": 58, "id": "d2fab1e6-ec5b-46f9-a4a2-f3744128c777", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['pdb', 'chain', 'l_id', 'l_chain', 'affinity_lit', 'affinity_moad',\n", " 'affinity_pdbbind-cn', 'affinity_bindingdb', 'seq', 'ligand_fn',\n", " 'smiles', 'affinity_uM'],\n", " dtype='object')" ] }, "execution_count": 58, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_affinity.columns" ] }, { "cell_type": "code", "execution_count": 59, "id": "e21154a9-d3a0-4aa3-986f-cfeebc280da6", "metadata": {}, "outputs": [], "source": [ "df_affinity['affinity_uM'] = df_affinity[['affinity_lit','affinity_moad','affinity_pdbbind-cn','affinity_bindingdb']].apply(to_uM,axis=1)" ] }, { "cell_type": "code", "execution_count": 60, "id": "6b9526ec-b134-4ecb-8fea-b493c3fdac22", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'deltag', 'deltah', 'none'}" ] }, "execution_count": 60, "metadata": {}, "output_type": "execute_result" } ], "source": [ "others" ] }, { "cell_type": "code", "execution_count": 61, "id": "0fc94de0-823d-4f4f-9904-1c4d1e722c2e", "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", " \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", " \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", "
pdbchainl_idl_chainaffinity_litaffinity_moadaffinity_pdbbind-cnaffinity_bindingdbseqligand_fnsmilesaffinity_uM
3811gsEAAA1Noneki=1.5uM (GTT EAA)Ki=1.5uM (GTT-EAA)NonePYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKASC...biolip/data/ligand/11gs_EAA_A_1.pdbCC[C@H](C(=O)c1ccc(c(c1Cl)Cl)OCC(=O)O)C1.5000
4313gsSASA1Noneki=24uM (SAS)Ki=24uM (SAS)NoneMPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA...biolip/data/ligand/13gs_SAS_A_1.pdbOC(=O)c1cc(/N=N/c2ccc(cc2)S(=O)(=O)Nc2ccccn2)c...24.0000
5316pkBISA1NoneNoneKi=6uM (BIS)NoneEKKSINECDLKGKKVLIRVDFNVPVKNGKITNDYRIRSALPTLKKV...biolip/data/ligand/16pk_BIS_A_1.pdbO[C@@H]1[C@@H](CO[P@](=O)(O[P@@](=O)(C(CCCC(P(...6.0000
5417gsGTXA1NoneNoneNoneKd=10000nMMPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA...biolip/data/ligand/17gs_GTX_A_1.pdbCCCCCCSC[C@@H](C(=O)NCC(=O)O)NC(=O)CC[C@@H](C(...10.0000
55181lBNZA1NoneKa=5700M^-1 (BNZ)NoneKd=175000nMMNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL...biolip/data/ligand/181l_BNZ_A_1.pdbc1ccccc1175.0000
.......................................
1051189hvp0E9A1NoneNoneKi=4.5nM (5-mer)NonePQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM...biolip/data/ligand/9hvp_0E9_A_1.pdbO[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=...0.0045
1051199hvp0E9A1NoneNoneKi=4.5nM (5-mer)NonePQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM...biolip/data/ligand/9hvp_0E9_A_1.pdbO[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=...0.0045
1051249icdNAPA1Nonekd=125uM (NAP)Kd=125uM (NAP)NoneSKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV...biolip/data/ligand/9icd_NAP_A_1.pdbO[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O...125.0000
1051339lprIIIP1NoneNoneKi=2000nM (4-mer)NoneANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI...biolip/data/ligand/9lpr_III_P_1.pdbCC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]...2.0000
1051389nseISUB2NoneKi=0.039uM (ISU)NoneNoneKFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR...biolip/data/ligand/9nse_ISU_B_2.pdbCC[Se]C(=N)N0.0390
\n", "

12851 rows × 12 columns

\n", "
" ], "text/plain": [ " pdb chain l_id l_chain affinity_lit affinity_moad \\\n", "38 11gs EAA A 1 None ki=1.5uM (GTT EAA) \n", "43 13gs SAS A 1 None ki=24uM (SAS) \n", "53 16pk BIS A 1 None None \n", "54 17gs GTX A 1 None None \n", "55 181l BNZ A 1 None Ka=5700M^-1 (BNZ) \n", "... ... ... ... ... ... ... \n", "105118 9hvp 0E9 A 1 None None \n", "105119 9hvp 0E9 A 1 None None \n", "105124 9icd NAP A 1 None kd=125uM (NAP) \n", "105133 9lpr III P 1 None None \n", "105138 9nse ISU B 2 None Ki=0.039uM (ISU) \n", "\n", " affinity_pdbbind-cn affinity_bindingdb \\\n", "38 Ki=1.5uM (GTT-EAA) None \n", "43 Ki=24uM (SAS) None \n", "53 Ki=6uM (BIS) None \n", "54 None Kd=10000nM \n", "55 None Kd=175000nM \n", "... ... ... \n", "105118 Ki=4.5nM (5-mer) None \n", "105119 Ki=4.5nM (5-mer) None \n", "105124 Kd=125uM (NAP) None \n", "105133 Ki=2000nM (4-mer) None \n", "105138 None None \n", "\n", " seq \\\n", "38 PYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKASC... \n", "43 MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA... \n", "53 EKKSINECDLKGKKVLIRVDFNVPVKNGKITNDYRIRSALPTLKKV... \n", "54 MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA... \n", "55 MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... \n", "... ... \n", "105118 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... \n", "105119 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... \n", "105124 SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... \n", "105133 ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI... \n", "105138 KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... \n", "\n", " ligand_fn \\\n", "38 biolip/data/ligand/11gs_EAA_A_1.pdb \n", "43 biolip/data/ligand/13gs_SAS_A_1.pdb \n", "53 biolip/data/ligand/16pk_BIS_A_1.pdb \n", "54 biolip/data/ligand/17gs_GTX_A_1.pdb \n", "55 biolip/data/ligand/181l_BNZ_A_1.pdb \n", "... ... \n", "105118 biolip/data/ligand/9hvp_0E9_A_1.pdb \n", "105119 biolip/data/ligand/9hvp_0E9_A_1.pdb \n", "105124 biolip/data/ligand/9icd_NAP_A_1.pdb \n", "105133 biolip/data/ligand/9lpr_III_P_1.pdb \n", "105138 biolip/data/ligand/9nse_ISU_B_2.pdb \n", "\n", " smiles affinity_uM \n", "38 CC[C@H](C(=O)c1ccc(c(c1Cl)Cl)OCC(=O)O)C 1.5000 \n", "43 OC(=O)c1cc(/N=N/c2ccc(cc2)S(=O)(=O)Nc2ccccn2)c... 24.0000 \n", "53 O[C@@H]1[C@@H](CO[P@](=O)(O[P@@](=O)(C(CCCC(P(... 6.0000 \n", "54 CCCCCCSC[C@@H](C(=O)NCC(=O)O)NC(=O)CC[C@@H](C(... 10.0000 \n", "55 c1ccccc1 175.0000 \n", "... ... ... \n", "105118 O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... 0.0045 \n", "105119 O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... 0.0045 \n", "105124 O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... 125.0000 \n", "105133 CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]... 2.0000 \n", "105138 CC[Se]C(=N)N 0.0390 \n", "\n", "[12851 rows x 12 columns]" ] }, "execution_count": 61, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_affinity[~df_affinity['affinity_uM'].isnull()]" ] }, { "cell_type": "code", "execution_count": 63, "id": "2b483565-3c99-4c42-b2a9-f7b97cd8e80e", "metadata": {}, "outputs": [], "source": [ "df_affinity.to_parquet('data/biolip.parquet')" ] }, { "cell_type": "code", "execution_count": 64, "id": "68dd5e45-b31d-492d-a47e-39072b67fa72", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "13645" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_affinity)" ] }, { "cell_type": "code", "execution_count": null, "id": "cf11317d-bbab-40f1-a8a2-b6fd6126e998", "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 }