{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "95bd761a-fe51-4a8e-bc70-1365260ba5f8", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "b0859483-5e19-4280-9f53-0d00a6f22d34", "metadata": {}, "outputs": [], "source": [ "df_pdbbind = pd.read_parquet('data/pdbbind.parquet')\n", "df_pdbbind = df_pdbbind[['seq','smiles','affinity_uM']]" ] }, { "cell_type": "code", "execution_count": 3, "id": "f30732b7-7444-47ad-84e7-566e7a6f2f8e", "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", "
seqsmilesaffinity_uM
0MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE...CCCCCCCCCCCCCCCCCCCC(=O)O0.026
1APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE...OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]...500.000
2VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE...COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)...0.023
3AAPFDKSKNVAQSIDQLIGQTPALYLNKLNNTKAKVVLKMECENPM...OC[C@@H](C(=O)N[C@@H]([C@H](CC)C)C(=O)O)NC(=O)...6.430
4YITFRSFTAVLIAFFLTLVLSPSFINRLRKIQRKKYTPTMGGIVIL...CO[C@@H]1[C@H](O[C@H]([C@@H]1O)n1ccc(=O)[nH]c1...0.185
\n", "
" ], "text/plain": [ " seq \\\n", "0 MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE... \n", "1 APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... \n", "2 VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... \n", "3 AAPFDKSKNVAQSIDQLIGQTPALYLNKLNNTKAKVVLKMECENPM... \n", "4 YITFRSFTAVLIAFFLTLVLSPSFINRLRKIQRKKYTPTMGGIVIL... \n", "\n", " smiles affinity_uM \n", "0 CCCCCCCCCCCCCCCCCCCC(=O)O 0.026 \n", "1 OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]... 500.000 \n", "2 COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)... 0.023 \n", "3 OC[C@@H](C(=O)N[C@@H]([C@H](CC)C)C(=O)O)NC(=O)... 6.430 \n", "4 CO[C@@H]1[C@H](O[C@H]([C@@H]1O)n1ccc(=O)[nH]c1... 0.185 " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_pdbbind.head()" ] }, { "cell_type": "code", "execution_count": 4, "id": "2787b9fd-3d6f-4ae3-a3ad-d3539b72782b", "metadata": {}, "outputs": [], "source": [ "from rdkit import Chem\n", "from rdkit.Chem import MACCSkeys\n", "import numpy as np\n", "\n", "def get_maccs(smi):\n", " try:\n", " mol = Chem.MolFromSmiles(smi)\n", " arr = np.packbits([0 if c=='0' else 1 for c in MACCSkeys.GenMACCSKeys(mol).ToBitString()])\n", " return np.pad(arr,(0,3)).view(np.uint32)\n", " except Exception:\n", " pass" ] }, { "cell_type": "code", "execution_count": 5, "id": "d1abe1c8-ac66-4289-8964-367a5b18528d", "metadata": {}, "outputs": [], "source": [ "df_bindingdb = pd.read_parquet('data/bindingdb.parquet')\n", "df_bindingdb = df_bindingdb[['seq','Ligand SMILES','affinity_uM']].rename(columns={'Ligand SMILES': 'smiles'})" ] }, { "cell_type": "code", "execution_count": 6, "id": "988bab9c-5147-44e2-92ef-902eaf3c5a90", "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", "
seqsmilesaffinity_uM
0PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM...COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC10.00024
1PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM...O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn...0.00025
2PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM...O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=...0.00041
3PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM...OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@...0.00080
4PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM...OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H...0.00099
\n", "
" ], "text/plain": [ " seq \\\n", "0 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n", "1 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n", "2 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n", "3 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n", "4 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n", "\n", " smiles affinity_uM \n", "0 COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 0.00024 \n", "1 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... 0.00025 \n", "2 O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... 0.00041 \n", "3 OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... 0.00080 \n", "4 OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... 0.00099 " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_bindingdb.head()" ] }, { "cell_type": "code", "execution_count": 7, "id": "d7bfee2a-c4e6-48c9-b0c6-52f6a69c7453", "metadata": {}, "outputs": [], "source": [ "df_moad = pd.read_parquet('data/moad.parquet')\n", "df_moad = df_moad[['seq','smiles','affinity_uM']]" ] }, { "cell_type": "code", "execution_count": 8, "id": "25553199-1715-40fb-9260-427bdd6c3706", "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", "
seqsmilesaffinity_uM
0NYIVPGEYRVAEGEIEINAGREKTTIRVSNTGDRPIQVGSHIHFVE...NP(=O)(N)O0.000620
1NYIVPGEYRVAEGEIEINAGREKTTIRVSNTGDRPIQVGSHIHFVE...CC(=O)NO2.600000
2MEGMRRPTPTVYVGRVPIGGAHPIAVQSMTNTPTRDVEATTAQVLE...C#CCCOP(=O)(O)OP(=O)(O)O0.580000
3MEGMRRPTPTVYVGRVPIGGAHPIAVQSMTNTPTRDVEATTAQVLE...C#CCOP(=O)(O)OP(=O)(O)O0.770000
4MTDMSIKFELIDVPIPQGTNVIIGQAHFIKTVEDLYEALVTSVPGV...c1nc(c2c(n1)n(cn2)[C@H]3[C@@H]([C@@H]([C@H](O3...15.000000
............
25420MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG...None127.226463
25421MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG...None127.226463
25422MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG...None169.204738
25423MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG...None169.204738
25424MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG...None169.204738
\n", "

25425 rows × 3 columns

\n", "
" ], "text/plain": [ " seq \\\n", "0 NYIVPGEYRVAEGEIEINAGREKTTIRVSNTGDRPIQVGSHIHFVE... \n", "1 NYIVPGEYRVAEGEIEINAGREKTTIRVSNTGDRPIQVGSHIHFVE... \n", "2 MEGMRRPTPTVYVGRVPIGGAHPIAVQSMTNTPTRDVEATTAQVLE... \n", "3 MEGMRRPTPTVYVGRVPIGGAHPIAVQSMTNTPTRDVEATTAQVLE... \n", "4 MTDMSIKFELIDVPIPQGTNVIIGQAHFIKTVEDLYEALVTSVPGV... \n", "... ... \n", "25420 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n", "25421 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n", "25422 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n", "25423 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n", "25424 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n", "\n", " smiles affinity_uM \n", "0 NP(=O)(N)O 0.000620 \n", "1 CC(=O)NO 2.600000 \n", "2 C#CCCOP(=O)(O)OP(=O)(O)O 0.580000 \n", "3 C#CCOP(=O)(O)OP(=O)(O)O 0.770000 \n", "4 c1nc(c2c(n1)n(cn2)[C@H]3[C@@H]([C@@H]([C@H](O3... 15.000000 \n", "... ... ... \n", "25420 None 127.226463 \n", "25421 None 127.226463 \n", "25422 None 169.204738 \n", "25423 None 169.204738 \n", "25424 None 169.204738 \n", "\n", "[25425 rows x 3 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_moad" ] }, { "cell_type": "code", "execution_count": 9, "id": "b2c936bc-cdc8-4bc1-b92d-f8755fd65f0a", "metadata": {}, "outputs": [], "source": [ "df_biolip = pd.read_parquet('data/biolip.parquet')\n", "df_biolip = df_biolip[['seq','smiles','affinity_uM']]" ] }, { "cell_type": "code", "execution_count": 10, "id": "cee93018-601d-458b-af44-bd978da7a2bc", "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", "
seqsmilesaffinity_uM
38PYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKASC...CC[C@H](C(=O)c1ccc(c(c1Cl)Cl)OCC(=O)O)C1.5000
43MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA...OC(=O)c1cc(/N=N/c2ccc(cc2)S(=O)(=O)Nc2ccccn2)c...24.0000
53EKKSINECDLKGKKVLIRVDFNVPVKNGKITNDYRIRSALPTLKKV...O[C@@H]1[C@@H](CO[P@](=O)(O[P@@](=O)(C(CCCC(P(...6.0000
54MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA...CCCCCCSC[C@@H](C(=O)NCC(=O)O)NC(=O)CC[C@@H](C(...10.0000
55MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL...c1ccccc1175.0000
............
105118PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM...O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=...0.0045
105119PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM...O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=...0.0045
105124SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV...O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O...125.0000
105133ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI...CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]...2.0000
105138KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR...CC[Se]C(=N)N0.0390
\n", "

13645 rows × 3 columns

\n", "
" ], "text/plain": [ " 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", " 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", "[13645 rows x 3 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_biolip" ] }, { "cell_type": "code", "execution_count": 11, "id": "195f92db-fe06-4d03-8500-8d6c310a3347", "metadata": {}, "outputs": [], "source": [ "df_all = pd.concat([df_pdbbind,df_bindingdb,df_moad,df_biolip]).reset_index()" ] }, { "cell_type": "code", "execution_count": 12, "id": "d25c1e24-6566-4944-a0b4-944b3c8dbc6f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2283641" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_all)" ] }, { "cell_type": "code", "execution_count": 13, "id": "c8287da2-cfdf-4d89-b175-f4c6b38ff8ac", "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()" ] }, { "cell_type": "code", "execution_count": null, "id": "de5ffc4a-afb7-4a26-8d57-509c2278d750", "metadata": {}, "outputs": [], "source": [ "df_all['maccs'] = df_all['smiles'].parallel_apply(get_maccs)" ] }, { "cell_type": "code", "execution_count": 16, "id": "59a6706d-dab9-4ee0-8ef6-33537a3622a4", "metadata": {}, "outputs": [], "source": [ "df_all.to_parquet('data/all_maccs.parquet')" ] }, { "cell_type": "code", "execution_count": 17, "id": "4ccf2ee5-d369-4c0e-bb91-792765d661bf", "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "code", "execution_count": 18, "id": "399f4ace-6dc3-441f-972a-f7b3a103e239", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2283641" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_all)" ] }, { "cell_type": "code", "execution_count": 19, "id": "8a4bbb18-e62f-4774-ac6b-8a1be68204c1", "metadata": {}, "outputs": [], "source": [ "df_all = pd.read_parquet('data/all_maccs.parquet')\n", "df_all = df_all.dropna().reset_index(drop=True)" ] }, { "cell_type": "code", "execution_count": 25, "id": "d210fe56-a7eb-4adc-a77a-14c0c6d0034e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2277323" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_all)" ] }, { "cell_type": "code", "execution_count": 26, "id": "d12b365d-98bd-4b61-b836-1a08d2e55418", "metadata": {}, "outputs": [], "source": [ "maccs = df_all['maccs'].to_numpy()\n", "#df_reindex[df_reindex.duplicated(keep='first')].reset_index()" ] }, { "cell_type": "code", "execution_count": 27, "id": "80c15210-1af3-436e-970b-f81fc596fb41", "metadata": {}, "outputs": [], "source": [ "df_maccs = pd.DataFrame(np.vstack(maccs))" ] }, { "cell_type": "code", "execution_count": 28, "id": "30c314b8-8fe7-48ae-a2b8-149de1471b0c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 int64\n", "1 int64\n", "2 int64\n", "3 int64\n", "4 int64\n", "5 int64\n", "dtype: object" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_maccs.dtypes" ] }, { "cell_type": "code", "execution_count": 29, "id": "70a0a820-4d0c-4472-af96-9c301c0ab204", "metadata": {}, "outputs": [], "source": [ "df_expand = pd.concat([df_all[['seq','smiles','affinity_uM']],df_maccs],axis=1)" ] }, { "cell_type": "code", "execution_count": 30, "id": "13d092fa-5625-40d0-b7ec-e3405ea20279", "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", "
seqsmilesaffinity_uM012345
0MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE...CCCCCCCCCCCCCCCCCCCC(=O)O0.026000805306368272271360890245320136
1APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE...OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]...500.00002147483648324259020819147325479941167063748288829124
2VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE...COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)...0.02301310721109655552212337696134773408822951175957252
3AAPFDKSKNVAQSIDQLIGQTPALYLNKLNNTKAKVVLKMECENPM...OC[C@@H](C(=O)N[C@@H]([C@H](CC)C)C(=O)O)NC(=O)...6.430006685696203319168013457018442133187096220
4YITFRSFTAVLIAFFLTLVLSPSFINRLRKIQRKKYTPTMGGIVIL...CO[C@@H]1[C@H](O[C@H]([C@@H]1O)n1ccc(=O)[nH]c1...0.185010485761107427332210951302440814929844026260436252
..............................
2277318PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM...O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=...0.0045655363932169646983683694036484284858000252
2277319PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM...O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=...0.0045655363932169646983683694036484284858000252
2277320SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV...O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O...125.0000671088641115688962177186950840184317183744193341124
2277321ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI...CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]...2.0000209715213721695814886817463079782067783280204
2277322KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR...CC[Se]C(=N)N0.039016614453739673621708801510015504192
\n", "

2277323 rows × 9 columns

\n", "
" ], "text/plain": [ " seq \\\n", "0 MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE... \n", "1 APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... \n", "2 VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... \n", "3 AAPFDKSKNVAQSIDQLIGQTPALYLNKLNNTKAKVVLKMECENPM... \n", "4 YITFRSFTAVLIAFFLTLVLSPSFINRLRKIQRKKYTPTMGGIVIL... \n", "... ... \n", "2277318 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... \n", "2277319 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... \n", "2277320 SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... \n", "2277321 ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI... \n", "2277322 KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... \n", "\n", " smiles affinity_uM \\\n", "0 CCCCCCCCCCCCCCCCCCCC(=O)O 0.0260 \n", "1 OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]... 500.0000 \n", "2 COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)... 0.0230 \n", "3 OC[C@@H](C(=O)N[C@@H]([C@H](CC)C)C(=O)O)NC(=O)... 6.4300 \n", "4 CO[C@@H]1[C@H](O[C@H]([C@@H]1O)n1ccc(=O)[nH]c1... 0.1850 \n", "... ... ... \n", "2277318 O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... 0.0045 \n", "2277319 O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... 0.0045 \n", "2277320 O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... 125.0000 \n", "2277321 CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]... 2.0000 \n", "2277322 CC[Se]C(=N)N 0.0390 \n", "\n", " 0 1 2 3 4 5 \n", "0 0 0 805306368 272271360 890245320 136 \n", "1 2147483648 3242590208 1914732547 994116706 3748288829 124 \n", "2 131072 1109655552 2123376961 3477340882 2951175957 252 \n", "3 0 6685696 2033191680 1345701844 2133187096 220 \n", "4 1048576 1107427332 2109513024 4081492984 4026260436 252 \n", "... ... ... ... ... ... ... \n", "2277318 65536 393216 964698368 369403648 4284858000 252 \n", "2277319 65536 393216 964698368 369403648 4284858000 252 \n", "2277320 67108864 1115688962 1771869508 4018431718 3744193341 124 \n", "2277321 2097152 137216 958148868 1746307978 2067783280 204 \n", "2277322 16 6144 537396736 2170880 1510015504 192 \n", "\n", "[2277323 rows x 9 columns]" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_expand" ] }, { "cell_type": "code", "execution_count": 31, "id": "30f7fff7-3cfe-41c8-97c9-666f3e256222", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['seq', 'smiles', 'affinity_uM', 0, 1, 2, 3, 4, 5], dtype='object')" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_expand.columns" ] }, { "cell_type": "code", "execution_count": 32, "id": "16d2b26e-984f-4c71-af19-a3e711ed9ca2", "metadata": {}, "outputs": [], "source": [ "df_reindex = df_expand.set_index([0,1,2,3,4,5,'seq'])" ] }, { "cell_type": "code", "execution_count": 33, "id": "27fa2150-8152-444b-ba5b-24bea39fc098", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['smiles', 'affinity_uM'], dtype='object')" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_reindex.columns" ] }, { "cell_type": "code", "execution_count": 34, "id": "89edacbc-52f3-4a76-90b0-95273f5e53b3", "metadata": {}, "outputs": [], "source": [ "df_nr = df_reindex[~df_reindex.duplicated(keep='first')].reset_index()\n", "df_nr = df_nr.drop(columns=[0,1,2,3,4,5])" ] }, { "cell_type": "code", "execution_count": 36, "id": "6a704c5e-68a6-418f-bcad-8688a13ca1d6", "metadata": {}, "outputs": [], "source": [ "# final sanity checks" ] }, { "cell_type": "code", "execution_count": 37, "id": "0cad3882-975d-4693-aad1-63ec26646bd0", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/ccs/proj/stf006/glaser/conda-envs/dask/lib/python3.9/site-packages/pandas/core/arraylike.py:358: RuntimeWarning: divide by zero encountered in log\n", " result = getattr(ufunc, method)(*inputs, **kwargs)\n" ] } ], "source": [ "df_nr['neg_log10_affinity_M'] = 6-np.log(df_nr['affinity_uM'])/np.log(10)" ] }, { "cell_type": "code", "execution_count": 38, "id": "c200e29a-3f14-41f4-b620-ccce0eb0d5ce", "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", "
seqsmilesaffinity_uMneg_log10_affinity_M
0MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE...CCCCCCCCCCCCCCCCCCCC(=O)O0.02607.585027
1APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE...OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]...500.00003.301030
2VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE...COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)...0.02307.638272
3AAPFDKSKNVAQSIDQLIGQTPALYLNKLNNTKAKVVLKMECENPM...OC[C@@H](C(=O)N[C@@H]([C@H](CC)C)C(=O)O)NC(=O)...6.43005.191789
4YITFRSFTAVLIAFFLTLVLSPSFINRLRKIQRKKYTPTMGGIVIL...CO[C@@H]1[C@H](O[C@H]([C@@H]1O)n1ccc(=O)[nH]c1...0.18506.732828
...............
1838495IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL...O=C[C@@H](NC(=O)[C@H](Cc1ccc(cc1)OS(O)(O)O)NC(...8.00005.096910
1838496IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL...CC(C[C@@H](C(=O)N1C=CC[C@H]1C(=O)N)NC(=O)[C@@H...8.00005.096910
1838497PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM...O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=...0.00458.346787
1838498ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI...CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]...2.00005.698970
1838499KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR...CC[Se]C(=N)N0.03907.408935
\n", "

1838500 rows × 4 columns

\n", "
" ], "text/plain": [ " seq \\\n", "0 MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE... \n", "1 APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... \n", "2 VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... \n", "3 AAPFDKSKNVAQSIDQLIGQTPALYLNKLNNTKAKVVLKMECENPM... \n", "4 YITFRSFTAVLIAFFLTLVLSPSFINRLRKIQRKKYTPTMGGIVIL... \n", "... ... \n", "1838495 IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... \n", "1838496 IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... \n", "1838497 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... \n", "1838498 ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI... \n", "1838499 KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... \n", "\n", " smiles affinity_uM \\\n", "0 CCCCCCCCCCCCCCCCCCCC(=O)O 0.0260 \n", "1 OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]... 500.0000 \n", "2 COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)... 0.0230 \n", "3 OC[C@@H](C(=O)N[C@@H]([C@H](CC)C)C(=O)O)NC(=O)... 6.4300 \n", "4 CO[C@@H]1[C@H](O[C@H]([C@@H]1O)n1ccc(=O)[nH]c1... 0.1850 \n", "... ... ... \n", "1838495 O=C[C@@H](NC(=O)[C@H](Cc1ccc(cc1)OS(O)(O)O)NC(... 8.0000 \n", "1838496 CC(C[C@@H](C(=O)N1C=CC[C@H]1C(=O)N)NC(=O)[C@@H... 8.0000 \n", "1838497 O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... 0.0045 \n", "1838498 CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]... 2.0000 \n", "1838499 CC[Se]C(=N)N 0.0390 \n", "\n", " neg_log10_affinity_M \n", "0 7.585027 \n", "1 3.301030 \n", "2 7.638272 \n", "3 5.191789 \n", "4 6.732828 \n", "... ... \n", "1838495 5.096910 \n", "1838496 5.096910 \n", "1838497 8.346787 \n", "1838498 5.698970 \n", "1838499 7.408935 \n", "\n", "[1838500 rows x 4 columns]" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_nr" ] }, { "cell_type": "code", "execution_count": 52, "id": "7f4027a2-0a5f-47bf-8a34-0c6a73b9b112", "metadata": {}, "outputs": [], "source": [ "df = df_nr[np.isfinite(df_nr['neg_log10_affinity_M'])].copy()" ] }, { "cell_type": "code", "execution_count": 53, "id": "eb99774f-9bcc-454d-b5e5-a8470223d6ca", "metadata": {}, "outputs": [], "source": [ "from rdkit import Chem\n", "def make_canonical(smi):\n", " try:\n", " return Chem.MolToSmiles(Chem.MolFromSmiles(smi))\n", " except:\n", " return smi" ] }, { "cell_type": "code", "execution_count": 54, "id": "4d44bd8e-f2e1-44b4-aea7-40b4437baf44", "metadata": {}, "outputs": [], "source": [ "df['smiles_can'] = df['smiles'].parallel_apply(make_canonical)" ] }, { "cell_type": "code", "execution_count": 55, "id": "07ffdeb1-f4fa-4776-9fea-a18439e03d2e", "metadata": {}, "outputs": [], "source": [ "df = df[(df['neg_log10_affinity_M']>0) & (df['neg_log10_affinity_M']<15)].reset_index()" ] }, { "cell_type": "code", "execution_count": 56, "id": "8f949038-d07d-4d3a-a47e-b825cc9018ca", "metadata": {}, "outputs": [], "source": [ "from sklearn.preprocessing import StandardScaler" ] }, { "cell_type": "code", "execution_count": 57, "id": "0c027988-0b44-4010-ad61-7d70eead1654", "metadata": {}, "outputs": [], "source": [ "scaler = StandardScaler()" ] }, { "cell_type": "code", "execution_count": 58, "id": "6aeba020-b6ff-4633-902e-4df74463eb2f", "metadata": {}, "outputs": [], "source": [ "df['affinity'] = scaler.fit_transform(df['neg_log10_affinity_M'].values.reshape(-1,1))" ] }, { "cell_type": "code", "execution_count": 59, "id": "91196eee-5fd0-4aa4-927a-5c1a3f436ac8", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(array([6.50604534]), array([2.43319576]))" ] }, "execution_count": 59, "metadata": {}, "output_type": "execute_result" } ], "source": [ "scaler.mean_, scaler.var_" ] }, { "cell_type": "code", "execution_count": 60, "id": "56269dcb-e691-4759-949d-7bfdd02f5fd4", "metadata": {}, "outputs": [], "source": [ "df = df.drop(columns='index')" ] }, { "cell_type": "code", "execution_count": 7, "id": "c6c64066-4032-4247-a8b9-00388176cc7b", "metadata": {}, "outputs": [], "source": [ "df = df.astype({'affinity_uM': 'float32', 'neg_log10_affinity_M': 'float32', 'affinity': 'float32'})\n", "df.to_parquet('data/all.parquet')\n", "\n", "#df = pd.read_parquet('data/all.parquet')" ] }, { "cell_type": "code", "execution_count": 14, "id": "469cf0dd-7b87-4245-973c-2a445e1fcca9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['seq', 'smiles', 'affinity_uM', 'neg_log10_affinity_M', 'smiles_can',\n", " 'affinity'],\n", " dtype='object')" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.columns" ] }, { "cell_type": "code", "execution_count": 63, "id": "d91c0d91-474c-4ab2-9a5e-3b7861f7a832", "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEPCAYAAAC+35gCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAfwElEQVR4nO3dfZwcVZ3v8c+XRC4xURCRQRIgqGFd1oiaEVC4MqPiDeg1uOIKRiBgjFEj4gXXKC6Cyl18Ka5PYMwiRhQcd0Uw10SQBUf0ArshPjCAgDGJOgkQeTAyIYKR3/5RNaHodM9U9fRU10y+79erX91V55zq3zz++pyqOkcRgZmZWR67tDsAMzMbO5w0zMwsNycNMzPLzUnDzMxyc9IwM7PcJrY7gNG21157xfTp05tqu2XLFiZPntzagFqo6v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W7DdO2qIdqth9r9j0iYiPJgkkL011vIfl+fqWJYz0CXE0yRHUyyYqSVV0f3kbAw1PWLqtJxtmH8zDJGu31lr3cB3gwff0ASeLZu069DpJV8IDtixtRmwskPQc4nCShEBHXpXVmAbcOEeMJJJ/OP5k51pQh6lfJxSQn4WeRDE39JCKaXcHwMpKe0C6kvRcbf9zTsLaIiEci4tbso0G9LSQJ5i3pEBQAkg4gWS/7x2m9v5L8Y39ztmeQ/jM8MGdY+wMb0/W4B/2W4Yd/ns6OPaUiJ5JH22PApHoFEXEDyQqVnyVZEXIkK9pdB/wbsKSCq11ai7inYWPBP5F8gv2+pItJrp46D9gMXJip9zHgh8BVkpaSDFmdSzKM1exQyXBDUwDXAKekJ93XkAxNvbLJ9xsNdwJ7Sno3SWL9c0T0ZcqXAJ8n6a01fYlsmrjdwxjn3NOwyouIa0jOFexB+kmW5NPxkem4/GC960hOwv4tyeWeHyK5uuo+kgQznN8B+0p6WmbfAWSGthp4H8llvueTXHX0DKr1z/MSoIdkDfT/Av5fTfm/p8/LIuKxMgOzscdrhNu4Jmkayaf/8yPiEzVlvcDnIuLqzL7rgZ6I+Nf0vo+LgYNiHP+hSHonycnvgyJiTU3ZMqALeAEQaW9iJO8lkpv+vgq8JiKmjeR4Vj73NGzckDQpvRP7zZKOknQqyTj7oySftgfrfTSdLO8VwCWS+iUNnmhfCJwq6R7g08Dc8ZowJB0safAGwatrE0bGASTnbFpxCe3Z6bFObsGxrA3c07BxQ9KuJMNDhwPPBraQ3C/xkYi4vZ2xVVHa03olyWSJb8sO9WXqTCc5NwTwSETcPcL3fC4wNd18PCJuG8nxrHxOGmZmlpuHp8zMLDcnDTMzy81Jw8zMcnPSMDOz3Jw0zMwsNycNMzPLzUnDzMxy+29GVQvyP63mDAAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "ax = df['neg_log10_affinity_M'].hist(bins=100,density=True)\n", "ax.set_xlabel('-$\\log_{10}$ affinity[M]',fontsize=16)\n", "ax.set_ylabel('probability',fontsize=16)\n", "ax.figure.savefig('affinity_neglog10_M.pdf')" ] }, { "cell_type": "code", "execution_count": 64, "id": "0e895ef5-1812-46c7-a4c2-dd6619b49157", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1836729" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df)" ] }, { "cell_type": "code", "execution_count": 65, "id": "3af855d3-a943-4574-985c-540d3f6b6f80", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'with_mean': True,\n", " 'with_std': True,\n", " 'copy': True,\n", " 'n_features_in_': 1,\n", " 'n_samples_seen_': 1836729,\n", " 'mean_': array([6.50604534]),\n", " 'var_': array([2.43319576]),\n", " 'scale_': array([1.55987043])}" ] }, "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ "scaler.__dict__" ] }, { "cell_type": "code", "execution_count": 66, "id": "15f8d5b9-37d5-453e-a6df-df6510cc5c81", "metadata": {}, "outputs": [], "source": [ "# output the normalization\n", "\n", "import json\n", "\n", "class NumpyEncoder(json.JSONEncoder):\n", " def default(self, obj):\n", " if isinstance(obj, np.ndarray):\n", " return obj.tolist()\n", " if isinstance(obj, np.int64):\n", " return int(obj)\n", " return json.JSONEncoder.default(self, obj)\n", " \n", "json.dump(scaler.__dict__,open('data/scaling.json','w'),cls=NumpyEncoder)" ] }, { "cell_type": "markdown", "id": "210b39d3-505b-4a6e-b186-35e660f4d510", "metadata": {}, "source": [ "**without KRAS**" ] }, { "cell_type": "code", "execution_count": 67, "id": "8dec95dc-a014-4d39-ae51-8de981173573", "metadata": {}, "outputs": [], "source": [ "smiles_sotorasib = 'C=CC(=O)N1CCN(c2nc(=O)n(-c3c(C)ccnc3C(C)C)c3nc(-c4c(O)cccc4F)c(F)cc23)[C@@H](C)C1'\n", "seq_kras_wt = 'MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAGQEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHHYREQIKRVKDSEDVPMVLVGNKCDLPSRTVDTKQAQDLARSYGIPFIETSAKTRQRVEDAFYTLVREIRQYRLKKISKEEKTPGCVKIKKCIIM'" ] }, { "cell_type": "code", "execution_count": 68, "id": "3f90eadd-d7e4-4104-961f-adaf5437e24b", "metadata": {}, "outputs": [], "source": [ "df_nokras = df[~df.seq.str.startswith(seq_kras_wt[:20])]" ] }, { "cell_type": "code", "execution_count": 69, "id": "f5f5335a-8f28-4058-8647-fcc8f7d2f841", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1836326" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_nokras)" ] }, { "cell_type": "code", "execution_count": 10, "id": "47966268-c97c-4bd9-9c90-eb568249f2ef", "metadata": {}, "outputs": [], "source": [ "#df_nokras = df_nokras.astype({'affinity_uM': 'float32', 'neg_log10_affinity_M': 'float32', 'affinity': 'float32'})\n", "#df_nokras.to_parquet('data/all_nokras.parquet')\n", "#df_nokras = pd.read_parquet('data/all_nokras.parquet')" ] }, { "cell_type": "markdown", "id": "4838f164-aed7-4f2d-a047-df647dfb8ea6", "metadata": {}, "source": [ "**with covalently binding ligands only**" ] }, { "cell_type": "code", "execution_count": 89, "id": "c0d250a3-5680-446c-9c98-7d6623643304", "metadata": {}, "outputs": [], "source": [ "from rdkit.Chem import SDMolSupplier\n", "suppl = SDMolSupplier('data/CovPDB_ligands.sdf')\n" ] }, { "cell_type": "code", "execution_count": 90, "id": "0c7c0b26-1f2a-4b80-8117-f1e02719aac9", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "RDKit WARNING: [13:44:45] Warning: molecule is tagged as 3D, but all Z coords are zero\n", "RDKit WARNING: [13:44:45] Warning: molecule is tagged as 3D, but all Z coords are zero\n", "RDKit WARNING: [13:44:45] Warning: molecule is tagged as 3D, but all Z coords are zero\n", "RDKit WARNING: [13:44:45] Warning: molecule is tagged as 3D, but all Z coords are zero\n", "RDKit WARNING: [13:44:45] Warning: molecule is tagged as 3D, but all Z coords are zero\n", "RDKit WARNING: [13:44:45] Warning: molecule is tagged as 3D, but all Z coords are zero\n", "RDKit WARNING: [13:44:45] Warning: molecule is tagged as 3D, but all Z coords are zero\n", "RDKit WARNING: [13:44:45] Warning: molecule is tagged as 3D, but all Z coords are zero\n" ] } ], "source": [ "from rdkit import Chem\n", "cov_smiles = [Chem.MolToSmiles(m) for m in suppl]" ] }, { "cell_type": "code", "execution_count": 74, "id": "258f593c-1cba-45cb-936e-8c1360075926", "metadata": {}, "outputs": [], "source": [ "df_cov = df[df['smiles'].isin(cov_smiles)]" ] }, { "cell_type": "code", "execution_count": 12, "id": "ee3fa0bc-9ad3-4ea7-9393-cbc7504f634c", "metadata": {}, "outputs": [], "source": [ "df_cov = df_cov.astype({'affinity_uM': 'float32', 'neg_log10_affinity_M': 'float32', 'affinity': 'float32'})\n", "#df_cov.reset_index(drop=True).to_parquet('data/cov.parquet')\n", "#df_cov = pd.read_parquet('data/cov.parquet')" ] }, { "cell_type": "code", "execution_count": 77, "id": "5c12fedc-4236-4587-a744-c0c9ec21ceaa", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "346" ] }, "execution_count": 77, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_cov)" ] }, { "cell_type": "code", "execution_count": 78, "id": "1b73cea5-e6d9-427f-a31e-7ab38b5e6e4e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2.703125" ] }, "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ "346/128" ] }, { "cell_type": "code", "execution_count": 80, "id": "2d1d2955-7839-45e0-9a11-07dda2d51b24", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 80, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBN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I9r/SCQ5VFXTXdexHtiLfvajn/3o10U/RjUscwK4asn0lcD3R7QvSdJZRhXu/wVck+TqJK8EbgEeHNG+JElnGcmwTFWdSfJh4F+Bi4DPVdWTo9jXmL2shpFGzF70sx/97Ee/sfdjJF+oSpK65RWqktQgw12SGmS4LyPJVUm+muRokieT3NF1TetBkouSPJ7koa5r6VqSjUkOJPlW7zh5W9c1dSXJx3rvkyeS3JfkVV3XNE5JPpfkdJInlsy7PMkjSY71HjeNoxbDfXlngF1V9QbgeuBD3koBgDuAo10XsU58GvhSVb0eeBMXaF+SbAE+CkxX1RtZ/DHFLd1WNXafB9591rzdwMGqugY42JseOcN9GVX1TFU91nv+UxbfuFu6rapbSa4EbgQ+23UtXUvyauAdwD0AVfXzqnqu06K6tQG4OMkG4BIusOtbquprwI/Pmr0d2Nd7vg+4aRy1GO6rkGQKeDPwaMeldO1vgb8C/q/jOtaD3wV+CPxDb5jqs0ku7bqoLlTVSeBvgKeBZ4Dnq+rL3Va1LkxW1TOweLII/PY4dmq4r1CSCeCLwF9U1U+6rqcrSd4DnK6qw13Xsk5sAN4C/H1VvRl4gTF97F5vemPJ24GrgdcClyZ5f7dVXbgM9xVI8goWg/3eqrq/63o6dgPw3iTHWbzb5x8l+UK3JXXqBHCiqn75ae4Ai2F/IXon8N2q+mFV/QK4H3h7xzWtB6eSbAboPZ4ex04N92UkCYvjqUer6lNd19O1qvpEVV1ZVVMsfln2laq6YM/OquoHwPeSvK43axvwzQ5L6tLTwPVJLum9b7ZxgX65fJYHgR295zuAB8axU/+D7OXdAHwAOJLkG715n6yqf+6uJK0zHwHu7d1H6TvABzuupxNV9WiSA8BjLP7K7HEusNsQJLkPmAGuSHICuBPYA+xPcjuLfwBvHkst3n5AktrjsIwkNchwl6QGGe6S1CDDXZIaZLhLUoMMd0lqkOEuSQ36fwQ+77qgfKxkAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "df_cov['neg_log10_affinity_M'].hist()" ] }, { "cell_type": "code", "execution_count": 92, "id": "ab2e429b-d84c-42b7-b0dc-55e6728b9f81", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "167" ] }, "execution_count": 92, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_cov['seq'].unique())" ] }, { "cell_type": "code", "execution_count": 94, "id": "4d535b74-1a32-45ee-a61f-f0cca805ad9b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "49" ] }, "execution_count": 94, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_cov['smiles'].unique())" ] }, { "cell_type": "code", "execution_count": 96, "id": "f59aa644-f848-447f-b82a-cff5b0507738", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "346" ] }, "execution_count": 96, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df_cov)" ] }, { "cell_type": "code", "execution_count": null, "id": "b8af53a6-5203-4889-9c4b-31140da5fc5b", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.6" } }, "nbformat": 4, "nbformat_minor": 5 }