Energy minimization

I’ve been trying out ideas for puzzle solving scripts, and have come to the conclusion that it would be useful to implement energy minimization.

My understanding is that the folding engine finds the minimum energy configuration for a given sequence.  Eterna tackles the inverse problem, finding a sequence which gives a given configuration, which is the harder direction.  Now simply finding the minimum energy sequence for a given configuration isn’t going to do the job because of misfolds, but
(i) it would be a start and (ii) it’s likely to be no more difficult than the forward problem.

My idea is to have an script for energy minimization with constraints.  Constraints would include numbers of GU and GC pairs, but in addition, after a misfold occured, a constraint would be added to prevent it, and a new minimum energy found.  This idea of trials, adding extra constraints on failure is based on the way boolean satisfiability algorithms work, and they are amazingly successful.

What I don’t want to do is to reinvent the wheel.  Since Eterna includes folding engines, much of the energy minimization code must already be there, in particular the tables for energy parameters,  Is there any way to access these in a script?

1 Like

There is a library of Javascript functions available to EternaScripts.  Documentation for it is in the wiki.  It sounds to me like Lib.fold(sequence) and Lib.energyOfStruct(sequence, structure) are what you are looking for.  But this library was written some time ago, doesn’t give any choice of folding engine and (probably) doesn’t support any of ligands or oligos needed to deal with Johan’s lab switch puzzles.

The other possibility is Nando’s relatively new API to the folding engine in the flash game.  This API was designed to support game boosters, which are Eternascripts that get executed in the context of the flash game.  My guess is that it is your most promising starting point.

I’m wondering if you would find the folding engines themselves (Vienna/NuPack) useful. The source obviously has the parameters, and I think there’s a prediction utility built in from what I remember. Afaik they’re not directly usable via Flash currently. When we look at replacing Flash, it would be nice to get a full port to ASM.js or WebAssembly (i.e. Via Emscripten) directly available to scripts.