Skip to content
Snippets Groups Projects
Commit 628a91e8 authored by B13nch3n's avatar B13nch3n
Browse files

Abort if model of requested rank is not found.

parent 31feca02
Branches
No related tags found
No related merge requests found
...@@ -46,9 +46,10 @@ def _parse_args(): ...@@ -46,9 +46,10 @@ def _parse_args():
+ "'<UniProtKB AC>-<UniProtKB AC>'", + "'<UniProtKB AC>-<UniProtKB AC>'",
) )
parser.add_argument( parser.add_argument(
"--rank", type=str, "--rank",
type=str,
default=None, default=None,
help="Only process the model with this rank." help="Only process the model with this rank.",
) )
parser.add_argument( parser.add_argument(
"--out_dir", "--out_dir",
...@@ -946,12 +947,14 @@ def _main(): ...@@ -946,12 +947,14 @@ def _main():
config_data = _parse_colabfold_config(cnfg) config_data = _parse_colabfold_config(cnfg)
# iterate model directory # iterate model directory
found_ranked = False
for fle in sorted(os.listdir(opts.model_dir)): for fle in sorted(os.listdir(opts.model_dir)):
# iterate PDB files # iterate PDB files
if not fle.endswith(".pdb"): if not fle.endswith(".pdb"):
continue continue
if opts.rank is not None and f"rank_{opts.rank}" not in fle: if opts.rank is not None and f"rank_{opts.rank}" not in fle:
continue continue
found_ranked = True
print(f" translating {fle}...") print(f" translating {fle}...")
pdb_start = timer() pdb_start = timer()
file_prfx, uid = _check_model_extra_files_present(opts.model_dir, fle) file_prfx, uid = _check_model_extra_files_present(opts.model_dir, fle)
...@@ -983,6 +986,8 @@ def _main(): ...@@ -983,6 +986,8 @@ def _main():
) )
print(f" ... done with {fle} ({timer()-pdb_start:.2f}s).") print(f" ... done with {fle} ({timer()-pdb_start:.2f}s).")
if opts.rank and not found_ranked:
_abort_msg(f"Could not find model of requested rank '{opts.rank}'")
print(f"... done with {opts.model_dir}.") print(f"... done with {opts.model_dir}.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment