Module nimna_constraints_soft

Module nimna_constraints_soft

Soft

This module provides facilities to implement soft constraints into the folding process. It allows to assign energy advantages or penalties to given base pairings and secondary structures and to thus influence folding based on prior knowledge on folding energies adapted to specific experimental conditions.

Example usage

We know that a specific set of base pairs is stabilized by interaction with the experimental environment (solvents, ligands, whatever else), with a free energy of :math:-0.05 frac{kcal}{mol}. Thus, we use preferPaired with these base pairs.

import nimna

const advantage = -0.05

var
  # The list of affected base pairs.
  affectedBasePairs: seq[tuple[i, j: int]] = ...
  # A compound to be folded.
  sequence: Compound = ...

# Give those base pairs an energy advantage.
for i, j in affectedBasePairs:
  sequence.preferPaired(i, j, advantage)

Procs

proc preferUnpaired(c: Compound; position: int; energy: float;
                   option: ConstraintOption = vccAllLoops): Compound {.
discardable, raises: [], tags: []
.}
Adds a soft constraint leaving a base at position unpaired with pseudo free energy (energy) to a Compound.
proc preferUnpaired(c: Compound; energies: openArray[float];
                   option: ConstraintOption = vccAllLoops): Compound {.
discardable, raises: [], tags: []
.}
Sets unpaired constraint energies. Overrides all previous unpaired soft constraints.
proc preferPaired(c: Compound; i, j: int; energy: float;
                 option: ConstraintOption = vccAllLoops): Compound {.
discardable, raises: [], tags: []
.}
Adds a soft constraint leaving bases at positions i, j paired with each other with pseudo free energs (energy) to a Compound.
proc preferPaired[T: openArray[float]](c: Compound; energies: openArray[T];
                                     option: ConstraintOption = vccAllLoops): Compound {.
discardable
.}
Sets paired constraint energies. Overrides all previous paired soft constraints.
proc preferPaired(c: Compound; energies: openArray[float];
                 option: ConstraintOption = vccAllLoops): Compound {.
discardable, raises: [], tags: []
.}
Sets paired constraint energies. Overrides all previous paired soft constraints.
proc liftPreferences(c: Compound): Compound {.
discardable, raises: [], tags: []
.}
Resets all soft constraints on a Compound to their default value.
proc initPreferences(c: Compound): Compound {.
discardable, inline, raises: [], tags: []
.}
Initializes the soft constraint data structure in a Compound.