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
ModelZoo
FastFold_pytorch
Commits
5a8e93b4
Commit
5a8e93b4
authored
Apr 21, 2023
by
zhuwenwen
Browse files
initial fastfold
parent
6b624a21
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
27 deletions
+43
-27
inference.py
inference.py
+43
-27
No files found.
inference.py
View file @
5a8e93b4
...
@@ -227,9 +227,11 @@ def inference_multimer_model(args):
...
@@ -227,9 +227,11 @@ def inference_multimer_model(args):
)
)
output_dir_base
=
args
.
output_dir
output_dir_base
=
args
.
output_dir
random_seed
=
args
.
data_random_seed
random_seed
=
args
.
data_random_seed
if
random_seed
is
None
:
if
random_seed
is
None
:
random_seed
=
random
.
randrange
(
sys
.
maxsize
)
random_seed
=
random
.
randrange
(
sys
.
maxsize
)
# seed_torch(seed=1029)
feature_processor
=
feature_pipeline
.
FeaturePipeline
(
feature_processor
=
feature_pipeline
.
FeaturePipeline
(
config
.
data
config
.
data
...
@@ -312,6 +314,7 @@ def inference_multimer_model(args):
...
@@ -312,6 +314,7 @@ def inference_multimer_model(args):
with
open
(
unrelaxed_output_path
,
'w'
)
as
f
:
with
open
(
unrelaxed_output_path
,
'w'
)
as
f
:
f
.
write
(
protein
.
to_pdb
(
unrelaxed_protein
))
f
.
write
(
protein
.
to_pdb
(
unrelaxed_protein
))
if
(
args
.
relaxation
):
amber_relaxer
=
relax
.
AmberRelaxation
(
amber_relaxer
=
relax
.
AmberRelaxation
(
use_gpu
=
True
,
use_gpu
=
True
,
**
config
.
relax
,
**
config
.
relax
,
...
@@ -328,6 +331,15 @@ def inference_multimer_model(args):
...
@@ -328,6 +331,15 @@ def inference_multimer_model(args):
with
open
(
relaxed_output_path
,
'w'
)
as
f
:
with
open
(
relaxed_output_path
,
'w'
)
as
f
:
f
.
write
(
relaxed_pdb_str
)
f
.
write
(
relaxed_pdb_str
)
if
(
args
.
save_outputs
):
output_dict_path
=
os
.
path
.
join
(
args
.
output_dir
,
f
'
{
tag
}
_
{
args
.
model_name
}
_output_dict.pkl'
)
with
open
(
output_dict_path
,
"wb"
)
as
fp
:
pickle
.
dump
(
out
,
fp
,
protocol
=
pickle
.
HIGHEST_PROTOCOL
)
logger
.
info
(
f
"Model output written to
{
output_dict_path
}
..."
)
def
inference_monomer_model
(
args
):
def
inference_monomer_model
(
args
):
print
(
"running in monomer mode..."
)
print
(
"running in monomer mode..."
)
...
@@ -454,6 +466,7 @@ def inference_monomer_model(args):
...
@@ -454,6 +466,7 @@ def inference_monomer_model(args):
with
open
(
unrelaxed_output_path
,
'w'
)
as
f
:
with
open
(
unrelaxed_output_path
,
'w'
)
as
f
:
f
.
write
(
protein
.
to_pdb
(
unrelaxed_protein
))
f
.
write
(
protein
.
to_pdb
(
unrelaxed_protein
))
if
(
args
.
relaxation
):
amber_relaxer
=
relax
.
AmberRelaxation
(
amber_relaxer
=
relax
.
AmberRelaxation
(
use_gpu
=
True
,
use_gpu
=
True
,
**
config
.
relax
,
**
config
.
relax
,
...
@@ -512,6 +525,9 @@ if __name__ == "__main__":
...
@@ -512,6 +525,9 @@ if __name__ == "__main__":
help
=
"""Path to model parameters. If None, parameters are selected
help
=
"""Path to model parameters. If None, parameters are selected
automatically according to the model name from
automatically according to the model name from
./data/params"""
)
./data/params"""
)
parser
.
add_argument
(
"--relaxation"
,
action
=
"store_false"
,
default
=
False
,
)
parser
.
add_argument
(
parser
.
add_argument
(
"--save_outputs"
,
action
=
"store_true"
,
default
=
False
,
"--save_outputs"
,
action
=
"store_true"
,
default
=
False
,
help
=
"Whether to save all model outputs, including embeddings, etc."
help
=
"Whether to save all model outputs, including embeddings, etc."
...
...
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