Module nimna_constraints_hard

Module nimna_constraints_hard

Hard

This module implements hard constraints for Compound folding, i.e. allows you to force given bases to pair.

Example usage

We want part of a sequence to fold into a stem loop, and use hard constraints to accomplish that.

sequence & structure:
               T
           A       G
            C --- G
            G --- C
            C --- G
            G --- C
5' G A T C G        A A G 3'
constraint string: .....((((xxx))))...
'x' means base pairing is forbidden.
import nimna

var
  c = compound"GATCGGCGCATGGCGCAAG"
  (energy, structure) = c.constrain(".....((((xxx))))...").mfe

Procs

proc constrain(c: Compound; constraint: cstring;
              option: ConstraintOption = vcdbDefault): Compound {.
discardable, raises: [], tags: []
.}
Add a secondary structure <constraint> in "((((...))))" format to a Compound. Returns the compound for further processing.
proc forceUnpaired(c: Compound; position: int; option: ConstraintOption = vccAllLoops): Compound {.
discardable, raises: [], tags: []
.}
Add an unpaired constraint to the base at a position in the Compound.
proc forcePaired(c: Compound; i, j: int; option: ConstraintOption = vccAllLoops): Compound {.
discardable, raises: [], tags: []
.}
Add a paired constraint to the bases at a positions i and j in the Compound.
proc liftConstraints(c: Compound): Compound {.
discardable, raises: [], tags: []
.}
Lift all constraints from a Compound. Returns the Compound for further processing.
proc initConstraints(c: Compound): Compound {.
discardable, inline, raises: [], tags: []
.}

Templates

template constraintOption(x: varargs[ConstraintOption]): ConstraintOption
Merges a list of ConstraintOptions into a single ConstraintOption