Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Packages
signaturizer
Commits
46afd6de
Commit
46afd6de
authored
Jul 01, 2020
by
Martino Bertoni
🌋
Browse files
bugfix from Pau, changed GLOBAL signature logic, corrected the baseurl
parent
af5e4de2
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
46afd6de
...
...
@@ -43,7 +43,7 @@ pip install git+http://gitlabsbnb.irbbarcelona.org/packages/signaturizer.git
```
python
from
signaturizer
import
Signaturizer
# load the predictor for B1 space (representing the Mode of Action)
sign
=
Signaturizer
(
'
/aloy/web_checker/exported_smilespreds/
B1'
)
sign
=
Signaturizer
(
'B1'
)
# prepare a list of SMILES strings
smiles
=
[
'C'
,
'CCC'
]
# run prediction
...
...
@@ -64,8 +64,7 @@ results = sign.predict(smiles, 'destination.h5')
```
python
from
signaturizer
import
Signaturizer
# load the bioactivity space predictor for all space
models
=
[
'/aloy/web_checker/exported_smilespreds/%s%s'
%
(
y
,
x
)
for
y
in
'ABCDE'
for
x
in
'12345'
]
sign
=
Signaturizer
(
models
)
sign
=
Signaturizer
(
'GLOBAL'
)
# prepare a list of SMILES strings
smiles
=
[
'C'
,
'CCC'
]
# run prediction
...
...
signaturizer/exporter.py
View file @
46afd6de
import
os
import
shutil
import
tempfile
import
tensorflow
as
tf
import
tensorflow
.compat.v1
as
tf
import
tensorflow_hub
as
hub
...
...
signaturizer/signaturizer.py
View file @
46afd6de
...
...
@@ -18,7 +18,7 @@ class Signaturizer():
"""Class loading TF-hub module and performing predictions."""
def
__init__
(
self
,
model_name
,
verbose
=
True
,
base_url
=
"
https://chemicalchecker.org/signaturizer
/"
):
base_url
=
"
file:///aloy/web_checker/exported_smilespreds
/"
):
"""Initialize the Signaturizer.
Args:
...
...
@@ -31,13 +31,13 @@ class Signaturizer():
base_url(str): The ChemicalChecker getModel API URL.
"""
self
.
verbose
=
verbose
if
isinstance
(
model_name
,
list
):
models
=
model_name
else
:
if
not
isinstance
(
model_name
,
list
):
if
model_name
.
upper
()
==
'GLOBAL'
:
models
=
list
(
itertools
.
product
(
"ABCDE"
,
"
12345
"
))
models
=
[
y
+
x
for
y
in
'ABCDE'
for
x
in
'
12345
'
]
else
:
models
=
[
model_name
]
else
:
models
=
model_name
# load modules
self
.
modules
=
list
()
self
.
graph
=
tf
.
Graph
()
...
...
tests/test_signaturizer.py
View file @
46afd6de
...
...
@@ -81,3 +81,9 @@ class TestSignaturizer(unittest.TestCase):
self
.
assertTrue
(
math
.
isnan
(
comp
))
for
comp
in
res
.
signature
[
2
]:
self
.
assertFalse
(
math
.
isnan
(
comp
))
def
test_predict_global
(
self
):
module
=
Signaturizer
(
'GLOBAL'
)
res
=
module
.
predict
(
self
.
test_smiles
)
self
.
assertEqual
(
res
.
signature
.
shape
[
0
],
2
)
self
.
assertEqual
(
res
.
signature
.
shape
[
1
],
128
*
25
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment