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
7f194707
Commit
7f194707
authored
3 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
fancify import in lddt unit test
parent
476a95c9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/mol/alg/tests/test_lddt.py
+8
-7
8 additions, 7 deletions
modules/mol/alg/tests/test_lddt.py
with
8 additions
and
7 deletions
modules/mol/alg/tests/test_lddt.py
+
8
−
7
View file @
7f194707
...
@@ -4,6 +4,7 @@ from ost import io, mol, settings, conop, seq
...
@@ -4,6 +4,7 @@ from ost import io, mol, settings, conop, seq
# check if we can import: fails if numpy or scipy not available
# check if we can import: fails if numpy or scipy not available
try
:
try
:
from
ost.mol.alg.qsscoring
import
*
from
ost.mol.alg.qsscoring
import
*
from
ost.mol.alg.lddt
import
*
except
ImportError
:
except
ImportError
:
print
(
"
Failed to import qsscoring. Happens when numpy or scipy missing.
"
\
print
(
"
Failed to import qsscoring. Happens when numpy or scipy missing.
"
\
"
Ignoring test_lddt.py tests.
"
)
"
Ignoring test_lddt.py tests.
"
)
...
@@ -24,7 +25,7 @@ class TestlDDT(unittest.TestCase):
...
@@ -24,7 +25,7 @@ class TestlDDT(unittest.TestCase):
target
=
_LoadFile
(
"
7SGN_C_target.pdb
"
)
target
=
_LoadFile
(
"
7SGN_C_target.pdb
"
)
# do awesome implementation
# do awesome implementation
scorer
=
mol
.
alg
.
lddt
.
lDDTScorer
(
target
,
conop
.
GetDefaultLib
())
scorer
=
lDDTScorer
(
target
,
conop
.
GetDefaultLib
())
aws_score
,
aws_per_res_scores
=
scorer
.
lDDT
(
model
)
aws_score
,
aws_per_res_scores
=
scorer
.
lDDT
(
model
)
# do reference implementation
# do reference implementation
...
@@ -50,7 +51,7 @@ class TestlDDT(unittest.TestCase):
...
@@ -50,7 +51,7 @@ class TestlDDT(unittest.TestCase):
target
=
_LoadFile
(
"
7W1F_B_target.pdb
"
)
target
=
_LoadFile
(
"
7W1F_B_target.pdb
"
)
# do awesome implementation
# do awesome implementation
scorer
=
mol
.
alg
.
lddt
.
lDDTScorer
(
target
,
conop
.
GetDefaultLib
())
scorer
=
lDDTScorer
(
target
,
conop
.
GetDefaultLib
())
aws_score
,
aws_per_res_scores
=
scorer
.
lDDT
(
model
)
aws_score
,
aws_per_res_scores
=
scorer
.
lDDT
(
model
)
# do reference implementation
# do reference implementation
...
@@ -79,7 +80,7 @@ class TestlDDT(unittest.TestCase):
...
@@ -79,7 +80,7 @@ class TestlDDT(unittest.TestCase):
target
=
ent_full
.
Select
(
'
peptide=true and cname=A,B
'
)
target
=
ent_full
.
Select
(
'
peptide=true and cname=A,B
'
)
# we use functionality from QS-scorer to derive a mapping
# we use functionality from QS-scorer to derive a mapping
qs_scorer
=
QSscorer
(
model
,
target
)
qs_scorer
=
QSscorer
(
model
,
target
)
lddt_scorer
=
mol
.
alg
.
lddt
.
lDDTScorer
(
target
,
conop
.
GetDefaultLib
())
lddt_scorer
=
lDDTScorer
(
target
,
conop
.
GetDefaultLib
())
score
,
per_res_scores
=
lddt_scorer
.
lDDT
(
model
,
score
,
per_res_scores
=
lddt_scorer
.
lDDT
(
model
,
chain_mapping
=
qs_scorer
.
chain_mapping
)
chain_mapping
=
qs_scorer
.
chain_mapping
)
...
@@ -112,7 +113,7 @@ class TestlDDT(unittest.TestCase):
...
@@ -112,7 +113,7 @@ class TestlDDT(unittest.TestCase):
# we use functionality from QS-scorer to derive a mapping
# we use functionality from QS-scorer to derive a mapping
qs_scorer
=
QSscorer
(
model
,
target
)
qs_scorer
=
QSscorer
(
model
,
target
)
lddt_scorer
=
mol
.
alg
.
lddt
.
lDDTScorer
(
target
,
conop
.
GetDefaultLib
())
lddt_scorer
=
lDDTScorer
(
target
,
conop
.
GetDefaultLib
())
# naively running lDDT will fail, as residue-residue mapping happens
# naively running lDDT will fail, as residue-residue mapping happens
# with resnums. Since we shifted that stuff above we'll get an error
# with resnums. Since we shifted that stuff above we'll get an error
...
@@ -142,10 +143,10 @@ class TestlDDT(unittest.TestCase):
...
@@ -142,10 +143,10 @@ class TestlDDT(unittest.TestCase):
def
test_lDDT_seqsep
(
self
):
def
test_lDDT_seqsep
(
self
):
target
=
_LoadFile
(
"
7SGN_C_target.pdb
"
)
target
=
_LoadFile
(
"
7SGN_C_target.pdb
"
)
with
self
.
assertRaises
(
NotImplementedError
):
with
self
.
assertRaises
(
NotImplementedError
):
scorer
=
mol
.
alg
.
lddt
.
lDDTScorer
(
target
,
conop
.
GetDefaultLib
(),
scorer
=
lDDTScorer
(
target
,
conop
.
GetDefaultLib
(),
sequence_separation
=
42
)
sequence_separation
=
42
)
scorer
=
mol
.
alg
.
lddt
.
lDDTScorer
(
target
,
conop
.
GetDefaultLib
(),
scorer
=
lDDTScorer
(
target
,
conop
.
GetDefaultLib
(),
sequence_separation
=
0
)
sequence_separation
=
0
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
from
ost
import
testutils
from
ost
import
testutils
...
...
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