-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ca4d70a
Showing
8 changed files
with
340 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# VSCode | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
"""Provides a BBB score calculator. | ||
See: BBB_score. | ||
""" | ||
|
||
|
||
def aro_r_term(aro_r): | ||
if aro_r == 0: | ||
return 0.336376 | ||
elif aro_r == 1: | ||
return 0.816016 | ||
elif aro_r == 2: | ||
return 1 | ||
elif aro_r == 3: | ||
return 0.691115 | ||
elif aro_r == 4: | ||
return 0.199399 | ||
elif aro_r > 4: | ||
return 0 | ||
else: | ||
raise ValueError('invalid aro_r input number') | ||
|
||
|
||
def ha_term(ha): | ||
if ha > 5 and ha <= 45: | ||
return 1/0.624231*(0.0000443*ha**3 - 0.004556*ha**2 + 0.12775*ha - 0.463) | ||
elif ha <= 5 or ha > 45: | ||
return 0 | ||
else: | ||
raise ValueError('invalid ha number') | ||
|
||
|
||
def mwhbn_term(mw, hbd, hba): | ||
if mw <= 0: | ||
raise ValueError('invalid mw number') | ||
if hbd < 0: | ||
raise ValueError('invalid hbd number') | ||
if hba < 0: | ||
raise ValueError('invalid hba number') | ||
mwhbn = (hbd + hba)/mw**0.5 | ||
if 0.05 <= mwhbn and mwhbn < 0.45: | ||
return 1/0.72258*(26.733*mwhbn**3 - 31.495*mwhbn**2 + 9.5202*mwhbn - 0.1358) | ||
elif mwhbn <= 0.05 or mwhbn > 0.45: | ||
return 0 | ||
else: | ||
raise ValueError('invalid mwhbn number') | ||
|
||
|
||
def tpsa_term(tpsa): | ||
if tpsa > 0 and tpsa <= 120: | ||
return 1/0.9598*(-0.0067*tpsa + 0.9598) | ||
elif tpsa == 0 or tpsa > 120: | ||
return 0 | ||
else: | ||
raise ValueError('invalid tpsa number') | ||
|
||
|
||
def pka_term(pka): | ||
if pka > 3 and pka < 11: | ||
return 1/0.597488*(0.00045068*pka**4 - 0.0116331*pka**3 + 0.18618*pka**2 - 0.71043*pka + 0.8579) | ||
elif pka <= 3 or pka > 11: | ||
return 0 | ||
else: | ||
raise ValueError('invalif pka number') | ||
|
||
|
||
def BBB_score(aro_r, ha, mw, hbd, hba, tpsa, pka): | ||
"""BBB_score does the calculation from the gupta 2019 J Med Chem paper. | ||
Args: | ||
aro_r (int): The number of aromatic rings. | ||
ha (int): number of heavy atoms. | ||
mw (float): molecular weight. | ||
hbd (int): number of hydrogen bond donors. | ||
hba (int): number of hydrogen bond acceptora. | ||
tpsa (float): total polar surface area. | ||
pka (float): pKa value. | ||
Returns: | ||
float: The bbb score. | ||
.. J. Med. Chem. 2019, 62, 21, 9824-9836: | ||
https://doi.org/10.1021/acs.jmedchem.9b01220 | ||
""" | ||
aro_r_term_value = aro_r_term(aro_r) | ||
ha_term_value = ha_term(ha) | ||
mwhbn_term_value = mwhbn_term(mw, hbd, hba) | ||
tpsa_term_value = tpsa_term(tpsa) | ||
pka_term_value = pka_term(pka) | ||
return aro_r_term_value + ha_term_value + 1.5*mwhbn_term_value + 2*tpsa_term_value + 0.5*pka_term_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Implements a BBB score and related helper utilities. | ||
Provides the following sub-packages: | ||
- BBB_calculator: Provides a BBB score calculator. | ||
""" | ||
|
||
from BBB_calculator.BBB_score import BBB_score |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Keira Garland | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# BBB_calculator | ||
|
||
Implements the blood brain barrier score described in the following paper | ||
|
||
J. Med. Chem. 2019, 62, 21, 9824-9836 | ||
https://doi.org/10.1021/acs.jmedchem.9b01220 | ||
|
||
## Install | ||
|
||
``` | ||
pip install BBB_calculator | ||
``` | ||
|
||
## Use | ||
|
||
``` | ||
from BBB_calculator import BBB_score | ||
score = BBB_score(1, 20, 300.29, 1, 7, 122.46, 2.86) | ||
print(score) | ||
# Prints: 1.815645... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[metadata] | ||
description-file = README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from distutils.core import setup | ||
setup( | ||
name = 'BBB_calculator', | ||
packages = ['BBB_calculator'], | ||
version = '1.0', | ||
license='MIT', | ||
description = 'Implements the blood brain barrier score described in: J. Med. Chem. 2019, 62, 21, 9824-9836', | ||
author = 'Keira Garland', | ||
author_email = '[email protected]', | ||
url = 'https://github.com/frequencykg/BBB_calculator', | ||
download_url = 'https://github.com/frequencykg/BBB_calculator/archive/v_10.tar.gz', | ||
keywords = ['BBB', 'brain', 'medchem', 'calculator'], | ||
install_requires=[], | ||
classifiers=[ | ||
'Development Status :: 4 - Beta', | ||
'Intended Audience :: Developers', | ||
'Topic :: Software Development :: Build Tools', | ||
'License :: OSI Approved :: MIT License', # Again, pick a license | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
from BBB_calculator.BBB_score import aro_r_term | ||
from BBB_calculator.BBB_score import ha_term | ||
from BBB_calculator.BBB_score import mwhbn_term | ||
from BBB_calculator.BBB_score import tpsa_term | ||
from BBB_calculator.BBB_score import pka_term | ||
from BBB_calculator import BBB_score | ||
|
||
|
||
def test_aro_r_term(): | ||
assert aro_r_term(2) == 1 | ||
|
||
|
||
def test_ha_term(): | ||
assert ha_term(10) == pytest.approx(0.645914, 0.001) | ||
|
||
|
||
def test_mwhbn_term(): | ||
assert mwhbn_term(200, 2, 2) == pytest.approx(0.888784, 0.001) | ||
|
||
|
||
def test_tpsa_term(): | ||
assert tpsa_term(130) == 0 | ||
|
||
|
||
def test_pka_term(): | ||
assert pka_term(2) == 0 | ||
|
||
|
||
def test_bbb_score(): | ||
assert BBB_score(1, 20, 300.29, 1, 7, 122.46, 2.86) == pytest.approx(1.815645, 0.001) |