Module nimna_subopt

Module nimna_subopt

Subopt

This module provides procedures for suboptimal nucleic acid folding. Given a Compound and a maximum energy deviation from the minimum free energy given in integer multiples of 0.01 kcal / mol, one can compute a set of suboptimal solutions to the folding problem within that range.

Example usage

Let's say we have a possibly multi-stable RNA sequence and want to see all solutions within 1 kcal / mol of the minimum free energy at 37 °C, as that is the temperature we would like to use it at.

import strformat
import nimna

let
  rnaOfInterest = compound"... the sequence ...".update settings(
    temperature = 37.0 # Set the temperature.
  )
  solutions = rnaOfInterest.suboptimals(100) # Get the suboptimal solutions.

## Iterate over the solutions and retrieve their information:
for (energy, structure) in solutions:
  echo fmt"Fold with energy: {energy} [kcal / mol] and structure: {structure}"

Procs

proc suboptimals(c: Compound; delta: int = 10; sorted: bool = true): Suboptimals {.
raises: [], tags: []
.}
Generates suboptimal folds of the Compound, with distance of delta * 0.01 kcal / mol from the optimum. If sorted is set to true, those are sorted by ascending free energy.
proc `[]`(so: Suboptimals; idx: int): tuple[E: float, struc: string] {.
raises: [IndexError], tags: []
.}
Bracket accessor for Suboptimals.

Iterators

iterator items(so: Suboptimals): tuple[E: float, struc: string] {.
raises: [IndexError], tags: []
.}
Iterates over items in a set of Suboptimals, including their energy and structure.
iterator pairs(so: Suboptimals): tuple[key: int, val: tuple[E: float, struc: string]] {.
raises: [IndexError], tags: []
.}
Iterates over itens in a set of Suboptimals, as well as their position in the set.

Templates

template E(f: Fold): float
Retrieves the energy of a Fold.
template struc(f: Fold): string
Retrieves the secondary structure of a Fold.