{ "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", " | pdb | \n", "chain | \n", "l_id | \n", "l_chain | \n", "affinity_lit | \n", "affinity_moad | \n", "affinity_pdbbind-cn | \n", "affinity_bindingdb | \n", "seq | \n", "ligand_fn | \n", "smiles | \n", "affinity_uM | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
38 | \n", "11gs | \n", "EAA | \n", "A | \n", "1 | \n", "None | \n", "ki=1.5uM (GTT EAA) | \n", "Ki=1.5uM (GTT-EAA) | \n", "None | \n", "PYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKASC... | \n", "biolip/data/ligand/11gs_EAA_A_1.pdb | \n", "CC[C@H](C(=O)c1ccc(c(c1Cl)Cl)OCC(=O)O)C | \n", "1.5000 | \n", "
43 | \n", "13gs | \n", "SAS | \n", "A | \n", "1 | \n", "None | \n", "ki=24uM (SAS) | \n", "Ki=24uM (SAS) | \n", "None | \n", "MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA... | \n", "biolip/data/ligand/13gs_SAS_A_1.pdb | \n", "OC(=O)c1cc(/N=N/c2ccc(cc2)S(=O)(=O)Nc2ccccn2)c... | \n", "24.0000 | \n", "
53 | \n", "16pk | \n", "BIS | \n", "A | \n", "1 | \n", "None | \n", "None | \n", "Ki=6uM (BIS) | \n", "None | \n", "EKKSINECDLKGKKVLIRVDFNVPVKNGKITNDYRIRSALPTLKKV... | \n", "biolip/data/ligand/16pk_BIS_A_1.pdb | \n", "O[C@@H]1[C@@H](CO[P@](=O)(O[P@@](=O)(C(CCCC(P(... | \n", "6.0000 | \n", "
54 | \n", "17gs | \n", "GTX | \n", "A | \n", "1 | \n", "None | \n", "None | \n", "None | \n", "Kd=10000nM | \n", "MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA... | \n", "biolip/data/ligand/17gs_GTX_A_1.pdb | \n", "CCCCCCSC[C@@H](C(=O)NCC(=O)O)NC(=O)CC[C@@H](C(... | \n", "10.0000 | \n", "
55 | \n", "181l | \n", "BNZ | \n", "A | \n", "1 | \n", "None | \n", "Ka=5700M^-1 (BNZ) | \n", "None | \n", "Kd=175000nM | \n", "MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... | \n", "biolip/data/ligand/181l_BNZ_A_1.pdb | \n", "c1ccccc1 | \n", "175.0000 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
105118 | \n", "9hvp | \n", "0E9 | \n", "A | \n", "1 | \n", "None | \n", "None | \n", "Ki=4.5nM (5-mer) | \n", "None | \n", "PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... | \n", "biolip/data/ligand/9hvp_0E9_A_1.pdb | \n", "O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... | \n", "0.0045 | \n", "
105119 | \n", "9hvp | \n", "0E9 | \n", "A | \n", "1 | \n", "None | \n", "None | \n", "Ki=4.5nM (5-mer) | \n", "None | \n", "PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... | \n", "biolip/data/ligand/9hvp_0E9_A_1.pdb | \n", "O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... | \n", "0.0045 | \n", "
105124 | \n", "9icd | \n", "NAP | \n", "A | \n", "1 | \n", "None | \n", "kd=125uM (NAP) | \n", "Kd=125uM (NAP) | \n", "None | \n", "SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... | \n", "biolip/data/ligand/9icd_NAP_A_1.pdb | \n", "O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... | \n", "125.0000 | \n", "
105133 | \n", "9lpr | \n", "III | \n", "P | \n", "1 | \n", "None | \n", "None | \n", "Ki=2000nM (4-mer) | \n", "None | \n", "ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI... | \n", "biolip/data/ligand/9lpr_III_P_1.pdb | \n", "CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]... | \n", "2.0000 | \n", "
105138 | \n", "9nse | \n", "ISU | \n", "B | \n", "2 | \n", "None | \n", "Ki=0.039uM (ISU) | \n", "None | \n", "None | \n", "KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... | \n", "biolip/data/ligand/9nse_ISU_B_2.pdb | \n", "CC[Se]C(=N)N | \n", "0.0390 | \n", "
12851 rows × 12 columns
\n", "