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
ffa2f273
Commit
ffa2f273
authored
2 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
Optionally pass alignments to DockQ
The default is to rely on residue numbers for ref/mdl residue mapping
parent
7b47872d
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/mol/alg/pymod/dockq.py
+51
-3
51 additions, 3 deletions
modules/mol/alg/pymod/dockq.py
modules/mol/alg/pymod/scoring.py
+5
-1
5 additions, 1 deletion
modules/mol/alg/pymod/scoring.py
with
56 additions
and
4 deletions
modules/mol/alg/pymod/dockq.py
+
51
−
3
View file @
ffa2f273
from
ost
import
geom
from
ost
import
mol
from
ost
import
seq
def
_PreprocessStructures
(
mdl
,
ref
,
mdl_ch1
,
mdl_ch2
,
ref_ch1
,
ref_ch2
,
ch1_aln
=
None
,
ch2_aln
=
None
):
...
...
@@ -15,7 +16,56 @@ def _PreprocessStructures(mdl, ref, mdl_ch1, mdl_ch2, ref_ch1, ref_ch2,
ref_residues_1
=
list
()
ref_residues_2
=
list
()
if
ch1_aln
is
None
and
ch2_aln
is
None
:
if
ch1_aln
is
not
None
and
ch2_aln
is
not
None
:
# there are potentially already views attached to the alns but
# we go for *mdl* and *ref* here
if
ch1_aln
.
GetCount
()
!=
2
or
ch2_aln
.
GetCount
()
!=
2
:
raise
RuntimeError
(
"
Expect exactly two sequences in provided alns!
"
)
tmp
=
ch1_aln
.
GetSequence
(
0
)
ref_s1
=
seq
.
CreateSequence
(
tmp
.
GetName
(),
str
(
tmp
))
ref_s1
.
SetOffset
(
tmp
.
GetOffset
())
ref_s1
.
AttachView
(
ref
.
Select
(
f
"
cname=
{
ref_ch1
}
"
))
tmp
=
ch1_aln
.
GetSequence
(
1
)
mdl_s1
=
seq
.
CreateSequence
(
tmp
.
GetName
(),
str
(
tmp
))
mdl_s1
.
SetOffset
(
tmp
.
GetOffset
())
mdl_s1
.
AttachView
(
mdl
.
Select
(
f
"
cname=
{
mdl_ch1
}
"
))
new_ch1_aln
=
seq
.
CreateAlignment
(
ref_s1
,
mdl_s1
)
for
col
in
new_ch1_aln
:
if
col
[
0
]
!=
'
-
'
and
col
[
1
]
!=
'
-
'
:
ref_r
=
col
.
GetResidue
(
0
)
mdl_r
=
col
.
GetResidue
(
1
)
if
not
(
ref_r
.
IsValid
()
and
ref_r
.
one_letter_code
==
col
[
0
]):
raise
RuntimeError
(
"
DockQ: mismatch between provided
"
"
alignments and ATOMSEQ in structures
"
)
if
not
(
mdl_r
.
IsValid
()
and
mdl_r
.
one_letter_code
==
col
[
1
]):
raise
RuntimeError
(
"
DockQ: mismatch between provided
"
"
alignments and ATOMSEQ in structures
"
)
ref_residues_1
.
append
(
ref_r
)
mdl_residues_1
.
append
(
mdl_r
)
tmp
=
ch2_aln
.
GetSequence
(
0
)
ref_s2
=
seq
.
CreateSequence
(
tmp
.
GetName
(),
str
(
tmp
))
ref_s2
.
SetOffset
(
tmp
.
GetOffset
())
ref_s2
.
AttachView
(
ref
.
Select
(
f
"
cname=
{
ref_ch2
}
"
))
tmp
=
ch2_aln
.
GetSequence
(
1
)
mdl_s2
=
seq
.
CreateSequence
(
tmp
.
GetName
(),
str
(
tmp
))
mdl_s2
.
SetOffset
(
tmp
.
GetOffset
())
mdl_s2
.
AttachView
(
mdl
.
Select
(
f
"
cname=
{
mdl_ch2
}
"
))
new_ch2_aln
=
seq
.
CreateAlignment
(
ref_s2
,
mdl_s2
)
for
col
in
new_ch2_aln
:
if
col
[
0
]
!=
'
-
'
and
col
[
1
]
!=
'
-
'
:
ref_r
=
col
.
GetResidue
(
0
)
mdl_r
=
col
.
GetResidue
(
1
)
if
not
(
ref_r
.
IsValid
()
and
ref_r
.
one_letter_code
==
col
[
0
]):
raise
RuntimeError
(
"
DockQ: mismatch between provided
"
"
alignments and ATOMSEQ in structures
"
)
if
not
(
mdl_r
.
IsValid
()
and
mdl_r
.
one_letter_code
==
col
[
1
]):
raise
RuntimeError
(
"
DockQ: mismatch between provided
"
"
alignments and ATOMSEQ in structures
"
)
ref_residues_2
.
append
(
ref_r
)
mdl_residues_2
.
append
(
mdl_r
)
else
:
# go by residue numbers
for
mdl_r
in
mdl
.
Select
(
f
"
cname=
{
mdl_ch1
}
"
).
residues
:
ref_r
=
ref
.
FindResidue
(
ref_ch1
,
mdl_r
.
GetNumber
())
...
...
@@ -27,8 +77,6 @@ def _PreprocessStructures(mdl, ref, mdl_ch1, mdl_ch2, ref_ch1, ref_ch2,
if
ref_r
.
IsValid
():
mdl_residues_2
.
append
(
mdl_r
)
ref_residues_2
.
append
(
ref_r
)
else
:
raise
NotImplementedError
(
"
No aln mapping implemented yet
"
)
new_mdl
=
mdl
.
handle
.
CreateEmptyView
()
new_ref
=
ref
.
handle
.
CreateEmptyView
()
...
...
This diff is collapsed.
Click to expand it.
modules/mol/alg/pymod/scoring.py
+
5
−
1
View file @
ffa2f273
...
...
@@ -886,8 +886,11 @@ class Scorer:
if
trg_ch1
in
flat_mapping
and
trg_ch2
in
flat_mapping
:
mdl_ch1
=
flat_mapping
[
trg_ch1
]
mdl_ch2
=
flat_mapping
[
trg_ch2
]
aln1
=
self
.
mapping
.
alns
[(
trg_ch1
,
mdl_ch1
)]
aln2
=
self
.
mapping
.
alns
[(
trg_ch2
,
mdl_ch2
)]
res
=
dockq
.
DockQ
(
self
.
model
,
self
.
target
,
mdl_ch1
,
mdl_ch2
,
trg_ch1
,
trg_ch2
)
trg_ch1
,
trg_ch2
,
ch1_aln
=
aln1
,
ch2_aln
=
aln2
)
if
res
[
"
nnat
"
]
>
0
:
self
.
_dockq_interfaces
.
append
((
trg_ch1
,
trg_ch2
,
mdl_ch1
,
mdl_ch2
))
...
...
@@ -897,6 +900,7 @@ class Scorer:
# interface which is not covered by mdl... let's run DockQ
# with trg as trg/mdl in order to get the native contacts
# out
# no need to pass alns as the residue numbers match for sure
res
=
dockq
.
DockQ
(
self
.
target
,
self
.
target
,
trg_ch1
,
trg_ch2
,
trg_ch1
,
trg_ch2
)
nnat
=
res
[
"
nnat
"
]
...
...
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