MCPcopy Create free account
hub / github.com/THUNLP-MT/MEAN / tm_score

Function tm_score

evaluation/tm_score.py:18–34  ·  view source on GitHub ↗
(chain1: Peptide, chain2: Peptide)

Source from the content-addressed store, hash-verified

16 os.makedirs(CACHE_DIR)
17
18def tm_score(chain1: Peptide, chain2: Peptide):
19 io, paths = PDBIO(), []
20 for i, chain in enumerate([chain1, chain2]):
21 chain_name = f'{time.time()}_{chain.get_id()}_{chain.seq[:20]}' # for concurrent conflicts
22 path = os.path.join(CACHE_DIR, f'{chain_name}.pdb')
23 paths.append(path)
24 chain = chain.to_bio()
25 io.set_structure(chain)
26 io.save(path)
27 p = os.popen(f'{TMEXEC} {paths[0]} {paths[1]}')
28 text = p.read()
29 p.close()
30 res = re.search(r'TM-score\s*= ([0-1]\.[0-9]+)', text)
31 score = float(res.group(1))
32 for path in paths:
33 os.remove(path)
34 return score

Callers 1

eval_oneFunction · 0.90

Calls 4

readMethod · 0.80
closeMethod · 0.80
get_idMethod · 0.45
to_bioMethod · 0.45

Tested by

no test coverage detected