# Compute the Structure with Maximum Expected Accuracy (MEA)

  Functions

  char *vrna_MEA(vrna_fold_compound_t *fc, double gamma, float *mea)
    #include <ViennaRNA/MEA.h>

    Compute a MEA (maximum expected accuracy) structure.

    The algorithm maximizes the expected accuracy

    \[ A(S) = \sum_{(i,j) \in S} 2 \gamma p_{ij} + \sum_{i \notin S} p^u_i \]

    Higher values of \(\gamma\) result in more base pairs of lower probability and thus higher sensitivity. Low values of \(\gamma\) result in structures containing only highly likely pairs (high specificity). The code of the MEA function also demonstrates the use of sparse dynamic programming scheme to reduce the time and memory complexity of folding.

    SWIG Wrapper Notes:

      This function is attached as overloaded method `MEA`(gamma = 1.) to objects of type `fold_compound`. Note, that it returns the MEA structure and MEA value as a tuple (MEA_structure, MEA). See, e.g. `RNA.fold_compound.MEA()` in the Python API.

    Parameters:

      - fc – The fold compound data structure with pre-filled base pair probability matrix

      - gamma – The weighting factor for base pairs vs. unpaired nucleotides

      - mea – A pointer to a variable where the MEA value will be written to

    Pre:

      vrna_pf() must be executed on input parameter `fc`

    Returns:

      An MEA structure (or NULL on any error)

  char *vrna_MEA_from_plist(vrna_ep_t *plist, const char *sequence, double gamma, vrna_md_t *md, float *mea)
    #include <ViennaRNA/MEA.h>

    Compute a MEA (maximum expected accuracy) structure from a list of probabilities.

    The algorithm maximizes the expected accuracy

    \[ A(S) = \sum_{(i,j) \in S} 2 \gamma p_{ij} + \sum_{i \notin S} p^u_i \]

    Higher values of \(\gamma\) result in more base pairs of lower probability and thus higher sensitivity. Low values of \(\gamma\) result in structures containing only highly likely pairs (high specificity). The code of the MEA function also demonstrates the use of sparse dynamic programming scheme to reduce the time and memory complexity of folding.

    SWIG Wrapper Notes:

      This function is available as overloaded function `MEA_from_plist`(gamma = 1., md = NULL). Note, that it returns the MEA structure and MEA value as a tuple (MEA_structure, MEA). See, e.g. `RNA.MEA_from_plist()` in the Python API.

    Note

    The unpaired probabilities \(p^u_i = 1 - \sum_{j \neq i} p_{ij}\) are usually computed from the supplied pairing probabilities \(p_{ij}\) as stored in `plist` entries of type VRNA_PLIST_TYPE_BASEPAIR. To overwrite individual \(p^u_o\) values simply add entries with type VRNA_PLIST_TYPE_UNPAIRED To include G-Quadruplex support, the corresponding field in `md` must be set.

    Parameters:

      - plist – A list of base pair probabilities the MEA structure is computed from

      - sequence – The RNA sequence that corresponds to the list of probability values

      - gamma – The weighting factor for base pairs vs. unpaired nucleotides

      - md – A model details data structure (maybe NULL)

      - mea – A pointer to a variable where the MEA value will be written to

    Returns:

      An MEA structure (or NULL on any error)

  float MEA(plist *p, char *structure, double gamma)
    #include <ViennaRNA/MEA.h>

    Computes a MEA (maximum expected accuracy) structure.

    The algorithm maximizes the expected accuracy

    \[ A(S) = \sum_{(i,j) \in S} 2 \gamma p_{ij} + \sum_{i \notin S} p^u_i \]

    Higher values of \(\gamma\) result in more base pairs of lower probability and thus higher sensitivity. Low values of \(\gamma\) result in structures containing only highly likely pairs (high specificity). The code of the MEA function also demonstrates the use of sparse dynamic programming scheme to reduce the time and memory complexity of folding.

    Deprecated:

      Use vrna_MEA() or vrna_MEA_from_plist() instead!