# H/part_func_co.h File Reference

Partition function for two RNA sequences. More...

Include dependency graph for part_func_co.h:

Go to the source code of this file.

## Functions
cofoldF | co_pf_fold (char *sequence, char *structure)
| Calculate partition function and base pair probabilities.
cofoldF | co_pf_fold_par (char *sequence, char *structure, pf_paramT *parameters, int calculate_bppm, int is_constrained)
| Calculate partition function and base pair probabilities.
FLT_OR_DBL * | export_co_bppm (void)
| Get a pointer to the base pair probability array.
void | free_co_pf_arrays (void)
| Free the memory occupied by co_pf_fold().
void | update_co_pf_params (int length)
| Recalculate energy parameters.
void | update_co_pf_params_par (int length, pf_paramT *parameters)
| Recalculate energy parameters.
void | compute_probabilities (double FAB, double FEA, double FEB, struct plist *prAB, struct plist *prA, struct plist *prB, int Alength)
| Compute Boltzmann probabilities of dimerization without homodimers.
ConcEnt * | get_concentrations (double FEAB, double FEAA, double FEBB, double FEA, double FEB, double *startconc)
| Given two start monomer concentrations a and b, compute the concentrations in thermodynamic equilibrium of all dimers and the monomers.
plist * | get_plist (struct plist *pl, int length, double cut_off)
| DO NOT USE THIS FUNCTION ANYMORE.
void | init_co_pf_fold (int length)
| DO NOT USE THIS FUNCTION ANYMORE.
## Variables
int | mirnatog
| Toggles no intrabp in 2nd mol.
double | F_monomer [2]
| Free energies of the two monomers.

## Detailed Description

Partition function for two RNA sequences.

As for folding one RNA molecule, this computes the partition function of all possible structures and the base pair probabilities. Uses the same global pf_scale variable to avoid overflows.

To simplify the implementation the partition function computation is done internally in a null model that does not include the duplex initiation energy, i.e. the entropic penalty for producing a dimer from two monomers). The resulting free energies and pair probabilities are initially relative to that null model. In a second step the free energies can be corrected to include the dimerization penalty, and the pair probabilities can be divided into the conditional pair probabilities given that a re dimer is formed or not formed.

After computing the partition functions of all possible dimeres one can compute the probabilities of base pairs, the concentrations out of start concentrations and sofar and soaway.

Dimer formation is inherently concentration dependent. Given the free energies of the monomers A and B and dimers AB, AA, and BB one can compute the equilibrium concentrations, given input concentrations of A and B, see e.g. Dimitrov & Zuker (2004)

## Function Documentation

cofoldF co_pf_fold | ( | char * | sequence,
|  | char * | structure |
| ) |  |  |

Calculate partition function and base pair probabilities.

This is the cofold partition function folding. The second molecule starts at the cut_point nucleotide.

Note:
  OpenMP: Since this function relies on the global parameters do_backtrack, dangles, temperature and pf_scale it is not threadsafe according to concurrent changes in these variables! Use co_pf_fold_par() instead to circumvent this issue.

See also:
  co_pf_fold_par()

Parameters:

    | sequence | Concatenated RNA sequences Parameters:
    | structure | Will hold the structure or constraints Returns: cofoldF structure containing a set of energies needed for concentration computations.

cofoldF co_pf_fold_par | ( | char * | sequence,
|  | char * | structure,
|  | pf_paramT * | parameters,
|  | int | calculate_bppm,
|  | int | is_constrained |
| ) |  |  |

Calculate partition function and base pair probabilities.

This is the cofold partition function folding. The second molecule starts at the cut_point nucleotide.

See also:
  get_boltzmann_factors(), co_pf_fold()

Parameters:

    | sequence | Concatenated RNA sequences Parameters:
      | structure | Pointer to the structure constraint Parameters:
        | parameters | Data structure containing the precalculated Boltzmann factors Parameters:
          | calculate_bppm | Switch to turn Base pair probability calculations on/off (0==off) Parameters:
          | is_constrained | Switch to indicate that a structure contraint is passed via the structure argument (0==off) Returns: cofoldF structure containing a set of energies needed for concentration computations.

