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
386fd1a5
Unverified
Commit
386fd1a5
authored
Jan 28, 2023
by
Gustaf Ahdritz
Committed by
GitHub
Jan 28, 2023
Browse files
Merge pull request #264 from l-bick/obsolete_loading_fix
Obsolete parsing and File not found fix
parents
3c674b71
197b1771
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
openfold/data/templates.py
openfold/data/templates.py
+17
-1
No files found.
openfold/data/templates.py
View file @
386fd1a5
...
@@ -130,6 +130,22 @@ def _is_after_cutoff(
...
@@ -130,6 +130,22 @@ def _is_after_cutoff(
return
False
return
False
def
_replace_obsolete_references
(
obsolete_mapping
)
->
Mapping
[
str
,
str
]:
"""Generates a new obsolete by tracing all cross-references and store the latest leaf to all referencing nodes"""
obsolete_new
=
{}
obsolete_keys
=
obsolete_mapping
.
keys
()
def
_new_target
(
k
):
v
=
obsolete_mapping
[
k
]
if
v
in
obsolete_keys
:
return
_new_target
(
v
)
return
v
for
k
in
obsolete_keys
:
obsolete_new
[
k
]
=
_new_target
(
k
)
return
obsolete_new
def
_parse_obsolete
(
obsolete_file_path
:
str
)
->
Mapping
[
str
,
str
]:
def
_parse_obsolete
(
obsolete_file_path
:
str
)
->
Mapping
[
str
,
str
]:
"""Parses the data file from PDB that lists which PDB ids are obsolete."""
"""Parses the data file from PDB that lists which PDB ids are obsolete."""
with
open
(
obsolete_file_path
)
as
f
:
with
open
(
obsolete_file_path
)
as
f
:
...
@@ -143,7 +159,7 @@ def _parse_obsolete(obsolete_file_path: str) -> Mapping[str, str]:
...
@@ -143,7 +159,7 @@ def _parse_obsolete(obsolete_file_path: str) -> Mapping[str, str]:
from_id
=
line
[
20
:
24
].
lower
()
from_id
=
line
[
20
:
24
].
lower
()
to_id
=
line
[
29
:
33
].
lower
()
to_id
=
line
[
29
:
33
].
lower
()
result
[
from_id
]
=
to_id
result
[
from_id
]
=
to_id
return
result
return
_replace_obsolete_references
(
result
)
def
generate_release_dates_cache
(
mmcif_dir
:
str
,
out_path
:
str
):
def
generate_release_dates_cache
(
mmcif_dir
:
str
,
out_path
:
str
):
...
...
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