# SHAPE Reactivity Data

Incorporate SHAPE reactivity structure probing data into the folding recursions by means of soft constraints.

Details for our implementation to incorporate SHAPE reactivity data to guide secondary structure prediction can be found in Lorenz et al. [2016].

  Functions

  int vrna_sc_SHAPE_to_pr(const char *shape_conversion, double *values, int length, double default_value)
    #include <ViennaRNA/probing/basic.h>

    Convert SHAPE reactivity values to probabilities for being unpaired.

    This function parses the informations from a given file and stores the result in the pre-allocated string sequence and the FLT_OR_DBL array values.

    See also

    vrna_file_SHAPE_read()

    Parameters:

      - shape_conversion – String defining the method used for the conversion process

      - values – Pointer to an array of SHAPE reactivities

      - length – Length of the array of SHAPE reactivities

      - default_value – Result used for position with invalid/missing reactivity values

  void vrna_constraints_add_SHAPE( vrna_fold_compound_t *fc, const char *shape_file, const char *shape_method, const char *shape_conversion, int verbose, unsigned int constraint_type)
    #include <ViennaRNA/probing/SHAPE.h>
  void vrna_constraints_add_SHAPE_ali( vrna_fold_compound_t *fc, const char *shape_method, const char **shape_files, const int *shape_file_association, int verbose, unsigned int constraint_type)
    #include <ViennaRNA/probing/SHAPE.h>
  int vrna_sc_add_SHAPE_deigan( vrna_fold_compound_t *fc, const double *reactivities, double m, double b, unsigned int options)
    #include <ViennaRNA/probing/SHAPE.h>

    Add SHAPE reactivity data as soft constraints (Deigan et al. method)

    This approach of SHAPE directed RNA folding uses the simple linear ansatz

    \[ \Delta G_{\text{SHAPE}}(i) = m \ln(\text{SHAPE reactivity}(i)+1)+ b \]

    to convert SHAPE reactivity values to pseudo energies whenever a nucleotide \( i \) contributes to a stacked pair. A positive slope \( m \) penalizes high reactivities in paired regions, while a negative intercept \( b \) results in a confirmatory `bonus’ free energy for correctly predicted base pairs. Since the energy evaluation of a base pair stack involves two pairs, the pseudo energies are added for all four contributing nucleotides. Consequently, the energy term is applied twice for pairs inside a helix and only once for pairs adjacent to other structures. For all other loop types the energy model remains unchanged even when the experimental data highly disagrees with a certain motif.

    SWIG Wrapper Notes:

      This function is attached as method `sc_add_SHAPE_deigan()` to objects of type `fold_compound`. See, e.g. `RNA.fold_compound.sc_add_SHAPE_deigan()` in the Python API .

    See also

    vrna_sc_remove(), vrna_sc_add_SHAPE_zarringhalam(), vrna_sc_minimize_pertubation()

    Note

    For further details, we refer to Deigan et al. [2009] .

    Parameters:

      - fc – The vrna_fold_compound_t the soft constraints are associated with

      - reactivities – A vector of normalized SHAPE reactivities

      - m – The slope of the conversion function

      - b – The intercept of the conversion function

      - options – The options flag indicating how/where to store the soft constraints

    Returns:

      1 on successful extraction of the method, 0 on errors

  int vrna_sc_add_SHAPE_deigan_ali( vrna_fold_compound_t *fc, const char **shape_files, const int *shape_file_association, double m, double b, unsigned int options)
    #include <ViennaRNA/probing/SHAPE.h>

    Add SHAPE reactivity data from files as soft constraints for consensus structure prediction (Deigan et al. method)

    SWIG Wrapper Notes:

      This function is attached as method `sc_add_SHAPE_deigan_ali()` to objects of type `fold_compound`. See, e.g. `RNA.fold_compound.sc_add_SHAPE_deigan_ali()` in the Python API .

    Parameters:

      - fc – The vrna_fold_compound_t the soft constraints are associated with

      - shape_files – A set of filenames that contain normalized SHAPE reactivity data

      - shape_file_association – An array of integers that associate the files with sequences in the alignment

      - m – The slope of the conversion function

      - b – The intercept of the conversion function

      - options – The options flag indicating how/where to store the soft constraints

    Returns:

      1 on successful extraction of the method, 0 on errors

  int vrna_sc_add_SHAPE_zarringhalam( vrna_fold_compound_t *fc, const double *reactivities, double b, double default_value, const char *shape_conversion, unsigned int options)
    #include <ViennaRNA/probing/SHAPE.h>

    Add SHAPE reactivity data as soft constraints (Zarringhalam et al. method)

    This method first converts the observed SHAPE reactivity of nucleotide \( i \) into a probability \( q_i \) that position \( i \) is unpaired by means of a non-linear map. Then pseudo-energies of the form

    \[ \Delta G_{\text{SHAPE}}(x,i) = \beta\ |x_i - q_i| \]

    are computed, where \( x_i=0 \) if position \( i \) is unpaired and \( x_i=1 \) if \( i \) is paired in a given secondary structure. The parameter \( \beta \) serves as scaling factor. The magnitude of discrepancy between prediction and experimental observation is represented by \( |x_i - q_i| \).

    SWIG Wrapper Notes:

      This function is attached as method `sc_add_SHAPE_zarringhalam()` to objects of type `fold_compound`. See, e.g. `RNA.fold_compound.sc_add_SHAPE_zarringhalam()` in the Python API .

    See also

    vrna_sc_remove(), vrna_sc_add_SHAPE_deigan(), vrna_sc_minimize_pertubation()

    Note

    For further details, we refer to Zarringhalam et al. [2012]

    Parameters:

      - fc – The vrna_fold_compound_t the soft constraints are associated with

      - reactivities – A vector of normalized SHAPE reactivities

      - b – The scaling factor \( \beta \) of the conversion function

      - default_value – The default value for a nucleotide where reactivity data is missing for

      - shape_conversion – A flag that specifies how to convert reactivities to probabilities

      - options – The options flag indicating how/where to store the soft constraints

    Returns:

      1 on successful extraction of the method, 0 on errors

  int vrna_sc_add_SHAPE_eddy_2( vrna_fold_compound_t *fc, const double *reactivities, int unpaired_nb, const double *unpaired_data, int paired_nb, const double *paired_data)
    #include <ViennaRNA/probing/SHAPE.h>

    Add SHAPE reactivity data as soft constraints (Eddy/RNAprob-2 method)

    This approach of SHAPE directed RNA folding uses the probability framework proposed by Eddy

    \[ \Delta G_{\text{SHAPE}}(i) = - RT\ln(\mathbb{P}(\text{SHAPE reactivity}(i)\mid x_i\pi_i))+ \]

    to convert SHAPE reactivity values to pseudo energies for given nucleotide \( x_i \) and pairedness \( \pi_i \) at position \( i \). The reactivity distribution is computed using Gaussian kernel density estimation (KDE) with bandwidth \( h \) computed using Scott factor

    \[ h = n^{-\frac{1}{5}} \]

    where \( n \) is the number of data points.

    Parameters:

      - fc – The vrna_fold_compound_t the soft constraints are associated with

      - reactivities – A vector of normalized SHAPE reactivities

      - unpaired_nb – Length of the array of unpaired SHAPE reactivities

      - unpaired_data – Pointer to an array of unpaired SHAPE reactivities

      - paired_nb – Length of the array of paired SHAPE reactivities

      - paired_data – Pointer to an array of paired SHAPE reactivities

    Returns:

      1 on successful extraction of the method, 0 on errors