RNA secondary structure includes regions where bases pair to form stems. Computational methods for predicting these structures use mathematical models of the interactions between bases. One formulation explored in quantum computing research represents candidate stems as binary decisions.
That formulation poses an interesting question for optimization: given candidate stems and a specified scoring rule, which subset can be selected without assigning the same base twice?
From a sequence to binary variables
A stem consists of a run of stacked base pairs. A candidate generation procedure can enumerate stems that satisfy specified pairing and loop-length rules. Each candidate receives a binary variable xᵢ. Selecting a stem sets its variable to one.
The objective can reward favorable individual stems and include interactions between pairs of selected stems. Its precise form depends on the scientific model. A general binary quadratic representation is
E(x) = sum_i a[i] * x[i] + sum_(i<j) b[i,j] * x[i] * x[j] A negative coefficient rewards selection in a minimization objective; a positive coefficient increases cost. The coefficients in a particular RNA model must come from that model's defined scoring rules.
Expressing incompatibility
Two stems that use the same base cannot both be selected under the model considered here. For every base position b, impose
sum_(i: stem i uses b) x[i] <= 1 This group constraint is equivalent to forbidding every overlapping pair. The group representation can be considerably smaller when many candidates share the same base. It also separates structural feasibility from the scientific scoring function.
Consider four hypothetical candidates whose occupied base positions and scores are defined below. The positions and scores are synthetic. This model allows crossings and checks base reuse only; loop rules, pseudoknot conventions and thermodynamic scoring must be specified for a biological prediction.
from itertools import product
bases = [{0, 1, 8, 9}, {1, 2, 7, 8},
{3, 4, 5, 6}, {4, 5, 10, 11}]
scores = [5, 6, 4, 3]
def feasible(x):
used = set()
for chosen, occupied in zip(x, bases):
if chosen and used.intersection(occupied):
return False
if chosen:
used.update(occupied)
return True
best = max((x for x in product((0, 1), repeat=len(bases))
if feasible(x)), key=lambda x: sum(a*b for a,b in zip(x,scores)))
assert best == (0, 1, 1, 0)
print(best) The example selects the second and third candidates, with scores 6 and 4. Adding quadratic interactions can change which compatible set has the best score. A solver can search that more general objective while retaining the same feasibility rules.
A meaningful computational reference
For small candidate sets, exhaustive enumeration establishes the exact optimum of the specified model. Larger cases can use a suitable exact method, mathematical bounds or a strong heuristic reference. Report the energy of the selected stems and independently validate their compatibility.
The mathematical optimum of a simplified stem-selection model is distinct from the accuracy of biological structure prediction. Established RNA folding methods use richer energy models and specialized algorithms. A useful comparison of quantum and classical approaches to a particular QUBO holds the candidate-generation rules and scoring function constant, then measures how well each computational method solves that same model.
This is one reason binary quadratic optimization can be useful in quantum research. The 4colors Optimizer for QUBO allows a quadratic scoring function and explicit linear constraints to be represented together, providing a classical reference for appropriately formulated experiments.
Further reading: Fox et al., “RNA folding using quantum computers,” PLOS Computational Biology (2022), doi:10.1371/journal.pcbi.1010032.