# The Dynamic Programming Matrices

  This module provides interfaces that deal with creation and destruction of dynamic programming matrices used within the RNAlib.

  Typedefs

  typedef struct vrna_mx_mfe_s vrna_mx_mfe_t
    #include <ViennaRNA/dp_matrices.h>

    Typename for the Minimum Free Energy (MFE) DP matrices data structure vrna_mx_mfe_s.

  typedef struct vrna_mx_pf_s vrna_mx_pf_t
    #include <ViennaRNA/dp_matrices.h>

    Typename for the Partition Function (PF) DP matrices data structure vrna_mx_pf_s.

  Enums

  enum vrna_mx_type_e

    An enumerator that is used to specify the type of a polymorphic Dynamic Programming (DP) matrix data structure.

    See also

    vrna_mx_mfe_t, vrna_mx_pf_t

    Values:

    enumerator VRNA_MX_DEFAULT

      Default DP matrices.

    enumerator VRNA_MX_WINDOW

      DP matrices suitable for local structure prediction using window approach.

      See also

      vrna_mfe_window(), vrna_mfe_window_zscore(), pfl_fold()

    enumerator VRNA_MX_2DFOLD

      DP matrices suitable for distance class partitioned structure prediction.

      See also

      vrna_mfe_TwoD(), vrna_pf_TwoD()

  Functions

  int vrna_mx_add(vrna_fold_compound_t *fc, vrna_mx_type_e type, unsigned int options)
    #include <ViennaRNA/dp_matrices.h>

    Add Dynamic Programming (DP) matrices (allocate memory)

    This function adds DP matrices of a specific type to the provided vrna_fold_compound_t, such that successive DP recursion can be applied. The function caller has to specify which type of DP matrix is requested, see vrna_mx_type_e, and what kind of recursive algorithm will be applied later on, using the parameters type, and options, respectively. For the latter, Minimum free energy (MFE), and Partition function (PF) computations are distinguished. A third option that may be passed is VRNA_OPTION_HYBRID, indicating that auxiliary DP arrays are required for RNA-RNA interaction prediction.

    See also

    vrna_mx_mfe_add(), vrna_mx_pf_add(), vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_fold_compound_free(), vrna_mx_pf_free(), vrna_mx_mfe_free(), vrna_mx_type_e, VRNA_OPTION_MFE, VRNA_OPTION_PF, VRNA_OPTION_HYBRID, VRNA_OPTION_EVAL_ONLY

    Note

    Usually, there is no need to call this function, since the constructors of vrna_fold_compound_t are handling all the DP matrix memory allocation.

    Parameters:

      - fc – The vrna_fold_compound_t that holds pointers to the DP matrices

      - type – The type of DP matrices requested

      - options – Option flags that specify the kind of DP matrices, such as MFE or PF arrays, and auxiliary requirements

    Returns:

      1 if DP matrices were properly allocated and attached, 0 otherwise

  int vrna_mx_mfe_add(vrna_fold_compound_t *fc, vrna_mx_type_e mx_type, unsigned int options)
    #include <ViennaRNA/dp_matrices.h>
  int vrna_mx_pf_add(vrna_fold_compound_t *fc, vrna_mx_type_e mx_type, unsigned int options)
    #include <ViennaRNA/dp_matrices.h>
  int vrna_mx_prepare(vrna_fold_compound_t *fc, unsigned int options)
    #include <ViennaRNA/dp_matrices.h>
  void vrna_mx_mfe_free(vrna_fold_compound_t *fc)
    #include <ViennaRNA/dp_matrices.h>

    Free memory occupied by the Minimum Free Energy (MFE) Dynamic Programming (DP) matrices.

    See also

    vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_fold_compound_free(), vrna_mx_pf_free()

    Parameters:

      - fc – The vrna_fold_compound_t storing the MFE DP matrices that are to be erased from memory

  void vrna_mx_pf_free(vrna_fold_compound_t *fc)
    #include <ViennaRNA/dp_matrices.h>

    Free memory occupied by the Partition Function (PF) Dynamic Programming (DP) matrices.

    See also

    vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_fold_compound_free(), vrna_mx_mfe_free()

    Parameters:

      - fc – The vrna_fold_compound_t storing the PF DP matrices that are to be erased from memory

  struct vrna_mx_mfe_s
    #include <ViennaRNA/dp_matrices.h>

    Minimum Free Energy (MFE) Dynamic Programming (DP) matrices data structure required within the vrna_fold_compound_t.

    Common fields for MFE matrices

    const vrna_mx_type_e type

      Type of the DP matrices

    unsigned int length

      Length of the sequence, therefore an indicator of the size of the DP matrices.

    unsigned int strands

      Number of strands

    Default DP matrices

    Note

    These data fields are available if

        vrna_mx_mfe_t.type == VRNA_MX_DEFAULT

    int *c

      Energy array, given that i-j pair.

    int *f5

      Energy of 5’ end.

    int *f3

      Energy of 3’ end.

    int **fms5

      Energy for connected interstrand configurations.

    int **fms3

      nergy for connected interstrand configurations

    int *fML

      Multi-loop auxiliary energy array.

    int *fM1

      Second ML array, only for unique multibrnach loop decomposition.

    int *fM2

      Energy for a multibranch loop region with exactly two stems, extending to 3’ end.

    int *ggg

      Energies of g-quadruplexes.

    int Fc

      Minimum Free Energy of entire circular RNA.

    int FcH

      Minimum Free Energy of hairpin loop cases in circular RNA.

    int FcI

      Minimum Free Energy of internal loop cases in circular RNA.

    int FcM

      Minimum Free Energy of multibranch loop cases in circular RNA.

    Local Folding DP matrices using window approach

    Note

    These data fields are available if

        vrna_mx_mfe_t.type == VRNA_MX_WINDOW

    int **c_local

      Energy array, given that i-j pair.

    int *f3_local

      Energy of 5’ end.

    int **fML_local

      Multi-loop auxiliary energy array.

    int **ggg_local

      Energies of g-quadruplexes.

    Distance Class DP matrices

    Note

    These data fields are available if

        vrna_mx_mfe_t.type == VRNA_MX_2DFOLD

    int ***E_F5
    int **l_min_F5
    int **l_max_F5
    int *k_min_F5
    int *k_max_F5
    int ***E_F3
    int **l_min_F3
    int **l_max_F3
    int *k_min_F3
    int *k_max_F3
    int ***E_C
    int **l_min_C
    int **l_max_C
    int *k_min_C
    int *k_max_C
    int ***E_M
    int **l_min_M
    int **l_max_M
    int *k_min_M
    int *k_max_M
    int ***E_M1
    int **l_min_M1
    int **l_max_M1
    int *k_min_M1
    int *k_max_M1
    int ***E_M2
    int **l_min_M2
    int **l_max_M2
    int *k_min_M2
    int *k_max_M2
    int **E_Fc
    int *l_min_Fc
    int *l_max_Fc
    int k_min_Fc
    int k_max_Fc
    int **E_FcH
    int *l_min_FcH
    int *l_max_FcH
    int k_min_FcH
    int k_max_FcH
    int **E_FcI
    int *l_min_FcI
    int *l_max_FcI
    int k_min_FcI
    int k_max_FcI
    int **E_FcM
    int *l_min_FcM
    int *l_max_FcM
    int k_min_FcM
    int k_max_FcM
    int *E_F5_rem
    int *E_F3_rem
    int *E_C_rem
    int *E_M_rem
    int *E_M1_rem
    int *E_M2_rem
    int E_Fc_rem
    int E_FcH_rem
    int E_FcI_rem
    int E_FcM_rem

    Public Members

    union vrna_mx_mfe_s
  struct vrna_mx_pf_s
    #include <ViennaRNA/dp_matrices.h>

    Partition function (PF) Dynamic Programming (DP) matrices data structure required within the vrna_fold_compound_t.

    Common fields for DP matrices

    const vrna_mx_type_e type

      Type of the DP matrices

    unsigned int length

      Size of the DP matrices (i.e. sequence length)

    FLT_OR_DBL *scale

      Boltzmann factor scaling

    FLT_OR_DBL *expMLbase

      Boltzmann factors for unpaired bases in multibranch loop

    Default PF matrices

    Note

    These data fields are available if

        vrna_mx_pf_t.type == VRNA_MX_DEFAULT

    FLT_OR_DBL *q
    FLT_OR_DBL *qb
    FLT_OR_DBL *qm
    FLT_OR_DBL *qm1
    FLT_OR_DBL *probs
    FLT_OR_DBL *q1k
    FLT_OR_DBL *qln
    FLT_OR_DBL *G
    FLT_OR_DBL qo
    FLT_OR_DBL *qm2
    FLT_OR_DBL qho
    FLT_OR_DBL qio
    FLT_OR_DBL qmo

    Local Folding DP matrices using window approach

    Note

    These data fields are available if

        vrna_mx_mfe_t.type == VRNA_MX_WINDOW

    FLT_OR_DBL **q_local
    FLT_OR_DBL **qb_local
    FLT_OR_DBL **qm_local
    FLT_OR_DBL **pR
    FLT_OR_DBL **qm2_local
    FLT_OR_DBL **QI5
    FLT_OR_DBL **q2l
    FLT_OR_DBL **qmb
    FLT_OR_DBL **G_local

    Distance Class DP matrices

    Note

    These data fields are available if

        vrna_mx_pf_t.type == VRNA_MX_2DFOLD

    FLT_OR_DBL ***Q
    int **l_min_Q
    int **l_max_Q
    int *k_min_Q
    int *k_max_Q
    FLT_OR_DBL ***Q_B
    int **l_min_Q_B
    int **l_max_Q_B
    int *k_min_Q_B
    int *k_max_Q_B
    FLT_OR_DBL ***Q_M
    int **l_min_Q_M
    int **l_max_Q_M
    int *k_min_Q_M
    int *k_max_Q_M
    FLT_OR_DBL ***Q_M1
    int **l_min_Q_M1
    int **l_max_Q_M1
    int *k_min_Q_M1
    int *k_max_Q_M1
    FLT_OR_DBL ***Q_M2
    int **l_min_Q_M2
    int **l_max_Q_M2
    int *k_min_Q_M2
    int *k_max_Q_M2
    FLT_OR_DBL **Q_c
    int *l_min_Q_c
    int *l_max_Q_c
    int k_min_Q_c
    int k_max_Q_c
    FLT_OR_DBL **Q_cH
    int *l_min_Q_cH
    int *l_max_Q_cH
    int k_min_Q_cH
    int k_max_Q_cH
    FLT_OR_DBL **Q_cI
    int *l_min_Q_cI
    int *l_max_Q_cI
    int k_min_Q_cI
    int k_max_Q_cI
    FLT_OR_DBL **Q_cM
    int *l_min_Q_cM
    int *l_max_Q_cM
    int k_min_Q_cM
    int k_max_Q_cM
    FLT_OR_DBL *Q_rem
    FLT_OR_DBL *Q_B_rem
    FLT_OR_DBL *Q_M_rem
    FLT_OR_DBL *Q_M1_rem
    FLT_OR_DBL *Q_M2_rem
    FLT_OR_DBL Q_c_rem
    FLT_OR_DBL Q_cH_rem
    FLT_OR_DBL Q_cI_rem
    FLT_OR_DBL Q_cM_rem

    Public Members

    union vrna_mx_pf_s