Constrained Sankoff Algorithm. Panel A: A cartoon depicting an example problem with four pins shown as dumbbells, labeled q
to qz+3, which connect the two sequences. The indices i, a, and j are positions in the first sequence x; k, b, and l are positions in the second sequence y. The corresponding segment edges
for each position in x are labeled. In this notation, j is the potential base pairing partner of i, l is the potential base pairing partner of k, and the subsequence i...j aligns with k...l. The indices a and b are the required for identifying bifurcation points. Panel B: The constrained structural alignment algorithm in pseudocode, where M is the length of sequence x,
(i) is the left edge of the segment containing the position i, and
(i) is the right edge of the segment containing i. The max in the range for l is required to handle the case where i and j share the same segment. The b range must be handled similarly. Panel C: The special case where the position under consideration is equivalent to a pin. In this case, we know the location of its alignment partner but must also consider the possibility of insertions in y which may occur before or after this pin.