Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
OpenFold
Commits
4666e15e
Commit
4666e15e
authored
Jun 26, 2023
by
Geoffrey Yu
Browse files
update codes
parent
938782e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
openfold/utils/loss.py
openfold/utils/loss.py
+4
-5
No files found.
openfold/utils/loss.py
View file @
4666e15e
...
@@ -1708,7 +1708,7 @@ def kabsch_rotation(P, Q):
...
@@ -1708,7 +1708,7 @@ def kabsch_rotation(P, Q):
# right-handed coordinate system.
# right-handed coordinate system.
# And finally calculating the optimal rotation matrix U
# And finally calculating the optimal rotation matrix U
# see http://en.wikipedia.org/wiki/Kabsch_algorithm
# see http://en.wikipedia.org/wiki/Kabsch_algorithm
V
,
_
,
W
=
torch
.
linalg
.
svd
(
C
)
V
,
_
,
W
=
torch
.
linalg
.
svd
(
C
.
to
(
'cpu'
)
)
d
=
(
torch
.
linalg
.
det
(
V
)
*
torch
.
linalg
.
det
(
W
))
<
0.0
d
=
(
torch
.
linalg
.
det
(
V
)
*
torch
.
linalg
.
det
(
W
))
<
0.0
if
d
:
if
d
:
...
@@ -1855,7 +1855,6 @@ def greedy_align(
...
@@ -1855,7 +1855,6 @@ def greedy_align(
assert
best_idx
is
not
None
assert
best_idx
is
not
None
used
[
best_idx
]
=
True
used
[
best_idx
]
=
True
align
.
append
((
i
,
best_idx
))
align
.
append
((
i
,
best_idx
))
print
(
f
"align is
{
align
}
"
)
return
align
return
align
...
@@ -1900,7 +1899,7 @@ class AlphaFoldLoss(nn.Module):
...
@@ -1900,7 +1899,7 @@ class AlphaFoldLoss(nn.Module):
def
loss
(
self
,
out
,
batch
,
_return_breakdown
=
False
):
def
loss
(
self
,
out
,
batch
,
_return_breakdown
=
False
):
"""
"""
Rename previous forward() as loss
Rename previous forward() as loss
()
so that can be reused in the subclass
so that can be reused in the subclass
"""
"""
if
"violation"
not
in
out
.
keys
():
if
"violation"
not
in
out
.
keys
():
...
@@ -2034,7 +2033,7 @@ class AlphaFoldMultimerLoss(AlphaFoldLoss):
...
@@ -2034,7 +2033,7 @@ class AlphaFoldMultimerLoss(AlphaFoldLoss):
per_asym_residue_index
[
int
(
cur_asym_id
)]
=
batch
[
"residue_index"
][
asym_mask
]
per_asym_residue_index
[
int
(
cur_asym_id
)]
=
batch
[
"residue_index"
][
asym_mask
]
anchor_gt_asym
,
anchor_pred_asym
=
get_least_asym_entity_or_longest_length
(
batch
)
anchor_gt_asym
,
anchor_pred_asym
=
get_least_asym_entity_or_longest_length
(
batch
)
logger
.
info
(
f
"anchor_gt_asym is chosen to be:
{
anchor_gt_asym
}
"
)
print
(
f
"anchor_gt_asym is chosen to be:
{
anchor_gt_asym
}
"
)
anchor_gt_idx
=
int
(
anchor_gt_asym
)
-
1
anchor_gt_idx
=
int
(
anchor_gt_asym
)
-
1
best_rmsd
=
1e20
best_rmsd
=
1e20
...
@@ -2091,7 +2090,7 @@ class AlphaFoldMultimerLoss(AlphaFoldLoss):
...
@@ -2091,7 +2090,7 @@ class AlphaFoldMultimerLoss(AlphaFoldLoss):
if
rmsd
<
best_rmsd
:
if
rmsd
<
best_rmsd
:
best_rmsd
=
rmsd
best_rmsd
=
rmsd
best_labels
=
merged_labels
best_labels
=
merged_labels
print
(
f
"finished shuffling and final align is
{
align
}
"
)
return
best_labels
return
best_labels
def
forward
(
self
,
out
,
batch
,
_return_breakdown
=
False
):
def
forward
(
self
,
out
,
batch
,
_return_breakdown
=
False
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment