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
01cc025b
Commit
01cc025b
authored
1 year ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
qsscore: resolve edge case of interfaces without any mapped residues
parent
91f459c0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/mol/alg/pymod/qsscore.py
+42
-16
42 additions, 16 deletions
modules/mol/alg/pymod/qsscore.py
with
42 additions
and
16 deletions
modules/mol/alg/pymod/qsscore.py
+
42
−
16
View file @
01cc025b
...
@@ -569,22 +569,48 @@ class QSScorer:
...
@@ -569,22 +569,48 @@ class QSScorer:
contact_d
=
self
.
qsent1
.
contact_d
contact_d
=
self
.
qsent1
.
contact_d
mapped_idx_grid_1
=
np
.
ix_
(
mapped_indices_1_1
,
mapped_indices_2_1
)
mapped_idx_grid_1
=
np
.
ix_
(
mapped_indices_1_1
,
mapped_indices_2_1
)
mapped_idx_grid_2
=
np
.
ix_
(
mapped_indices_1_2
,
mapped_indices_2_2
)
mapped_idx_grid_2
=
np
.
ix_
(
mapped_indices_1_2
,
mapped_indices_2_2
)
mapped_d1_contacts
=
d1
[
mapped_idx_grid_1
]
<
contact_d
mapped_d2_contacts
=
d2
[
mapped_idx_grid_2
]
<
contact_d
if
mapped_idx_grid_1
[
0
].
shape
[
0
]
==
0
or
mapped_idx_grid_2
[
0
].
shape
[
0
]
==
0
:
assert
(
mapped_d1_contacts
.
shape
==
mapped_d2_contacts
.
shape
)
# dealing with special cases where we have no mapped residues
shared_mask
=
np
.
logical_and
(
mapped_d1_contacts
,
mapped_d2_contacts
)
# we only avoid errors here when using maped_idx_grid_x for indexing
shared_mask_d1
=
np
.
full
(
d1
.
shape
,
False
,
dtype
=
bool
)
# but run the rest of the algorithm anyways which produces some
shared_mask_d1
[
mapped_idx_grid_1
]
=
shared_mask
# computational overhead. Thats OK, as this should occur rarely
shared_mask_d2
=
np
.
full
(
d2
.
shape
,
False
,
dtype
=
bool
)
shared_mask_d1
=
np
.
full
(
d1
.
shape
,
False
,
dtype
=
bool
)
shared_mask_d2
[
mapped_idx_grid_2
]
=
shared_mask
shared_mask_d2
=
np
.
full
(
d2
.
shape
,
False
,
dtype
=
bool
)
mapped_nonshared_mask_d1
=
np
.
full
(
d1
.
shape
,
False
,
dtype
=
bool
)
# get mapped but nonshared masks
mapped_nonshared_mask_d2
=
np
.
full
(
d2
.
shape
,
False
,
dtype
=
bool
)
mapped_nonshared_mask_d1
=
np
.
full
(
d1
.
shape
,
False
,
dtype
=
bool
)
if
mapped_idx_grid_1
[
0
].
shape
[
0
]
==
0
:
mapped_nonshared_mask_d1
[
mapped_idx_grid_1
]
=
\
# mapped_idx_grid_1 has not a single mapped residue which raises
np
.
logical_and
(
np
.
logical_not
(
shared_mask
),
mapped_d1_contacts
)
# an error when calling something like d1[mapped_idx_grid_1]
mapped_nonshared_mask_d2
=
np
.
full
(
d2
.
shape
,
False
,
dtype
=
bool
)
mapped_d1_contacts
=
np
.
full
(
d1
.
shape
,
False
,
dtype
=
bool
)
mapped_nonshared_mask_d2
[
mapped_idx_grid_2
]
=
\
else
:
np
.
logical_and
(
np
.
logical_not
(
shared_mask
),
mapped_d2_contacts
)
mapped_d1_contacts
=
d1
[
mapped_idx_grid_1
]
<
contact_d
mapped_nonshared_mask_d1
[
mapped_idx_grid_1
]
=
mapped_d1_contacts
if
mapped_idx_grid_2
[
0
].
shape
[
0
]
==
0
:
# mapped_idx_grid_2 has not a single mapped residue which raises
# an error when calling something like d2[mapped_idx_grid_2]
mapped_d2_contacts
=
np
.
full
(
d2
.
shape
,
False
,
dtype
=
bool
)
else
:
mapped_d2_contacts
=
d2
[
mapped_idx_grid_2
]
<
contact_d
mapped_nonshared_mask_d2
[
mapped_idx_grid_2
]
=
mapped_d2_contacts
shared_mask
=
np
.
full
(
mapped_d1_contacts
.
shape
,
False
,
dtype
=
bool
)
else
:
mapped_d1_contacts
=
d1
[
mapped_idx_grid_1
]
<
contact_d
mapped_d2_contacts
=
d2
[
mapped_idx_grid_2
]
<
contact_d
shared_mask
=
np
.
logical_and
(
mapped_d1_contacts
,
mapped_d2_contacts
)
shared_mask_d1
=
np
.
full
(
d1
.
shape
,
False
,
dtype
=
bool
)
shared_mask_d1
[
mapped_idx_grid_1
]
=
shared_mask
shared_mask_d2
=
np
.
full
(
d2
.
shape
,
False
,
dtype
=
bool
)
shared_mask_d2
[
mapped_idx_grid_2
]
=
shared_mask
# get mapped but nonshared masks
mapped_nonshared_mask_d1
=
np
.
full
(
d1
.
shape
,
False
,
dtype
=
bool
)
mapped_nonshared_mask_d1
[
mapped_idx_grid_1
]
=
\
np
.
logical_and
(
np
.
logical_not
(
shared_mask
),
mapped_d1_contacts
)
mapped_nonshared_mask_d2
=
np
.
full
(
d2
.
shape
,
False
,
dtype
=
bool
)
mapped_nonshared_mask_d2
[
mapped_idx_grid_2
]
=
\
np
.
logical_and
(
np
.
logical_not
(
shared_mask
),
mapped_d2_contacts
)
# contributions from shared contacts
# contributions from shared contacts
shared_d1
=
d1
[
shared_mask_d1
]
shared_d1
=
d1
[
shared_mask_d1
]
...
...
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