{
"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": 84,
"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": 85,
"id": "f30732b7-7444-47ad-84e7-566e7a6f2f8e",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" seq | \n",
" smiles | \n",
" affinity_uM | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE... | \n",
" CCCCCCCCCCCCCCCCCCC[C-](=O)=O | \n",
" 0.026 | \n",
"
\n",
" \n",
" 1 | \n",
" APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... | \n",
" OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]... | \n",
" 500.000 | \n",
"
\n",
" \n",
" 2 | \n",
" VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... | \n",
" COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)... | \n",
" 0.023 | \n",
"
\n",
" \n",
" 3 | \n",
" AAPFDKSKNVAQSIDQLIGQTPALYLNKLNNTKAKVVLKMECENPM... | \n",
" OC[C@@H](C(=O)N[C@@H]([C@H](CC)C)[C-](=O)=O)NC... | \n",
" 6.430 | \n",
"
\n",
" \n",
" 4 | \n",
" GSFVEMVDNLRGKSGQGYYVEMTVGSPPQTLNILVDTGSSNFAVGA... | \n",
" O=[C-](=O)[C@@H](NC1=NC(C)(C)Cc2c1cccc2)Cc1ccccc1 | \n",
" 27.200 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" seq \\\n",
"0 MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE... \n",
"1 APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... \n",
"2 VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... \n",
"3 AAPFDKSKNVAQSIDQLIGQTPALYLNKLNNTKAKVVLKMECENPM... \n",
"4 GSFVEMVDNLRGKSGQGYYVEMTVGSPPQTLNILVDTGSSNFAVGA... \n",
"\n",
" smiles affinity_uM \n",
"0 CCCCCCCCCCCCCCCCCCC[C-](=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... 6.430 \n",
"4 O=[C-](=O)[C@@H](NC1=NC(C)(C)Cc2c1cccc2)Cc1ccccc1 27.200 "
]
},
"execution_count": 85,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_pdbbind.head()"
]
},
{
"cell_type": "code",
"execution_count": 119,
"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": 120,
"id": "84f522d5-aee8-4d0f-9186-2d90bfc62342",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" seq | \n",
" smiles | \n",
" affinity_uM | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 | \n",
" 0.00024 | \n",
"
\n",
" \n",
" 1 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... | \n",
" 0.00025 | \n",
"
\n",
" \n",
" 2 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... | \n",
" 0.00041 | \n",
"
\n",
" \n",
" 3 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... | \n",
" 0.00080 | \n",
"
\n",
" \n",
" 4 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... | \n",
" 0.00099 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 4453 | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" CC(C)C[C@H](NC(=O)N1CCC(CC1)C(=O)Nc1ccc(cc1)-c... | \n",
" 0.00940 | \n",
"
\n",
" \n",
" 4454 | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" CC(C)C[C@H](NC(=O)[C@H](Cc1ccccc1)NC(=O)c1cncc... | \n",
" 0.01100 | \n",
"
\n",
" \n",
" 4455 | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" CC(C)C[C@H](NC(=O)N1CCCC(C1)C(=O)Nc1cnccn1)C(=... | \n",
" 0.35500 | \n",
"
\n",
" \n",
" 4456 | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" COc1ccc(NC(=O)N2CCC(CC2)C(=O)N[C@@H](CC(C)C)C(... | \n",
" 0.01700 | \n",
"
\n",
" \n",
" 4457 | \n",
" MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... | \n",
" CC(C)C[C@H](NC(=O)C1CCN(CC1)C(=O)Nc1cnccn1)C(=... | \n",
" 0.07600 | \n",
"
\n",
" \n",
"
\n",
"
2389700 rows × 3 columns
\n",
"
"
],
"text/plain": [
" seq \\\n",
"0 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"1 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"2 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"3 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"4 PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... \n",
"... ... \n",
"4453 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... \n",
"4454 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... \n",
"4455 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... \n",
"4456 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... \n",
"4457 MSYDRAITVFSPDGHLFQVEYAQEAVKKGSTAVGVRGRDIVVLGVE... \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 \n",
"... ... ... \n",
"4453 CC(C)C[C@H](NC(=O)N1CCC(CC1)C(=O)Nc1ccc(cc1)-c... 0.00940 \n",
"4454 CC(C)C[C@H](NC(=O)[C@H](Cc1ccccc1)NC(=O)c1cncc... 0.01100 \n",
"4455 CC(C)C[C@H](NC(=O)N1CCCC(C1)C(=O)Nc1cnccn1)C(=... 0.35500 \n",
"4456 COc1ccc(NC(=O)N2CCC(CC2)C(=O)N[C@@H](CC(C)C)C(... 0.01700 \n",
"4457 CC(C)C[C@H](NC(=O)C1CCN(CC1)C(=O)Nc1cnccn1)C(=... 0.07600 \n",
"\n",
"[2389700 rows x 3 columns]"
]
},
"execution_count": 120,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_bindingdb"
]
},
{
"cell_type": "code",
"execution_count": 88,
"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": 89,
"id": "988bab9c-5147-44e2-92ef-902eaf3c5a90",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" seq | \n",
" smiles | \n",
" affinity_uM | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" COc1cc2c(Nc3ccc(Br)cc3F)ncnc2cc1OCC1CCN(C)CC1 | \n",
" 0.00024 | \n",
"
\n",
" \n",
" 1 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(C\\C=C\\c2cn... | \n",
" 0.00025 | \n",
"
\n",
" \n",
" 2 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" O[C@@H]1[C@@H](O)[C@@H](Cc2ccccc2)N(CC2CC2)C(=... | \n",
" 0.00041 | \n",
"
\n",
" \n",
" 3 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" OCCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@... | \n",
" 0.00080 | \n",
"
\n",
" \n",
" 4 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n",
" OCCCCCN1[C@H](Cc2ccccc2)[C@H](O)[C@@H](O)[C@@H... | \n",
" 0.00099 | \n",
"
\n",
" \n",
"
\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": 89,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_bindingdb.head()"
]
},
{
"cell_type": "code",
"execution_count": 93,
"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": 94,
"id": "25553199-1715-40fb-9260-427bdd6c3706",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" seq | \n",
" smiles | \n",
" affinity_uM | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" NYIVPGEYRVAEGEIEINAGREKTTIRVSNTGDRPIQVGSHIHFVE... | \n",
" NP(=O)(N)O | \n",
" 0.000620 | \n",
"
\n",
" \n",
" 2 | \n",
" NYIVPGEYRVAEGEIEINAGREKTTIRVSNTGDRPIQVGSHIHFVE... | \n",
" CC(=O)NO | \n",
" 2.600000 | \n",
"
\n",
" \n",
" 7 | \n",
" MEGMRRPTPTVYVGRVPIGGAHPIAVQSMTNTPTRDVEATTAQVLE... | \n",
" C#CCCOP(=O)(O)OP(=O)(O)O | \n",
" 0.580000 | \n",
"
\n",
" \n",
" 16 | \n",
" MEGMRRPTPTVYVGRVPIGGAHPIAVQSMTNTPTRDVEATTAQVLE... | \n",
" C#CCOP(=O)(O)OP(=O)(O)O | \n",
" 0.770000 | \n",
"
\n",
" \n",
" 17 | \n",
" MTDMSIKFELIDVPIPQGTNVIIGQAHFIKTVEDLYEALVTSVPGV... | \n",
" c1nc(c2c(n1)n(cn2)[C@H]3[C@@H]([C@@H]([C@H](O3... | \n",
" 15.000000 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 51900 | \n",
" MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... | \n",
" None | \n",
" 127.226463 | \n",
"
\n",
" \n",
" 51901 | \n",
" MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... | \n",
" None | \n",
" 127.226463 | \n",
"
\n",
" \n",
" 51902 | \n",
" MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... | \n",
" None | \n",
" 169.204738 | \n",
"
\n",
" \n",
" 51903 | \n",
" MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... | \n",
" None | \n",
" 169.204738 | \n",
"
\n",
" \n",
" 51904 | \n",
" MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... | \n",
" None | \n",
" 169.204738 | \n",
"
\n",
" \n",
"
\n",
"
25425 rows × 3 columns
\n",
"
"
],
"text/plain": [
" seq \\\n",
"0 NYIVPGEYRVAEGEIEINAGREKTTIRVSNTGDRPIQVGSHIHFVE... \n",
"2 NYIVPGEYRVAEGEIEINAGREKTTIRVSNTGDRPIQVGSHIHFVE... \n",
"7 MEGMRRPTPTVYVGRVPIGGAHPIAVQSMTNTPTRDVEATTAQVLE... \n",
"16 MEGMRRPTPTVYVGRVPIGGAHPIAVQSMTNTPTRDVEATTAQVLE... \n",
"17 MTDMSIKFELIDVPIPQGTNVIIGQAHFIKTVEDLYEALVTSVPGV... \n",
"... ... \n",
"51900 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n",
"51901 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n",
"51902 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n",
"51903 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n",
"51904 MGSSHHHHHHSSGLVPRGSHMASNPSLIRSESWQVYEGNEANLLDG... \n",
"\n",
" smiles affinity_uM \n",
"0 NP(=O)(N)O 0.000620 \n",
"2 CC(=O)NO 2.600000 \n",
"7 C#CCCOP(=O)(O)OP(=O)(O)O 0.580000 \n",
"16 C#CCOP(=O)(O)OP(=O)(O)O 0.770000 \n",
"17 c1nc(c2c(n1)n(cn2)[C@H]3[C@@H]([C@@H]([C@H](O3... 15.000000 \n",
"... ... ... \n",
"51900 None 127.226463 \n",
"51901 None 127.226463 \n",
"51902 None 169.204738 \n",
"51903 None 169.204738 \n",
"51904 None 169.204738 \n",
"\n",
"[25425 rows x 3 columns]"
]
},
"execution_count": 94,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_moad"
]
},
{
"cell_type": "code",
"execution_count": 97,
"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": 98,
"id": "cee93018-601d-458b-af44-bd978da7a2bc",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" seq | \n",
" smiles | \n",
" affinity_uM | \n",
"
\n",
" \n",
" \n",
" \n",
" 38 | \n",
" PYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKASC... | \n",
" CC[C@H](C(=O)c1ccc(c(c1Cl)Cl)OCC(=O)O)C | \n",
" 1.500 | \n",
"
\n",
" \n",
" 43 | \n",
" MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA... | \n",
" OC(=O)c1cc(/N=N/c2ccc(cc2)S(=O)(=O)Nc2ccccn2)c... | \n",
" 24.000 | \n",
"
\n",
" \n",
" 53 | \n",
" EKKSINECDLKGKKVLIRVDFNVPVKNGKITNDYRIRSALPTLKKV... | \n",
" O[C@@H]1[C@@H](CO[P@](=O)(O[P@@](=O)(C(CCCC(P(... | \n",
" NaN | \n",
"
\n",
" \n",
" 54 | \n",
" MPPYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKA... | \n",
" CCCCCCSC[C@@H](C(=O)NCC(=O)O)NC(=O)CC[C@@H](C(... | \n",
" 10.000 | \n",
"
\n",
" \n",
" 55 | \n",
" MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... | \n",
" c1ccccc1 | \n",
" 175.000 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 105118 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... | \n",
" O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... | \n",
" NaN | \n",
"
\n",
" \n",
" 105119 | \n",
" PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMNLPGRWKPKM... | \n",
" O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... | \n",
" NaN | \n",
"
\n",
" \n",
" 105124 | \n",
" SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... | \n",
" O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... | \n",
" 125.000 | \n",
"
\n",
" \n",
" 105133 | \n",
" ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI... | \n",
" CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]... | \n",
" NaN | \n",
"
\n",
" \n",
" 105138 | \n",
" KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... | \n",
" CC[Se]C(=N)N | \n",
" 0.039 | \n",
"
\n",
" \n",
"
\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.500 \n",
"43 OC(=O)c1cc(/N=N/c2ccc(cc2)S(=O)(=O)Nc2ccccn2)c... 24.000 \n",
"53 O[C@@H]1[C@@H](CO[P@](=O)(O[P@@](=O)(C(CCCC(P(... NaN \n",
"54 CCCCCCSC[C@@H](C(=O)NCC(=O)O)NC(=O)CC[C@@H](C(... 10.000 \n",
"55 c1ccccc1 175.000 \n",
"... ... ... \n",
"105118 O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... NaN \n",
"105119 O[C@@H]([C@H](Cc1ccccc1)NC(=O)[C@H](C(C)C)NC(=... NaN \n",
"105124 O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... 125.000 \n",
"105133 CC(C[C@@H](B(O)O)NC(=O)[C@@H]1CCCN1C(=O)[C@@H]... NaN \n",
"105138 CC[Se]C(=N)N 0.039 \n",
"\n",
"[13645 rows x 3 columns]"
]
},
"execution_count": 98,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_biolip"
]
},
{
"cell_type": "code",
"execution_count": 134,
"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": 135,
"id": "d25c1e24-6566-4944-a0b4-944b3c8dbc6f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2446422"
]
},
"execution_count": 135,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(df_all)"
]
},
{
"cell_type": "code",
"execution_count": 105,
"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": 108,
"id": "59a6706d-dab9-4ee0-8ef6-33537a3622a4",
"metadata": {},
"outputs": [],
"source": [
"df_all.to_parquet('data/all_maccs.parquet')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "4ccf2ee5-d369-4c0e-bb91-792765d661bf",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 14,
"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": 15,
"id": "d210fe56-a7eb-4adc-a77a-14c0c6d0034e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2430135"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(df_all)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"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": 17,
"id": "80c15210-1af3-436e-970b-f81fc596fb41",
"metadata": {},
"outputs": [],
"source": [
"df_maccs = pd.DataFrame(np.vstack(maccs))"
]
},
{
"cell_type": "code",
"execution_count": 18,
"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": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_maccs.dtypes"
]
},
{
"cell_type": "code",
"execution_count": 19,
"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": 21,
"id": "13d092fa-5625-40d0-b7ec-e3405ea20279",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" seq | \n",
" smiles | \n",
" affinity_uM | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 3 | \n",
" 4 | \n",
" 5 | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... | \n",
" OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]... | \n",
" 500.000 | \n",
" 2147483648 | \n",
" 3242590208 | \n",
" 1914732547 | \n",
" 994116706 | \n",
" 3748288829 | \n",
" 124 | \n",
"
\n",
" \n",
" 1 | \n",
" VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... | \n",
" COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)... | \n",
" 0.023 | \n",
" 131072 | \n",
" 1109655552 | \n",
" 2123376961 | \n",
" 3477340882 | \n",
" 2951175957 | \n",
" 252 | \n",
"
\n",
" \n",
" 2 | \n",
" GMRVYLGADHAGYELKQRIIEHLKQTGHEPIDCGALRYDADDDYPA... | \n",
" O[C@H]1O[C@H](CO[P](=O)(=O)=O)[C@H]([C@H]([C@H... | \n",
" 6300.000 | \n",
" 67108864 | \n",
" 1082523648 | \n",
" 1879080960 | \n",
" 461382690 | \n",
" 3576355128 | \n",
" 28 | \n",
"
\n",
" \n",
" 3 | \n",
" SMENFQKVEKIGEGTYGVVYKARNKLTGEVVALKKIRLDTETEGVP... | \n",
" OCC[C@@H]1CCCCN1c1cc(NCC2=CC=CN(C2)O)n2c(n1)c(... | \n",
" 0.210 | \n",
" 2147484672 | \n",
" 36176898 | \n",
" 850664773 | \n",
" 3978479102 | \n",
" 1599828989 | \n",
" 252 | \n",
"
\n",
" \n",
" 4 | \n",
" EFSEWFHNILEEAEIIDQRYPVKGMHVWMPHGFMIRKNTLKILRRI... | \n",
" O[C@@H]1[C@@H](COS(=O)(=O)NC(=O)[C@@H]2CCC[NH2... | \n",
" 0.050 | \n",
" 0 | \n",
" 1858306115 | \n",
" 4223456596 | \n",
" 4018595822 | \n",
" 4282121085 | \n",
" 124 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 2430130 | \n",
" IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... | \n",
" O=C[C@@H](NC(=O)[C@H](Cc1ccc(cc1)OS(O)(O)O)NC(... | \n",
" 8.000 | \n",
" 0 | \n",
" 612865025 | \n",
" 3107729684 | \n",
" 2146870234 | \n",
" 4286578680 | \n",
" 252 | \n",
"
\n",
" \n",
" 2430131 | \n",
" IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... | \n",
" CC(C[C@@H](C(=O)N1C=CC[C@H]1C(=O)N)NC(=O)[C@@H... | \n",
" 8.000 | \n",
" 0 | \n",
" 136194 | \n",
" 1025390336 | \n",
" 1612680088 | \n",
" 2071973584 | \n",
" 252 | \n",
"
\n",
" \n",
" 2430132 | \n",
" RWEQTHLTYRIENYTPDLPRADVDHAIEKAFQLWSNVTPLTFTKVS... | \n",
" ONC(=O)CC1(CCOCC1)S(=O)(=O)c1ccc(cc1)Oc1ccccc1 | \n",
" 0.023 | \n",
" 2147483648 | \n",
" 2081488896 | \n",
" 3124936893 | \n",
" 264668962 | \n",
" 4286183928 | \n",
" 124 | \n",
"
\n",
" \n",
" 2430133 | \n",
" SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... | \n",
" O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... | \n",
" 125.000 | \n",
" 67108864 | \n",
" 1115688962 | \n",
" 1771869508 | \n",
" 4018431718 | \n",
" 3744193341 | \n",
" 124 | \n",
"
\n",
" \n",
" 2430134 | \n",
" KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... | \n",
" CC[Se]C(=N)N | \n",
" 0.039 | \n",
" 16 | \n",
" 6144 | \n",
" 537396736 | \n",
" 2170880 | \n",
" 1510015504 | \n",
" 192 | \n",
"
\n",
" \n",
"
\n",
"
2430135 rows × 9 columns
\n",
"
"
],
"text/plain": [
" seq \\\n",
"0 APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... \n",
"1 VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... \n",
"2 GMRVYLGADHAGYELKQRIIEHLKQTGHEPIDCGALRYDADDDYPA... \n",
"3 SMENFQKVEKIGEGTYGVVYKARNKLTGEVVALKKIRLDTETEGVP... \n",
"4 EFSEWFHNILEEAEIIDQRYPVKGMHVWMPHGFMIRKNTLKILRRI... \n",
"... ... \n",
"2430130 IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... \n",
"2430131 IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... \n",
"2430132 RWEQTHLTYRIENYTPDLPRADVDHAIEKAFQLWSNVTPLTFTKVS... \n",
"2430133 SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... \n",
"2430134 KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... \n",
"\n",
" smiles affinity_uM \\\n",
"0 OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]... 500.000 \n",
"1 COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)... 0.023 \n",
"2 O[C@H]1O[C@H](CO[P](=O)(=O)=O)[C@H]([C@H]([C@H... 6300.000 \n",
"3 OCC[C@@H]1CCCCN1c1cc(NCC2=CC=CN(C2)O)n2c(n1)c(... 0.210 \n",
"4 O[C@@H]1[C@@H](COS(=O)(=O)NC(=O)[C@@H]2CCC[NH2... 0.050 \n",
"... ... ... \n",
"2430130 O=C[C@@H](NC(=O)[C@H](Cc1ccc(cc1)OS(O)(O)O)NC(... 8.000 \n",
"2430131 CC(C[C@@H](C(=O)N1C=CC[C@H]1C(=O)N)NC(=O)[C@@H... 8.000 \n",
"2430132 ONC(=O)CC1(CCOCC1)S(=O)(=O)c1ccc(cc1)Oc1ccccc1 0.023 \n",
"2430133 O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... 125.000 \n",
"2430134 CC[Se]C(=N)N 0.039 \n",
"\n",
" 0 1 2 3 4 5 \n",
"0 2147483648 3242590208 1914732547 994116706 3748288829 124 \n",
"1 131072 1109655552 2123376961 3477340882 2951175957 252 \n",
"2 67108864 1082523648 1879080960 461382690 3576355128 28 \n",
"3 2147484672 36176898 850664773 3978479102 1599828989 252 \n",
"4 0 1858306115 4223456596 4018595822 4282121085 124 \n",
"... ... ... ... ... ... ... \n",
"2430130 0 612865025 3107729684 2146870234 4286578680 252 \n",
"2430131 0 136194 1025390336 1612680088 2071973584 252 \n",
"2430132 2147483648 2081488896 3124936893 264668962 4286183928 124 \n",
"2430133 67108864 1115688962 1771869508 4018431718 3744193341 124 \n",
"2430134 16 6144 537396736 2170880 1510015504 192 \n",
"\n",
"[2430135 rows x 9 columns]"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_expand"
]
},
{
"cell_type": "code",
"execution_count": 22,
"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": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_expand.columns"
]
},
{
"cell_type": "code",
"execution_count": 23,
"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": 24,
"id": "27fa2150-8152-444b-ba5b-24bea39fc098",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['smiles', 'affinity_uM'], dtype='object')"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_reindex.columns"
]
},
{
"cell_type": "code",
"execution_count": 67,
"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": 68,
"id": "6a704c5e-68a6-418f-bcad-8688a13ca1d6",
"metadata": {},
"outputs": [],
"source": [
"# final sanity checks"
]
},
{
"cell_type": "code",
"execution_count": 69,
"id": "0cad3882-975d-4693-aad1-63ec26646bd0",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/ccs/proj/stf006/glaser/conda-envs/bio/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": 70,
"id": "c200e29a-3f14-41f4-b620-ccce0eb0d5ce",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" seq | \n",
" smiles | \n",
" affinity_uM | \n",
" neg_log10_affinity_M | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... | \n",
" OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]... | \n",
" 500.000 | \n",
" 3.301030 | \n",
"
\n",
" \n",
" 1 | \n",
" VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... | \n",
" COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)... | \n",
" 0.023 | \n",
" 7.638272 | \n",
"
\n",
" \n",
" 2 | \n",
" GMRVYLGADHAGYELKQRIIEHLKQTGHEPIDCGALRYDADDDYPA... | \n",
" O[C@H]1O[C@H](CO[P](=O)(=O)=O)[C@H]([C@H]([C@H... | \n",
" 6300.000 | \n",
" 2.200659 | \n",
"
\n",
" \n",
" 3 | \n",
" SMENFQKVEKIGEGTYGVVYKARNKLTGEVVALKKIRLDTETEGVP... | \n",
" OCC[C@@H]1CCCCN1c1cc(NCC2=CC=CN(C2)O)n2c(n1)c(... | \n",
" 0.210 | \n",
" 6.677781 | \n",
"
\n",
" \n",
" 4 | \n",
" EFSEWFHNILEEAEIIDQRYPVKGMHVWMPHGFMIRKNTLKILRRI... | \n",
" O[C@@H]1[C@@H](COS(=O)(=O)NC(=O)[C@@H]2CCC[NH2... | \n",
" 0.050 | \n",
" 7.301030 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 1849400 | \n",
" KQISVRGLAGVENVTELKKNFNRHLHFTLVKDRNVATPRDYYFALA... | \n",
" O[C@@H]1[C@H](O)[C@H](O[C@H]1n1cnc2c1ncnc2N)CO... | \n",
" 250.000 | \n",
" 3.602060 | \n",
"
\n",
" \n",
" 1849401 | \n",
" IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... | \n",
" O=C[C@@H](NC(=O)[C@H](Cc1ccc(cc1)OS(O)(O)O)NC(... | \n",
" 8.000 | \n",
" 5.096910 | \n",
"
\n",
" \n",
" 1849402 | \n",
" IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... | \n",
" CC(C[C@@H](C(=O)N1C=CC[C@H]1C(=O)N)NC(=O)[C@@H... | \n",
" 8.000 | \n",
" 5.096910 | \n",
"
\n",
" \n",
" 1849403 | \n",
" SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... | \n",
" O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... | \n",
" 125.000 | \n",
" 3.903090 | \n",
"
\n",
" \n",
" 1849404 | \n",
" KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... | \n",
" CC[Se]C(=N)N | \n",
" 0.039 | \n",
" 7.408935 | \n",
"
\n",
" \n",
"
\n",
"
1849405 rows × 4 columns
\n",
"
"
],
"text/plain": [
" seq \\\n",
"0 APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... \n",
"1 VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... \n",
"2 GMRVYLGADHAGYELKQRIIEHLKQTGHEPIDCGALRYDADDDYPA... \n",
"3 SMENFQKVEKIGEGTYGVVYKARNKLTGEVVALKKIRLDTETEGVP... \n",
"4 EFSEWFHNILEEAEIIDQRYPVKGMHVWMPHGFMIRKNTLKILRRI... \n",
"... ... \n",
"1849400 KQISVRGLAGVENVTELKKNFNRHLHFTLVKDRNVATPRDYYFALA... \n",
"1849401 IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... \n",
"1849402 IVEGSDAEIGMSPWQVMLFRKSPQELLCGASLISDRWVLTAAHCLL... \n",
"1849403 SKVVVPAQGKKITLQNGKLNVPENPIIPYIEGDGIGVDVTPAMLKV... \n",
"1849404 KFPRVKNWELGSITYDTLCAQSQQDGPCTPRRCLGSLVLPRKLQTR... \n",
"\n",
" smiles affinity_uM \\\n",
"0 OC[C@H]1O[C@H](Oc2cccc(c2)N(=O)=O)[C@@H]([C@H]... 500.000 \n",
"1 COc1ccc(cc1)c1c(onc1c1cc(C(C)C)c(cc1O)O)NC(=O)... 0.023 \n",
"2 O[C@H]1O[C@H](CO[P](=O)(=O)=O)[C@H]([C@H]([C@H... 6300.000 \n",
"3 OCC[C@@H]1CCCCN1c1cc(NCC2=CC=CN(C2)O)n2c(n1)c(... 0.210 \n",
"4 O[C@@H]1[C@@H](COS(=O)(=O)NC(=O)[C@@H]2CCC[NH2... 0.050 \n",
"... ... ... \n",
"1849400 O[C@@H]1[C@H](O)[C@H](O[C@H]1n1cnc2c1ncnc2N)CO... 250.000 \n",
"1849401 O=C[C@@H](NC(=O)[C@H](Cc1ccc(cc1)OS(O)(O)O)NC(... 8.000 \n",
"1849402 CC(C[C@@H](C(=O)N1C=CC[C@H]1C(=O)N)NC(=O)[C@@H... 8.000 \n",
"1849403 O[C@@H]1[C@@H](COP(=O)(O)O)O[C@H]([C@@H]1OP(=O... 125.000 \n",
"1849404 CC[Se]C(=N)N 0.039 \n",
"\n",
" neg_log10_affinity_M \n",
"0 3.301030 \n",
"1 7.638272 \n",
"2 2.200659 \n",
"3 6.677781 \n",
"4 7.301030 \n",
"... ... \n",
"1849400 3.602060 \n",
"1849401 5.096910 \n",
"1849402 5.096910 \n",
"1849403 3.903090 \n",
"1849404 7.408935 \n",
"\n",
"[1849405 rows x 4 columns]"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_nr"
]
},
{
"cell_type": "code",
"execution_count": 72,
"id": "7f4027a2-0a5f-47bf-8a34-0c6a73b9b112",
"metadata": {},
"outputs": [],
"source": [
"df = df_nr[np.isfinite(df_nr['neg_log10_affinity_M'])]"
]
},
{
"cell_type": "code",
"execution_count": 86,
"id": "c558f3f6-9fe7-4361-8272-23a54368fdda",
"metadata": {},
"outputs": [],
"source": [
"df.to_parquet('data/all.parquet')"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "4e2d89f7-f6ea-41de-a13b-4a184b4fd580",
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_parquet('data/all.parquet')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"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": 13,
"id": "8f949038-d07d-4d3a-a47e-b825cc9018ca",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.preprocessing import StandardScaler"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "0c027988-0b44-4010-ad61-7d70eead1654",
"metadata": {},
"outputs": [],
"source": [
"scaler = StandardScaler()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"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": 31,
"id": "91196eee-5fd0-4aa4-927a-5c1a3f436ac8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([6.49685099]), array([2.43570803]))"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"scaler.mean_, scaler.var_"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "9be91c11-1c58-47de-8ebb-99c25cfc3c55",
"metadata": {},
"outputs": [],
"source": [
"df = df.drop(columns=['level_0','index'])"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "c6c64066-4032-4247-a8b9-00388176cc7b",
"metadata": {},
"outputs": [],
"source": [
"df.to_parquet('data/all.parquet')"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "d91c0d91-474c-4ab2-9a5e-3b7861f7a832",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAELCAYAAAAybErdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAZX0lEQVR4nO3dfZRdVXnH8e/PACU1Bdpih5KkJJasKjVayxh8QZhRqQFZxtq0BpEXLY3RRqULbBFqiCIVlwtrK2CapYiIdIqgNIUo1eqIFqkJr2OCaAygCSAVbGAQX8Y8/eOcSY733Dtzz8y959w79/dZa9bcc86efZ+dmcwze+9z9lZEYGZmlvW0qgMwM7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