for base in basepairs[bp_pos]:
if base != pos:
opened_brackets.add(base)
notations[s] += _OPENING_BRACKETS[solution[bp_pos]]
return notations
After Change
// Each optimal pseudoknot order solution is represented in
// dot-bracket-notation
notations = [
bytearray(("."*length).encode()) for _ in range(len(pseudoknot_order))
]
for s, solution in enumerate(pseudoknot_order):
for basepair, order in zip(basepairs, solution):
notations[s][basepair[0]] = _OPENING_BRACKETS_BYTES[order]
notations[s][basepair[1]] = _CLOSING_BRACKETS_BYTES[order]
return [notation.decode() for notation in notations]
def base_pairs_from_dot_bracket(dot_bracket_notation):