# Pairing\_probabilities behavior

**URL:** https://forum.eternagame.org/t/pairing-probabilities-behavior/5841
**Category:** Tools
**Tags:** pairing-probability, eternascript
**Created:** [September 28, 2026, 4:05pm UTC](https://forum.eternagame.org/t/pairing-probabilities-behavior/5841 "2026-09-28T16:05:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![AaronP](https://forum.eternagame.org/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@AaronP](https://forum.eternagame.org/u/AaronP)
#### Post date: [September 28, 2026, 4:05pm UTC](https://forum.eternagame.org/t/pairing-probabilities-behavior/5841/1 "2026-09-28T16:05:39Z")

</div>

I have playing with scripts that calculate pairing probabilities in an effort to find strategies other than free energy delta minimization when it occurred to me that most engines will return the same array for a mispairing sequence regardless of whether the given secstruct is a given target structure or the natural structure. As far as I can tell, NuPACK, Contrafold, Eternafold, EFTK, and all linearfold engines do this. I suspect the given array corresponds to the natural structure’s pairing probabilities.

However, Vienna 1 and 2 will return different probabilities if a natural or target structure is given, which is more intuitive to me since if an engine could predict parameters such as energy for any given structure, then I’d think it could give another parameter such as its pairing probability.

So my question is whether this behavior is intended or a result of the engine at a fundamental level, or is this due to an error in the pairing\_probabilities function for non-vienna engines or of the implementation of my own amateurish scripts?

---

<div class="post-metadata">

### Author: ![LFP6](https://forum.eternagame.org/user_avatar/forum.eternagame.org/lfp6/32/7_2.png) [@LFP6](https://forum.eternagame.org/u/LFP6)
#### Post date: [September 28, 2026, 4:36pm UTC](https://forum.eternagame.org/t/pairing-probabilities-behavior/5841/2 "2026-09-28T16:36:00Z")

</div>

Yeah this behavior is a bit weird. Technically what the pairing\_probabilities function is designed to return is actually the entire dot plot, which is both:

1. The computed pairing probabilities (ie, for this sequence, what is the probability that bases x and y will be paired?) - for pairs with bases i,j where i\>j
2. The base pair “matrix” of either the secondary structure you give it or, if none is provided, the MFE (natural) structure. IE, all of those pairs set to a probability of 1, with all other pairs as probability 0 - for pairs with bases i,j where i\<j

However this is not done consistently/correctly for all engines - the other engines fail to include (2) - you’ll notice it also doesn’t appear in the dot plot. 🙂 This isn’t intentional - I’d classify it as a bug. Also worth noting that for Vienna1/Vienna2 the values are actually the square root of their probabilities. See [Inconsistent dot plot/pairing probabilities behavior between Vienna/Vienna2 and everything else · Issue #803 · eternagame/EternaJS · GitHub](https://github.com/eternagame/EternaJS/issues/803) where I’m tracking that this all should eventually be fixed

---

<div class="post-metadata">

### Author: ![LFP6](https://forum.eternagame.org/user_avatar/forum.eternagame.org/lfp6/32/7_2.png) [@LFP6](https://forum.eternagame.org/u/LFP6)
#### Post date: [September 28, 2026, 4:41pm UTC](https://forum.eternagame.org/t/pairing-probabilities-behavior/5841/3 "2026-09-28T16:41:44Z")

</div>

Also in case it’s useful to clarify, pairing probabilities themselves are not relative to a given structure. It’s based on what’s called the _partition function_. The idea is that all possible structures for a given sequence have a probability relative to their free energy (and thermodynamically, that they will theoretically actually exist that portion of the time!), and so the probability of a given base pairing is the sum of the probabilities of all structures that include said base pair.

Note that this is NOT true for RNet-SS, which isn’t doing free energy calculations - it’s actually predicting the liklihood that any to pairs will be present, assuming a single static secondary structure, based on what it’s seen in prior examples.
