{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "ee43bf48-5491-4dc4-aa09-cb4a0f460f97", "metadata": {}, "outputs": [], "source": [ "from openbabel import pybel\n", "from Bio.PDB import * \n" ] }, { "cell_type": "code", "execution_count": 2, "id": "26bc18a2-a6eb-49d3-be80-876ddc7dd8e1", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 3, "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": 4, "id": "01123edd-2b98-4fcc-a2e9-28213b9bed82", "metadata": {}, "outputs": [], "source": [ "base = 'biolip/data/ligand_nr/'\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": 5, "id": "bd8671da-66ad-40ad-b221-e33228be65f4", "metadata": {}, "outputs": [], "source": [ "df_complex = pd.read_parquet('data/biolip_complex.parquet')" ] }, { "cell_type": "code", "execution_count": 97, "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": 98, "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", "def to_uM(affinities):\n", " lit, moad, pdbbind, bindingdb = affinities\n", "\n", " vals = []\n", " try:\n", " lit = re.split('[=~<>]',str(lit))[1].split(' ')[0]\n", " lit = ureg(lit).m_as(ureg.uM)\n", " vals.append(lit)\n", " except:\n", " pass\n", "\n", " try:\n", " moad = re.split('[=~<>]',str(moad))[1].split(' ')[0]\n", " moad = ureg(moad).m_as(ureg.uM)\n", " vals.append(moad)\n", " except:\n", " pass\n", "\n", " try:\n", " pdbbind = re.split('[=~<>]',str(pdbbind))[1].split(' ')[0]\n", " pdbbind = ureg(bindingdb).m_as(ureg.uM)\n", " vals.append(pdbbind)\n", " except:\n", " pass\n", "\n", " try:\n", " bindingdb = re.split('[=~<>]',str(bindingdb))[1].split(' ')[0]\n", " bindingdb = ureg(bindingdb).m_as(ureg.uM)\n", " vals.append(bindingdb)\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": 99, "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": 101, "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_nr/11gs_EAA_A_1.pdbCC[C@H](C(=O)c1ccc(c(c1Cl)Cl)OCC(=O)O)C1.500
4313gsSASA1Noneki=24uM (SAS)Ki=24uM (SAS)NoneMPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA...biolip/data/ligand_nr/13gs_SAS_A_1.pdbOC(=O)c1cc(/N=N/c2ccc(cc2)S(=O)(=O)Nc2ccccn2)c...24.000
5417gsGTXA1NoneNoneNoneKd=10000nMMPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA...biolip/data/ligand_nr/17gs_GTX_A_1.pdbCCCCCCSC[C@@H](C(=O)NCC(=O)O)NC(=O)CC[C@@H](C(...10.000
55181lBNZA1NoneKa=5700M^-1 (BNZ)NoneKd=175000nMMNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL...biolip/data/ligand_nr/181l_BNZ_A_1.pdbc1ccccc1175.000
56182lBZFA1NoneKa=8900M^-1 (BZF)NoneKd=112000nMMNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL...biolip/data/ligand_nr/182l_BZF_A_1.pdbc1ccc2c(c1)occ2112.000
.......................................
1050878kmeIII31Noneki=8uM (BNN CUC TRG LEU PRO)NoneNoneIVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL...biolip/data/ligand_nr/8kme_III_3_1.pdbO=C[C@@H](NC(=O)[C@H](Cc1ccc(cc1)OS(O)(O)O)NC(...8.000
1050888kmeIII41Noneki=8uM (BNN CUC TRG LEU PRO)NoneNoneIVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL...biolip/data/ligand_nr/8kme_III_4_1.pdbCC(C[C@@H](C(=O)N1C=CC[C@H]1C(=O)N)NC(=O)[C@@H...8.000
105106966cRS2A1Noneki=23nM (RS2)Ki=23nM (RS2)NoneRWEQTHLTYRIENYTPDLPRADVDHAIEKAFQLWSNVTPLTFTKVS...biolip/data/ligand_nr/966c_RS2_A_1.pdbONC(=O)CC1(CCOCC1)S(=O)(=O)c1ccc(cc1)Oc1ccccc10.023
1051249icdNAPA1Nonekd=125uM (NAP)Kd=125uM (NAP)NoneSKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV...biolip/data/ligand_nr/9icd_NAP_A_1.pdbO[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O...125.000
1051389nseISUB2NoneKi=0.039uM (ISU)NoneNoneKFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR...biolip/data/ligand_nr/9nse_ISU_B_2.pdbCC[Se]C(=N)N0.039
\n", "

7588 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", "54 17gs GTX A 1 None None \n", "55 181l BNZ A 1 None Ka=5700M^-1 (BNZ) \n", "56 182l BZF A 1 None Ka=8900M^-1 (BZF) \n", "... ... ... ... ... ... ... \n", "105087 8kme III 3 1 None ki=8uM (BNN CUC TRG LEU PRO) \n", "105088 8kme III 4 1 None ki=8uM (BNN CUC TRG LEU PRO) \n", "105106 966c RS2 A 1 None ki=23nM (RS2) \n", "105124 9icd NAP A 1 None kd=125uM (NAP) \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", "54 None Kd=10000nM \n", "55 None Kd=175000nM \n", "56 None Kd=112000nM \n", "... ... ... \n", "105087 None None \n", "105088 None None \n", "105106 Ki=23nM (RS2) None \n", "105124 Kd=125uM (NAP) None \n", "105138 None None \n", "\n", " seq \\\n", "38 PYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKASC... \n", "43 MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA... \n", "54 MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA... \n", "55 MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... \n", "56 MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... \n", "... ... \n", "105087 IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... \n", "105088 IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... \n", "105106 RWEQTHLTYRIENYTPDLPRADVDHAIEKAFQLWSNVTPLTFTKVS... \n", "105124 SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... \n", "105138 KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... \n", "\n", " ligand_fn \\\n", "38 biolip/data/ligand_nr/11gs_EAA_A_1.pdb \n", "43 biolip/data/ligand_nr/13gs_SAS_A_1.pdb \n", "54 biolip/data/ligand_nr/17gs_GTX_A_1.pdb \n", "55 biolip/data/ligand_nr/181l_BNZ_A_1.pdb \n", "56 biolip/data/ligand_nr/182l_BZF_A_1.pdb \n", "... ... \n", "105087 biolip/data/ligand_nr/8kme_III_3_1.pdb \n", "105088 biolip/data/ligand_nr/8kme_III_4_1.pdb \n", "105106 biolip/data/ligand_nr/966c_RS2_A_1.pdb \n", "105124 biolip/data/ligand_nr/9icd_NAP_A_1.pdb \n", "105138 biolip/data/ligand_nr/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.500 \n", "43 OC(=O)c1cc(/N=N/c2ccc(cc2)S(=O)(=O)Nc2ccccn2)c... 24.000 \n", "54 CCCCCCSC[C@@H](C(=O)NCC(=O)O)NC(=O)CC[C@@H](C(... 10.000 \n", "55 c1ccccc1 175.000 \n", "56 c1ccc2c(c1)occ2 112.000 \n", "... ... ... \n", "105087 O=C[C@@H](NC(=O)[C@H](Cc1ccc(cc1)OS(O)(O)O)NC(... 8.000 \n", "105088 CC(C[C@@H](C(=O)N1C=CC[C@H]1C(=O)N)NC(=O)[C@@H... 8.000 \n", "105106 ONC(=O)CC1(CCOCC1)S(=O)(=O)c1ccc(cc1)Oc1ccccc1 0.023 \n", "105124 O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... 125.000 \n", "105138 CC[Se]C(=N)N 0.039 \n", "\n", "[7588 rows x 12 columns]" ] }, "execution_count": 101, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_affinity[~df_affinity['affinity_uM'].isnull()]" ] }, { "cell_type": "code", "execution_count": 102, "id": "2b483565-3c99-4c42-b2a9-f7b97cd8e80e", "metadata": {}, "outputs": [], "source": [ "df_affinity.to_parquet('data/biolip.parquet')" ] }, { "cell_type": "code", "execution_count": null, "id": "68dd5e45-b31d-492d-a47e-39072b67fa72", "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 }