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
833a4ad8
Commit
833a4ad8
authored
3 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
variable renaming
parent
be849e66
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/pymod/lddt.py
+21
-21
21 additions, 21 deletions
modules/mol/alg/pymod/lddt.py
with
21 additions
and
21 deletions
modules/mol/alg/pymod/lddt.py
+
21
−
21
View file @
833a4ad8
...
@@ -311,11 +311,11 @@ class lDDTScorer:
...
@@ -311,11 +311,11 @@ class lDDTScorer:
generic float property of that name
generic float property of that name
:type local_lddt_prop: :class:`str`
:type local_lddt_prop: :class:`str`
:param local_contact_prop: If set, number of expected contacts as well
:param local_contact_prop: If set, number of expected contacts as well
as number of
fulfill
ed contacts will be
as number of
conserv
ed contacts will be
assigned as generic int property.
assigned as generic int property.
Excected contacts will be set as
Excected contacts will be set as
<local_contact_prop>_exp,
fulfill
ed contacts
<local_contact_prop>_exp,
conserv
ed contacts
as <local_contact_prop>_
fulfill
ed. Values
as <local_contact_prop>_
conserv
ed. Values
are summed over all thresholds.
are summed over all thresholds.
:param local_contact_prop: :class:`str`
:param local_contact_prop: :class:`str`
:param chain_mapping: Mapping of model chains (key) onto target chains
:param chain_mapping: Mapping of model chains (key) onto target chains
...
@@ -360,7 +360,7 @@ class lDDTScorer:
...
@@ -360,7 +360,7 @@ class lDDTScorer:
Third: numpy matrix of shape
Third: numpy matrix of shape
(len(scored_residues), len(thresholds))
(len(scored_residues), len(thresholds))
specifying how many for each threshold are
specifying how many for each threshold are
fulfill
ed.
conserv
ed.
:returns: global and per-residue lDDT scores as a tuple -
:returns: global and per-residue lDDT scores as a tuple -
first element is global lDDT score and second element
first element is global lDDT score and second element
a list of per-residue scores with length len(*model*.residues)
a list of per-residue scores with length len(*model*.residues)
...
@@ -478,7 +478,7 @@ class lDDTScorer:
...
@@ -478,7 +478,7 @@ class lDDTScorer:
per_res_exp
=
np
.
asarray
([
self
.
_GetNExp
(
res_ref_atom_indices
[
idx
],
per_res_exp
=
np
.
asarray
([
self
.
_GetNExp
(
res_ref_atom_indices
[
idx
],
ref_indices
)
for
idx
in
range
(
len
(
res_indices
))],
dtype
=
np
.
int32
)
ref_indices
)
for
idx
in
range
(
len
(
res_indices
))],
dtype
=
np
.
int32
)
per_res_
fulfill
ed
=
self
.
_EvalResidues
(
pos
,
thresholds
,
per_res_
conserv
ed
=
self
.
_EvalResidues
(
pos
,
thresholds
,
res_atom_indices
,
res_atom_indices
,
ref_indices
,
ref_distances
)
ref_indices
,
ref_distances
)
...
@@ -488,14 +488,14 @@ class lDDTScorer:
...
@@ -488,14 +488,14 @@ class lDDTScorer:
per_res_lDDT
=
[
None
]
*
len
(
model
.
residues
)
per_res_lDDT
=
[
None
]
*
len
(
model
.
residues
)
for
idx
in
range
(
len
(
res_indices
)):
for
idx
in
range
(
len
(
res_indices
)):
n_exp
=
n_thresh
*
per_res_exp
[
idx
]
n_exp
=
n_thresh
*
per_res_exp
[
idx
]
score
=
np
.
sum
(
per_res_
fulfill
ed
[
idx
,:])
/
n_exp
score
=
np
.
sum
(
per_res_
conserv
ed
[
idx
,:])
/
n_exp
per_res_lDDT
[
res_indices
[
idx
]]
=
score
per_res_lDDT
[
res_indices
[
idx
]]
=
score
# do full model score
# do full model score
if
penalize_extra_chains
:
if
penalize_extra_chains
:
n_distances
+=
self
.
_GetExtraModelChainPenalty
(
model
,
chain_mapping
)
n_distances
+=
self
.
_GetExtraModelChainPenalty
(
model
,
chain_mapping
)
lDDT
=
np
.
sum
(
per_res_
fulfill
ed
)
/
(
n_thresh
*
n_distances
)
lDDT
=
np
.
sum
(
per_res_
conserv
ed
)
/
(
n_thresh
*
n_distances
)
# set properties if necessary
# set properties if necessary
if
local_lddt_prop
:
if
local_lddt_prop
:
...
@@ -506,14 +506,14 @@ class lDDTScorer:
...
@@ -506,14 +506,14 @@ class lDDTScorer:
if
local_contact_prop
:
if
local_contact_prop
:
residues
=
model
.
residues
residues
=
model
.
residues
exp_prop
=
local_contact_prop
+
"
_exp
"
exp_prop
=
local_contact_prop
+
"
_exp
"
fulfill
ed_prop
=
local_contact_prop
+
"
_
fulfill
ed
"
conserv
ed_prop
=
local_contact_prop
+
"
_
conserv
ed
"
for
idx
in
res_indices
:
for
idx
in
res_indices
:
residues
[
idx
].
SetIntProp
(
exp_prop
,
n_thresh
*
per_res_exp
[
idx
])
residues
[
idx
].
SetIntProp
(
exp_prop
,
n_thresh
*
per_res_exp
[
idx
])
residues
[
idx
].
SetIntProp
(
fulfill
ed_prop
,
residues
[
idx
].
SetIntProp
(
conserv
ed_prop
,
np
.
sum
(
per_res_
fulfill
ed
[
idx
,:]))
np
.
sum
(
per_res_
conserv
ed
[
idx
,:]))
if
return_dist_test
:
if
return_dist_test
:
return
lDDT
,
per_res_lDDT
,
res_indices
,
per_res_exp
,
per_res_
fulfill
ed
return
lDDT
,
per_res_lDDT
,
res_indices
,
per_res_exp
,
per_res_
conserv
ed
else
:
else
:
return
lDDT
,
per_res_lDDT
return
lDDT
,
per_res_lDDT
...
@@ -858,12 +858,12 @@ class lDDTScorer:
...
@@ -858,12 +858,12 @@ class lDDTScorer:
returns numpy matrix of shape (n_atoms, len(threshold))
returns numpy matrix of shape (n_atoms, len(threshold))
"""
"""
fulfill
ed
=
np
.
zeros
((
len
(
atom_indices
),
len
(
thresholds
)),
conserv
ed
=
np
.
zeros
((
len
(
atom_indices
),
len
(
thresholds
)),
dtype
=
np
.
int32
)
dtype
=
np
.
int32
)
for
a_idx
,
a
in
enumerate
(
atom_indices
):
for
a_idx
,
a
in
enumerate
(
atom_indices
):
fulfill
ed
[
a_idx
,
:]
=
self
.
_EvalAtom
(
pos
,
a
,
thresholds
,
conserv
ed
[
a_idx
,
:]
=
self
.
_EvalAtom
(
pos
,
a
,
thresholds
,
ref_indices
,
ref_distances
)
ref_indices
,
ref_distances
)
return
fulfill
ed
return
conserv
ed
def
_EvalResidues
(
self
,
pos
,
thresholds
,
res_atom_indices
,
ref_indices
,
def
_EvalResidues
(
self
,
pos
,
thresholds
,
res_atom_indices
,
ref_indices
,
ref_distances
):
ref_distances
):
...
@@ -872,12 +872,12 @@ class lDDTScorer:
...
@@ -872,12 +872,12 @@ class lDDTScorer:
residues are defined in *res_atom_indices* as lists of atom indices
residues are defined in *res_atom_indices* as lists of atom indices
returns numpy matrix of shape (n_residues, len(thresholds)).
returns numpy matrix of shape (n_residues, len(thresholds)).
"""
"""
fulfill
ed
=
np
.
zeros
((
len
(
res_atom_indices
),
len
(
thresholds
)),
conserv
ed
=
np
.
zeros
((
len
(
res_atom_indices
),
len
(
thresholds
)),
dtype
=
np
.
int32
)
dtype
=
np
.
int32
)
for
rai_idx
,
rai
in
enumerate
(
res_atom_indices
):
for
rai_idx
,
rai
in
enumerate
(
res_atom_indices
):
fulfill
ed
[
rai_idx
,:]
=
np
.
sum
(
self
.
_EvalAtoms
(
pos
,
rai
,
thresholds
,
conserv
ed
[
rai_idx
,:]
=
np
.
sum
(
self
.
_EvalAtoms
(
pos
,
rai
,
thresholds
,
ref_indices
,
ref_distances
),
axis
=
0
)
ref_indices
,
ref_distances
),
axis
=
0
)
return
fulfill
ed
return
conserv
ed
def
_ProcessSequenceSeparation
(
self
):
def
_ProcessSequenceSeparation
(
self
):
if
self
.
sequence_separation
!=
0
:
if
self
.
sequence_separation
!=
0
:
...
@@ -914,7 +914,7 @@ class lDDTScorer:
...
@@ -914,7 +914,7 @@ class lDDTScorer:
continue
# nothing to do
continue
# nothing to do
# score as is
# score as is
sym_one_
fulfill
ed
=
self
.
_EvalAtoms
(
sym_one_
conserv
ed
=
self
.
_EvalAtoms
(
pos
,
pos
,
atom_indices
,
atom_indices
,
thresholds
,
thresholds
,
...
@@ -926,7 +926,7 @@ class lDDTScorer:
...
@@ -926,7 +926,7 @@ class lDDTScorer:
for
pair
in
sym
:
for
pair
in
sym
:
pos
[[
pair
[
0
],
pair
[
1
]]]
=
pos
[[
pair
[
1
],
pair
[
0
]]]
pos
[[
pair
[
0
],
pair
[
1
]]]
=
pos
[[
pair
[
1
],
pair
[
0
]]]
sym_two_
fulfill
ed
=
self
.
_EvalAtoms
(
sym_two_
conserv
ed
=
self
.
_EvalAtoms
(
pos
,
pos
,
atom_indices
,
atom_indices
,
thresholds
,
thresholds
,
...
@@ -934,8 +934,8 @@ class lDDTScorer:
...
@@ -934,8 +934,8 @@ class lDDTScorer:
sym_ref_distances
,
sym_ref_distances
,
)
)
sym_one_score
=
np
.
sum
(
sym_one_
fulfill
ed
)
/
(
len
(
thresholds
)
*
tot
)
sym_one_score
=
np
.
sum
(
sym_one_
conserv
ed
)
/
(
len
(
thresholds
)
*
tot
)
sym_two_score
=
np
.
sum
(
sym_two_
fulfill
ed
)
/
(
len
(
thresholds
)
*
tot
)
sym_two_score
=
np
.
sum
(
sym_two_
conserv
ed
)
/
(
len
(
thresholds
)
*
tot
)
if
sym_one_score
>=
sym_two_score
:
if
sym_one_score
>=
sym_two_score
:
# switch back, initial positions were better or equal
# switch back, initial positions were better or equal
...
...
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