Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlphaPulldown-ModelCIF-Conversion
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Bienchen
AlphaPulldown-ModelCIF-Conversion
Commits
983c4615
Commit
983c4615
authored
1 year ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
New argument --monomer_objects_dir
parent
5509eae6
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
convert_to_modelcif.py
+25
-11
25 additions, 11 deletions
convert_to_modelcif.py
with
25 additions
and
11 deletions
convert_to_modelcif.py
+
25
−
11
View file @
983c4615
...
...
@@ -27,6 +27,8 @@ import modelcif.dumper
import
modelcif.model
import
modelcif.protocol
from
alphapulldown.utils
import
make_dir_monomer_dictionary
# ToDo: Get options properly, best get the same names as used in existing
# scripts, e.g. could '--monomer_objects_dir' be used as feature
# directory/ directory with the feature JSON files?
...
...
@@ -43,17 +45,25 @@ import modelcif.protocol
# ToDo: Example 1 from the GitHub repo mentions MMseqs2
# ToDo: Discuss input of protocol steps, feature creation has baits, sequences
# does modelling depend on mode?
# ToDo: check that PAE files are written to an associated file
# ToDo: deal with `--max_template_date`, beta-barrel project has it as software
# parameter
flags
.
DEFINE_string
(
"
ap_output
"
,
None
,
"
AlphaPulldown pipeline output directory.
"
"
ap_output
"
,
None
,
"
AlphaPulldown pipeline output directory
"
)
flags
.
DEFINE_list
(
"
monomer_objects_dir
"
,
None
,
"
a list of directories where monomer objects are stored
"
,
)
flags
.
DEFINE_integer
(
"
model_selected
"
,
None
,
"
M
odel to be converted into ModelCIF, use
'
--select_all
'
to convert all
"
"
m
odel to be converted into ModelCIF, use
'
--select_all
'
to convert all
"
+
"
models found in
'
--af2_output
'"
,
)
flags
.
DEFINE_bool
(
"
compress
"
,
False
,
"
C
ompress the ModelCIF file using Gzip
"
)
flags
.
mark_flags_as_required
([
"
ap_output
"
])
flags
.
DEFINE_bool
(
"
compress
"
,
False
,
"
c
ompress the ModelCIF file using Gzip
"
)
flags
.
mark_flags_as_required
([
"
ap_output
"
,
"
monomer_objects_dir
"
])
FLAGS
=
flags
.
FLAGS
...
...
@@ -535,19 +545,19 @@ def _get_model_details(cmplx_name: str, data_json: dict) -> str:
def
_get_feature_metadata
(
modelcif_json
:
dict
,
cmplx_name
:
str
,
prj_dir
:
str
modelcif_json
:
dict
,
cmplx_name
:
str
,
monomer_objects_dir
:
list
,
)
->
list
:
"""
Read metadata from a feature JSON file.
"""
cmplx_name
=
cmplx_name
.
split
(
"
_and_
"
)
prj_dir
=
os
.
path
.
join
(
prj_dir
,
"
features_monomers
"
)
if
not
os
.
path
.
isdir
(
prj_dir
):
logging
.
info
(
f
"
No feature directory
'
{
prj_dir
}
'
found.
"
)
sys
.
exit
()
mnmr_obj_fls
=
make_dir_monomer_dictionary
(
monomer_objects_dir
)
if
"
__meta__
"
not
in
modelcif_json
:
modelcif_json
[
"
__meta__
"
]
=
{}
for
mnmr
in
cmplx_name
:
modelcif_json
[
"
__meta__
"
][
mnmr
]
=
{}
feature_json
=
os
.
path
.
join
(
prj_dir
,
f
"
{
mnmr
}
_feature_metadata.json
"
)
feature_json
=
f
"
{
mnmr
}
_feature_metadata.json
"
feature_json
=
os
.
path
.
join
(
mnmr_obj_fls
[
feature_json
],
feature_json
)
if
not
os
.
path
.
isfile
(
feature_json
):
logging
.
info
(
f
"
No feature metadata file
'
{
feature_json
}
'
found.
"
)
sys
.
exit
()
...
...
@@ -826,6 +836,7 @@ def alphapulldown_model_to_modelcif(
mdl
:
tuple
,
out_dir
:
str
,
prj_dir
:
str
,
monomer_objects_dir
:
list
,
compress
:
bool
=
False
,
)
->
None
:
"""
Convert an AlphaPulldown model into a ModelCIF formatted mmCIF file.
...
...
@@ -836,7 +847,9 @@ def alphapulldown_model_to_modelcif(
# ToDo: ENABLE logging.info(f"Processing '{mdl[0]}'...")
modelcif_json
=
{}
# fetch metadata
cmplx_name
=
_get_feature_metadata
(
modelcif_json
,
cmplx_name
,
prj_dir
)
cmplx_name
=
_get_feature_metadata
(
modelcif_json
,
cmplx_name
,
monomer_objects_dir
)
# fetch/ assemble more data about the modelling experiment
_get_model_info
(
modelcif_json
,
...
...
@@ -963,6 +976,7 @@ def main(argv):
mdl
,
model_dir
,
FLAGS
.
ap_output
,
FLAGS
.
monomer_objects_dir
,
FLAGS
.
compress
,
)
...
...
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