INNER CODE UNIT · Python
_conf_to_pp
TimoLassmann/kalign · python-kalign/__init__.py:131
def _conf_to_pp(conf: float) -> str:
"""Convert a confidence value [0..1] to HMMER-style PP character."""
if conf >= 0.95:
return "*"
return str(int(conf * 10))
def _confidence_to_pp_string(seq: str, confidences: list) -> str:
"""Convert per-residue confidence array to PP string."""
pp = []
for ch, conf in zip(seq, confidences):
if ch == "-" or ch == ".":
pp.append(".")
else:
pp.append(_conf_to_pp(conf))
return "".join(pp)