import os
import re


def tm_score(protein_path, ref_protein_path):
    p = os.popen(f'evaluation/TMscore {protein_path} {ref_protein_path}')
    text = p.read()
    p.close()
    res = re.search(r'TM-score\s*= ([0-1]\.[0-9]+)', text)
    score = float(res.group(1))
    return score