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
5d7b29d6
Unverified
Commit
5d7b29d6
authored
Jun 23, 2022
by
Gustaf Ahdritz
Committed by
GitHub
Jun 23, 2022
Browse files
Merge pull request #116 from brianloyal/main
Update input processing
parents
c871ccf3
9009c92a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
run_pretrained_openfold.py
run_pretrained_openfold.py
+6
-1
No files found.
run_pretrained_openfold.py
View file @
5d7b29d6
...
@@ -29,6 +29,7 @@ import random
...
@@ -29,6 +29,7 @@ import random
import
sys
import
sys
import
time
import
time
import
torch
import
torch
import
re
from
openfold.config
import
model_config
from
openfold.config
import
model_config
from
openfold.data
import
templates
,
feature_pipeline
,
data_pipeline
from
openfold.data
import
templates
,
feature_pipeline
,
data_pipeline
...
@@ -163,6 +164,7 @@ def prep_output(out, batch, feature_dict, feature_processor, args):
...
@@ -163,6 +164,7 @@ def prep_output(out, batch, feature_dict, feature_processor, args):
def
parse_fasta
(
data
):
def
parse_fasta
(
data
):
data
=
re
.
sub
(
'>$'
,
''
,
data
,
flags
=
re
.
M
)
lines
=
[
lines
=
[
l
.
replace
(
'
\n
'
,
''
)
l
.
replace
(
'
\n
'
,
''
)
for
prot
in
data
.
split
(
'>'
)
for
l
in
prot
.
strip
().
split
(
'
\n
'
,
1
)
for
prot
in
data
.
split
(
'>'
)
for
l
in
prot
.
strip
().
split
(
'
\n
'
,
1
)
...
@@ -272,6 +274,8 @@ def load_models_from_command_line(args, config):
...
@@ -272,6 +274,8 @@ def load_models_from_command_line(args, config):
"be specified."
"be specified."
)
)
def
list_files_with_extensions
(
dir
,
extensions
):
return
[
f
for
f
in
os
.
listdir
(
dir
)
if
f
.
endswith
(
extensions
)]
def
main
(
args
):
def
main
(
args
):
# Create the output directory
# Create the output directory
...
@@ -307,7 +311,8 @@ def main(args):
...
@@ -307,7 +311,8 @@ def main(args):
prediction_dir
=
os
.
path
.
join
(
args
.
output_dir
,
"predictions"
)
prediction_dir
=
os
.
path
.
join
(
args
.
output_dir
,
"predictions"
)
os
.
makedirs
(
prediction_dir
,
exist_ok
=
True
)
os
.
makedirs
(
prediction_dir
,
exist_ok
=
True
)
for
fasta_file
in
os
.
listdir
(
args
.
fasta_dir
):
for
fasta_file
in
list_files_with_extensions
(
args
.
fasta_dir
,
(
".fasta"
,
".fa"
)):
# Gather input sequences
with
open
(
os
.
path
.
join
(
args
.
fasta_dir
,
fasta_file
),
"r"
)
as
fp
:
with
open
(
os
.
path
.
join
(
args
.
fasta_dir
,
fasta_file
),
"r"
)
as
fp
:
data
=
fp
.
read
()
data
=
fp
.
read
()
...
...
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