Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
gkxiao authored Jan 29, 2021
1 parent 7febf58 commit 8cdd346
Showing 1 changed file with 301 additions and 0 deletions.
301 changes: 301 additions & 0 deletions download-jupyter-BBB_SCORE-RDKIT.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h2>BBB SCORE</h2>\n",
"<p>Author: Gaokeng Xiao</p>\n",
"<p>Date: 2021-01-29</p>\n",
"<p>Organization: Guangzhou Molcalx Information and Technology Ltd</p>\n",
"<p>Web: http://blog.molcalx.com.cn</p>\n",
"<p>Five descriptors will be used in BBB score reported by Gupa(2019)<sup>[1]</sup>:</p>\n",
"<ul>\n",
" <li>Aro_R:Number of Aromatic Rings</li>\n",
" <li>HA:Number of Heavy Atoms</li>\n",
" <li>MWHBN = HBN/MW<sup>^</sup>2</li>\n",
" <p>where HBN = HBA + HBD, HBA and HBD are Number of Hydrogen Bond Acceptor and Number of Hydrogen Bond Donor, respectively</p>\n",
" <li>TPSA:Topological Polar Surface Area</li>\n",
" <li>pKa:pKa of the molecule</li>\n",
"</ul>\n",
"<h2>Reference</h2>\n",
"<ol>\n",
" <li>Gupta, M., Lee, H. J., Barden, C. J., & Weaver, D. F. (2019). THE BLOOD-BRAIN BARRIER (BBB) SCORE. Journal of Medicinal Chemistry. doi:10.1021/acs.jmedchem.9b01220</li>\n",
"</ol>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2020.03.2\n"
]
}
],
"source": [
"import rdkit\n",
"from rdkit import Chem\n",
"print(rdkit.__version__)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h2>Calculate descriptors for BBB score</h2>"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def BBB_Descriptor(mol):\n",
" \"\"\"\n",
" Calculate the descriptors for Gupa(2019) BBB Score\n",
" \n",
" Usage: BBB_Descriptor(mol)\n",
" The above mol should be a RDKit molecule. And return a list including HA, MWHBN, ARO_R and TPSA.\n",
" \n",
" Return: [HA, MWHBN, ARO_R, TPSA]\n",
" \n",
" \"\"\"\n",
" import rdkit\n",
" import rdkit.Chem.rdMolDescriptors as Descriptor\n",
" \n",
" # Calculate NWHBN\n",
" nHBA = Descriptor.CalcNumHBA(mol)\n",
" nHBD = Descriptor.CalcNumHBD(mol)\n",
" HBN = nHBA + nHBD\n",
" MW = round(Descriptor.CalcExactMolWt(mol, onlyHeavy=False),2)\n",
" MWHBN = round(HBN/(MW**0.5),2)\n",
" \n",
" # calcu7late number of the heavy atoms\n",
" n = mol.GetNumAtoms()\n",
" elements = []\n",
" for i in range(n):\n",
" element = m.GetAtoms()[i].GetSymbol()\n",
" elements.append(element)\n",
" nH = elements.count('H')\n",
" HA = n - nH\n",
" \n",
" #Calculate the number of aromatic rings\n",
" aroR = Descriptor.CalcNumAromaticRings(mol)\n",
" \n",
" #\n",
" tpsa = Descriptor.CalcTPSA(mol)\n",
" \n",
" BBB_DESC = [MW,nHBA,nHBD,HBN,MWHBN,HA,aroR,tpsa]\n",
" return(BBB_DESC)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h2>Calculate BBB SCORE</h2>"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def bbbscore(mol,pka):\n",
" \"\"\"Calculate BBB SCORE\"\"\"\n",
" BBB_DESC = BBB_Descriptor(mol)\n",
" HA = float(BBB_DESC[5])\n",
" MWHBN = float(BBB_DESC[4])\n",
" Aro_R = float(BBB_DESC[6])\n",
" TPSA = float(BBB_DESC[7])\n",
" BBB_SCORE = []\n",
" \n",
" # Calculate P value for Aromatic Rings \n",
" if Aro_R == 0:\n",
" P_ARO_R=0.336367\n",
" \n",
" elif Aro_R == 1:\n",
" P_ARO_R = 0.816016\n",
" \n",
" elif Aro_R == 2:\n",
" P_ARO_R = 1\n",
" \n",
" elif Aro_R == 3:\n",
" P_ARO_R = 0.691115\n",
" \n",
" elif Aro_R == 4:\n",
" P_ARO_R = 0.199399\n",
" \n",
" elif Aro_R > 4:\n",
" P_ARO_R = 0\n",
" \n",
" # Calculate P value for HA\n",
" if HA > 5 and HA <= 45:\n",
" P_HA = (0.0000443*(HA**3) - 0.004556*(HA**2) + 0.12775*HA - 0.463)/0.624231\n",
" else:\n",
" P_HA = 0\n",
" \n",
" \n",
" # Calculate P value for MWHBN\n",
" if MWHBN > 0.05 and MWHBN <= 0.45:\n",
" P_MWHBN = (26.733*(MWHBN**3) - 31.495*(MWHBN**2) + 9.5202*MWHBN - 0.1358)/0.72258\n",
" else:\n",
" P_MWHBN = 0\n",
" \n",
" # Calculate P value for TPSA\n",
" if TPSA > 0 and TPSA <= 120:\n",
" P_TPSA = (-0.0067*TPSA + 0.9598)/0.9598\n",
" else:\n",
" P_TPSA = 0\n",
" \n",
" # Calculate P value for pKa\n",
" pka = float(pka)\n",
" if pka > 3 and pka <= 11:\n",
" P_PKA = (0.00045068*(pka**4) - 0.016331*(pka**3) + 0.18618*(pka**2) - 0.71043*pka + 0.8579)/0.597488\n",
" else:\n",
" P_PKA = 0\n",
" \n",
" BBB_score = P_ARO_R + P_HA + 1.5*P_MWHBN + 2*P_TPSA + 0.5*P_PKA\n",
" \n",
" BBB_SCORE = BBB_DESC\n",
" BBB_DESC.append(pka)\n",
" BBB_SCORE.append(round(BBB_score,2))\n",
" \n",
" return(BBB_SCORE)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Print the descriptors and BBB score\n",
"def BBB_Score_Report(bbb_score):\n",
" print(\"Number of Aromatic Rings(Aro_R):\",bbb_score[6])\n",
" print(\"Number of Heavy Atoms(HA):\",bbb_score[5])\n",
" print(\"Molecular Weight(MW):\",bbb_score[0])\n",
" print(\"Number of Hydrogen Bond Acceptor (HBA):\",bbb_score[1])\n",
" print(\"Number of Hydrogen Bond Donor(HBD):\",bbb_score[2])\n",
" print(\"MWHBN = HBN/MW^0.5, HBN = HBA + HBD:\",bbb_score[4])\n",
" print(\"Topological Polar Surface Area(TPSA):\",bbb_score[7])\n",
" print(\"pKa:\",bbb_score[8])\n",
" print(\"BBB Score:\",bbb_score[9])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h2>Case study 1:ACETAMINOPHEN</h2>\n",
"<ul>\n",
"<li>SMILES: CC(=O)Nc1ccc(O)cc1</li>\n",
"<li>pKa = 9.89</li>\n",
"<li>MW: 151.16</li>\n",
"<li>TPSA: 49.33</li>\n",
"<li>HA: 11</li>\n",
"<li>HBD: 2</li>\n",
"<li>HBA: 2</li>\n",
"<li>HB: 4</li>\n",
"<li>MWHBN:0.33</li>\n",
"<li>ARO_R:1</li>\n",
"<li>BBB_SCORE: 4.49</li>\n",
"</ul>"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of Aromatic Rings(Aro_R): 1\n",
"Number of Heavy Atoms(HA): 11\n",
"Molecular Weight(MW): 151.06\n",
"Number of Hydrogen Bond Acceptor (HBA): 2\n",
"Number of Hydrogen Bond Donor(HBD): 2\n",
"MWHBN = HBN/MW^0.5, HBN = HBA + HBD: 0.33\n",
"Topological Polar Surface Area(TPSA): 49.33\n",
"pKa: 9.89\n",
"BBB Score: 4.43\n"
]
}
],
"source": [
"import rdkit\n",
"from rdkit import Chem\n",
"m = Chem.MolFromSmiles('CC(=O)Nc1ccc(O)cc1')\n",
"bbb_score = bbbscore(m,9.89)\n",
"BBB_Score_Report(bbb_score)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h2>Case study 2:CINNARIZINE</h2>\n",
"<p>CINNARIZINE is a CNS drug with pKa = 8.1 and has a BBB score value of 5.04</p> "
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of Aromatic Rings(Aro_R): 3\n",
"Number of Heavy Atoms(HA): 28\n",
"Molecular Weight(MW): 368.23\n",
"Number of Hydrogen Bond Acceptor (HBA): 2\n",
"Number of Hydrogen Bond Donor(HBD): 0\n",
"MWHBN = HBN/MW^0.5, HBN = HBA + HBD: 0.1\n",
"Topological Polar Surface Area(TPSA): 6.48\n",
"pKa: 8.1\n",
"BBB Score: 5.01\n"
]
}
],
"source": [
"import rdkit\n",
"from rdkit import Chem\n",
"m = Chem.MolFromSmiles('N1(CCN(C\\C=C\\c2ccccc2)CC1)C(c3ccccc3)c4ccccc4')\n",
"bbb_score = bbbscore(m,8.1)\n",
"BBB_Score_Report(bbb_score)"
]
}
],
"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.6.11"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit 8cdd346

Please sign in to comment.