Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
6d4fec60
Commit
6d4fec60
authored
5 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
add basic unit test for cadscore binding
parent
b70d5626
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/bindings/tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
modules/bindings/tests/CMakeLists.txt
modules/bindings/tests/test_cadscore.py
+74
-0
74 additions, 0 deletions
modules/bindings/tests/test_cadscore.py
with
75 additions
and
0 deletions
modules/bindings/tests/CMakeLists.txt
+
1
−
0
View file @
6d4fec60
...
...
@@ -5,6 +5,7 @@ set(OST_BINDINGS_UNIT_TESTS
test_blast.py
test_kclust.py
test_naccess.py
test_cadscore.py
)
ost_unittest
(
MODULE bindings
...
...
This diff is collapsed.
Click to expand it.
modules/bindings/tests/test_cadscore.py
0 → 100644
+
74
−
0
View file @
6d4fec60
import
unittest
from
ost
import
*
from
ost
import
settings
from
ost.bindings
import
cadscore
from
ost
import
testutils
class
TestCADBindings
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
protein
=
io
.
LoadEntity
(
"
testfiles/testprotein.pdb
"
)
def
testCADClassic
(
self
):
try
:
# all of the following need to be present
cad_calc_path
=
settings
.
Locate
(
'
CADscore_calc.bash
'
)
cad_read_g_path
=
settings
.
Locate
(
'
CADscore_read_global_scores.bash
'
)
cad_read_l_path
=
settings
.
Locate
(
'
CADscore_read_local_scores.bash
'
)
executable_path
=
settings
.
Locate
(
'
voroprot2
'
)
except
:
print
(
"
Could not find CAD score classic executables: ignoring unit tests
"
)
return
cad_result
=
cadscore
.
CADScore
(
self
.
protein
,
self
.
protein
,
label
=
"
cad_classic
"
)
# model and reference are the same, we expect a global CAD score of 1
self
.
assertEqual
(
cad_result
.
globalAA
,
1.0
)
# one score per residue
self
.
assertEqual
(
len
(
cad_result
.
localAA
),
len
(
self
.
protein
.
residues
))
# model and reference are the same, we expect local CAD scores of 0.0
for
score
in
cad_result
.
localAA
.
values
():
self
.
assertEqual
(
score
,
0.0
)
# check whether this score is assigned to each residue as float property
for
r
in
self
.
protein
.
residues
:
self
.
assertTrue
(
r
.
HasProp
(
"
cad_classic
"
))
self
.
assertEqual
(
r
.
GetFloatProp
(
"
cad_classic
"
),
0.0
)
def
testCADVoronota
(
self
):
try
:
# all of the following need to be present
voronota_cadscore_path
=
settings
.
Locate
(
"
voronota-cadscore
"
)
executable_path
=
settings
.
Locate
(
"
voronota
"
)
except
:
print
(
"
Could not find CAD score voronota executables: ignoring unit tests
"
)
return
cad_result
=
cadscore
.
CADScore
(
self
.
protein
,
self
.
protein
,
mode
=
"
voronota
"
,
label
=
"
cad_voronota
"
)
# model and reference are the same, we expect a global CAD score of 1
self
.
assertEqual
(
cad_result
.
globalAA
,
1.0
)
# one score per residue
self
.
assertEqual
(
len
(
cad_result
.
localAA
),
len
(
self
.
protein
.
residues
))
# model and reference are the same, we expect local CAD scores of 1.0
for
score
in
cad_result
.
localAA
.
values
():
self
.
assertEqual
(
score
,
1.0
)
# check whether this score is assigned to each residue as float property
for
r
in
self
.
protein
.
residues
:
self
.
assertTrue
(
r
.
HasProp
(
"
cad_voronota
"
))
self
.
assertEqual
(
r
.
GetFloatProp
(
"
cad_voronota
"
),
1.0
)
if
__name__
==
"
__main__
"
:
testutils
.
RunTests
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment