MFE_calculator¶
Attributes¶
Classes¶
An RNA folding algorithm and parameters |
|
An RNA folding algorithm and parameters |
|
An RNA folding algorithm and parameters |
|
An RNA folding solution and working data |
|
An RNA folding solution and working data |
|
An RNA folding solution and working data |
Module Contents¶
- class MFE_calculator.RNAFolder(loop_min=0, energies=None)¶
Bases:
RNAFolderBase2An RNA folding algorithm and parameters
An instance holds all the configuration necessary to solve an RNA folding problem. Note that energies are the free-energy (a more negative value for the more favourable pairings).
- solve(rna)¶
- Parameters:
rna (str)
- class MFE_calculator.RNAFolderBase(loop_min=0, energies=None)¶
An RNA folding algorithm and parameters
An instance holds all the configuration necessary to solve an RNA folding problem. Note that energies are the free-energy (a more negative value for the more favourable pairings).
- MAX_BULGE = 20¶
- MAX_HAIRPIN = 20¶
- MAX_INTERNAL = 20¶
- static _helix_lookups(energies)¶
Create look-up tables for free energy in helices
- Parameters:
energies (dict)
- static _interpolated_table(energies, size, key, fmt='02d')¶
Read values key01, key02, … to array interpolating missing values.
We use this to encode e.g. the hairpin loop energies in a table we can use incrementally during minimisation.
- Parameters:
energies (dict)
size (int)
key (str)
fmt (str)
- Return type:
numpy.ndarray
- static _loop_lookups(energies)¶
Create look-up tables for loop free energy in loops
- Parameters:
energies (dict)
- static _special_lookups(energies, dflt=None)¶
Get misc special free energy parameters
- Parameters:
energies (dict)
- lmin = 0¶
- non_pairing = None¶
- print_hairpin_fe(n)¶
- Parameters:
n (int)
- print_stack_fe(rp, sp)¶
- Parameters:
rp (str)
sp (str)
- print_term_fe(rp, an, bn)¶
- Parameters:
rp (str)
an (str)
bn (str)
- class MFE_calculator.RNAFolderBase2(loop_min=0, energies=None)¶
Bases:
RNAFolderBaseAn RNA folding algorithm and parameters
An instance holds all the configuration necessary to solve an RNA folding problem. Note that energies are the free-energy (a more negative value for the more favourable pairings).
- closed_energy(soln, i, j)¶
Minimum energy and mode of [i, j] closed by pairing (i,j).
If the pair is forbidden (not AU, CG, GC, GU, UA or UG) the method returns the self.non_pairing energy (normally math.inf), and the returned mode is -1. Otherwise, the method compares the minimum energy obtained by pairing (i,j) across [i+1, j-1] considered as open and closed, and returns the lower energy and mode (0=open, 1=closed).
- Parameters:
soln (RNASolution)
i (int)
j (int)
- Return type:
tuple[float, int]
- open_energy(soln, i, j)¶
Minimum energy of [i, j] without pairing (i,j).
The method seeks a lowest energy for [i,j], considering j unpaired or paired with any interior nucleotide k, where i<k<j.
- Parameters:
soln (RNASolution)
i (int)
j (int)
- Return type:
tuple[float, int]
- class MFE_calculator.RNASolution(rna)¶
Bases:
RNASolutionBase2An RNA folding solution and working data
An instance holds the working data used when solving an RNA folding problem, and afterwards to generate. various expressions of the solution.
- Parameters:
rna (str)
- as_dots()¶
Dot-bracket form of the fold
- walk_range(i, j)¶
Walk the range [i,j] inclusive using min(U,V).
We use this when backtracking the energy calculation to discover the lowest energy structure, in contexts where we know the subsequent energy calculation will have chosen the lesser of the closed (j pairs with i) and open (j pairs with something else or is unpaired) energy.
- walk_range_ex(i, j, closed)¶
Walk the range [i,j] inclusive specifying open or closed.
We use this when backtracking the energy calculation to discover the lowest energy structure. Nodes (the data for a range) in our algorithm offer both closed (j pairs with a) and open (j pairs with something else or is unpaired) energy, and a subsequent nodes choose between them in offering their own energies. When backtracking, determining the structure of [i,j] in the minimum energy configuration may be informed by knowledge of that choice, provided through the ‘closed’ argument.
- Parameters:
i (int)
j (int)
- class MFE_calculator.RNASolutionBase(rna)¶
An RNA folding solution and working data
An instance holds the working data used when solving an RNA folding problem, and afterwards to generate. various expressions of the solution.
- Parameters:
rna (str)
- K¶
- M¶
- U¶
- V¶
- energy()¶
The free energy of the minimum energy solution
- getK(i, j)¶
- Return type:
int
- getM(i, j)¶
- Return type:
int
- getU(i, j)¶
- Return type:
float
- getV(i, j)¶
- Return type:
float
- irna¶
- class MFE_calculator.RNASolutionBase2(rna)¶
Bases:
RNASolutionBaseAn RNA folding solution and working data
An instance holds the working data used when solving an RNA folding problem, and afterwards to generate. various expressions of the solution.
- Parameters:
rna (str)
- branches(i, j)¶
Enumerate the branches in the open interval [i,j].
When we consider the energy freed by potential pair (i-1,j+1), we must understand what open structure it “closes”. It is enough to list the branches (helices) chosen when forming the open conformation of [i,j], each identified by its initial pair, in ascending order of first member.
The number of branches distingishes 0: hairpin, 1: internal or bulge loop, and >1: multiloop, while in case 1 the differences between the ends of the proposed closing and those of the single base pair distinguish amongst bulges, interior and muylti-branch loops. A single branch does not signify helix continuation, since that is a closed structure.
- Parameters:
i (int)
j (int)
- Return type:
list[tuple]
- get_arrays()¶
Get references to the K, U and V arrays
- Return type:
tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]
- MFE_calculator._PAIRS = ('AU', 'CG', 'GC', 'GU', 'UA', 'UG')¶