Skip to content

Commit a55059e

Browse files
committed
Parallelize computation of seocndary structures
1 parent df60612 commit a55059e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

bin/sctm.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def main():
8383

8484
orig_predicted_backbones = glob(os.path.join(args.predicted, "*.pdb"))
8585
logging.info(
86-
f"Computing selfTM scores across {len(orig_predicted_backbones)} generated structures"
86+
f"Computing scTM scores across {len(orig_predicted_backbones)} generated structures"
8787
)
8888
orig_predicted_backbone_lens = {
8989
os.path.splitext(os.path.basename(f))[0]: get_pdb_length(f)
@@ -92,12 +92,14 @@ def main():
9292
orig_predicted_backbone_names = [
9393
os.path.splitext(os.path.basename(f))[0] for f in orig_predicted_backbones
9494
]
95-
orig_predicted_secondary_structs = {
96-
os.path.splitext(os.path.basename(f))[0]: count_structures_in_pdb(
97-
f, backend="psea"
95+
with mp.Pool(mp.cpu_count()) as pool:
96+
ss_counts = list(
97+
pool.map(count_structures_in_pdb, orig_predicted_backbones, chunksize=10)
9898
)
99-
for f in orig_predicted_backbones
100-
}
99+
orig_predicted_secondary_structs = {
100+
os.path.splitext(os.path.basename(f))[0]: s
101+
for f, s in zip(orig_predicted_backbones, ss_counts)
102+
}
101103

102104
# Match up the files
103105
pfunc = functools.partial(get_sctm_score, folded_dirname=Path(args.folded))

0 commit comments

Comments
 (0)