FLT_OR_DBL* export_co_bppm | ( | void |  | ) |

Get a pointer to the base pair probability array.

Accessing the base pair probabilities for a pair (i,j) is achieved by

    FLT_OR_DBL *pr = export_bppm(); pr_ij = pr[iindx[i]-j];

See also:
  get_iindx()

Returns:
  A pointer to the base pair probability array

void update_co_pf_params | ( | int | length | ) |

Recalculate energy parameters.

This function recalculates all energy parameters given the current model settings.

Note:
  This function relies on the global variables pf_scale, dangles and temperature. Thus it might not be threadsafe in certain situations. Use update_co_pf_params_par() instead.

See also:
  get_boltzmann_factors(), update_co_pf_params_par()

Parameters:

  | length | Length of the current RNA sequence

void update_co_pf_params_par | ( | int | length,
|  | pf_paramT * | parameters |
| ) |  |  |

Recalculate energy parameters.

This function recalculates all energy parameters given the current model settings. It's second argument can either be NULL or a data structure containing the precomputed Boltzmann factors. In the first scenario, the necessary data structure will be created automatically according to the current global model settings, i.e. this mode might not be threadsafe. However, if the provided data structure is not NULL, threadsafety for the model parameters dangles, pf_scale and temperature is regained, since their values are taken from this data structure during subsequent calculations.

See also:
  get_boltzmann_factors(), update_co_pf_params()

Parameters:

    | length | Length of the current RNA sequence Parameters:
    | parameters | data structure containing the precomputed Boltzmann factors

void compute_probabilities | ( | double | FAB,
|  | double | FEA,
|  | double | FEB,
|  | struct plist * | prAB,
|  | struct plist * | prA,
|  | struct plist * | prB,
|  | int | Alength |
| ) |  |  |

Compute Boltzmann probabilities of dimerization without homodimers.

Given the pair probabilities and free energies (in the null model) for a dimer AB and the two constituent monomers A and B, compute the conditional pair probabilities given that a dimer AB actually forms. Null model pair probabilities are given as a list as produced by assign_plist_from_pr(), the dimer probabilities 'prAB' are modified in place.

Parameters:

    | FAB | free energy of dimer AB Parameters:
      | FEA | free energy of monomer A Parameters:
        | FEB | free energy of monomer B Parameters:
          | prAB | pair probabilities for dimer Parameters:
            | prA | pair probabilities monomer Parameters:
              | prB | pair probabilities monomer Parameters:
              | Alength | Length of molecule A

ConcEnt* get_concentrations | ( | double | FEAB,
|  | double | FEAA,
|  | double | FEBB,
|  | double | FEA,
|  | double | FEB,
|  | double * | startconc |
| ) |  |  |

Given two start monomer concentrations a and b, compute the concentrations in thermodynamic equilibrium of all dimers and the monomers.

This function takes an array 'startconc' of input concentrations with alternating entries for the initial concentrations of molecules A and B (terminated by two zeroes), then computes the resulting equilibrium concentrations from the free energies for the dimers. Dimer free energies should be the dimer-only free energies, i.e. the FcAB entries from the cofoldF struct.

Parameters:

    | FEAB | Free energy of AB dimer (FcAB entry) Parameters:
      | FEAA | Free energy of AA dimer (FcAB entry) Parameters:
        | FEBB | Free energy of BB dimer (FcAB entry) Parameters:
          | FEA | Free energy of monomer A Parameters:
            | FEB | Free energy of monomer B Parameters:
            | startconc | List of start concentrations [a0],[b0],[a1],[b1],...,[an][bn],[0],[0] Returns: ConcEnt array containing the equilibrium energies and start concentrations

plist* get_plist | ( | struct plist * | pl,
|  | int | length,
|  | double | cut_off |
| ) |  |  |

DO NOT USE THIS FUNCTION ANYMORE.

Deprecated:
  { This function is deprecated and will be removed soon!} use assign_plist_from_pr() instead!

void init_co_pf_fold | ( | int | length | ) |

DO NOT USE THIS FUNCTION ANYMORE.

Deprecated:
  { This function is deprecated and will be removed soon!}