(Abstract) Data Structures — ViennaRNA Package

# (Abstract) Data Structures

All datastructures and typedefs shared among the ViennaRNA Package can be found here.

Specialized Modules:

- The Fold Compound
- The Dynamic Programming Matrices
- Hash Tables
- Heaps
- Arrays
- Strings
- Buffers

## Common Data Structures

  Typedefs

  typedef struct vrna_elem_prob_s vrna_plist_t

    Typename for the base pair list repesenting data structure vrna_elem_prob_s.

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct vrna_cpair_s vrna_cpair_t

    Typename for data structure vrna_cpair_s.

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct vrna_data_linear_s vrna_data_lin_t

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct vrna_color_s vrna_color_t

        #include <ViennaRNA/datastructures/basic.h>

  typedef double FLT_OR_DBL

    Typename for floating point number in partition function computations.

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct vrna_basepair_s PAIR

    Old typename of vrna_basepair_s.

        #include <ViennaRNA/datastructures/basic.h>

    Deprecated:

      Use vrna_basepair_t instead!

  typedef struct vrna_elem_prob_s plist

    Old typename of vrna_elem_prob_s.

        #include <ViennaRNA/datastructures/basic.h>

    Deprecated:

      Use vrna_ep_t or vrna_elem_prob_s instead!

  typedef struct vrna_cpair_s cpair

    Old typename of vrna_cpair_s.

        #include <ViennaRNA/datastructures/basic.h>

    Deprecated:

      Use vrna_cpair_t instead!

  typedef struct vrna_sect_s sect

    Old typename of vrna_sect_s.

        #include <ViennaRNA/datastructures/basic.h>

    Deprecated:

      Use vrna_sect_t instead!

  typedef vrna_bp_stack_t bondT

    Old typename of #vrna_bp_stack_s.

        #include <ViennaRNA/datastructures/basic.h>

    Deprecated:

      Use vrna_bp_stack_t instead!

  typedef struct pu_contrib pu_contrib

    contributions to p_u

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct interact interact

    interaction data structure for RNAup

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct pu_out pu_out

    Collection of all free_energy of beeing unpaired values for output.

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct constrain constrain

    constraints for cofolding

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct node folden

    Data structure for RNAsnoop (fold energy list).

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct dupVar dupVar

    Data structure used in RNApkplex.

        #include <ViennaRNA/datastructures/basic.h>

  Functions

  void vrna_C11_features(void)

    Dummy symbol to check whether the library was build using C11/C++11 features.

        #include <ViennaRNA/datastructures/basic.h>

    By default, several data structures of our new v3.0 API use C11/C++11 features, such as unnamed unions, unnamed structs. However, these features can be deactivated at compile time to allow building the library and executables with compilers that do not support these features.

    Now, the problem arises that once our static library is compiled and a third-party application is supposed to link against it, it needs to know, at compile time, how to correctly address particular data structures. This is usually implicitely taken care of through the API exposed in our header files. Unfortunately, we had some preprocessor directives in our header files that changed the API depending on the capabilities of the compiler the third-party application is build with. This in turn prohibited the use of an RNAlib compiled without C11/C++11 support in a program that compiles/links with enabled C11/C++11 support and vice-versa.

    Therefore, we introduce this dummy symbol which can be used to check, whether the static library was build with C11/C++11 features.

    Since

      v2.2.9

    Note

    If the symbol is present, the library was build with enabled C11/C++11 features support and no action is required. However, if the symbol is missing in RNAlib >= 2.2.9, programs that link to RNAlib must define a pre-processor identifier VRNA_DISABLE_C11_FEATURES before including any ViennaRNA Package header file, for instance by adding a CPPFLAG

        CPPFLAGS+=-DVRNA_DISABLE_C11_FEATURES

  struct vrna_basepair_t
    #include <ViennaRNA/datastructures/basic.h>

    Typename for base pair element.

    Deprecated:

      Use vrna_bp_t instead!

    Public Members

    int i

          #include <ViennaRNA/datastructures/basic.h>

    int j

          #include <ViennaRNA/datastructures/basic.h>

  struct vrna_bp_stack_t
    #include <ViennaRNA/datastructures/basic.h>

    Typename for the base pair stack element.

    Public Members

    unsigned int i

          #include <ViennaRNA/datastructures/basic.h>

    unsigned int j

          #include <ViennaRNA/datastructures/basic.h>

  struct pu_contrib
    #include <ViennaRNA/datastructures/basic.h>

    contributions to p_u

    Public Members

    double **H

      hairpin loops

          #include <ViennaRNA/datastructures/basic.h>

    double **I

      internal loops

          #include <ViennaRNA/datastructures/basic.h>

    double **M

      multi loops

          #include <ViennaRNA/datastructures/basic.h>

    double **E

      exterior loop

          #include <ViennaRNA/datastructures/basic.h>

    int length

      length of the input sequence

          #include <ViennaRNA/datastructures/basic.h>

    int w

      longest unpaired region

          #include <ViennaRNA/datastructures/basic.h>

  struct interact
    #include <ViennaRNA/datastructures/basic.h>

    interaction data structure for RNAup

    Public Members

    double *Pi

      probabilities of interaction

          #include <ViennaRNA/datastructures/basic.h>

    double *Gi

      free energies of interaction

          #include <ViennaRNA/datastructures/basic.h>

    double Gikjl

      full free energy for interaction between [k,i] k<i in longer seq and [j,l] j<l in shorter seq

          #include <ViennaRNA/datastructures/basic.h>

    double Gikjl_wo

      Gikjl without contributions for prob_unpaired.

          #include <ViennaRNA/datastructures/basic.h>

    int i

      k<i in longer seq

          #include <ViennaRNA/datastructures/basic.h>

    int k

      k<i in longer seq

          #include <ViennaRNA/datastructures/basic.h>

    int j

      j<l in shorter seq

          #include <ViennaRNA/datastructures/basic.h>

    int l

      j<l in shorter seq

          #include <ViennaRNA/datastructures/basic.h>

    int length

      length of longer sequence

          #include <ViennaRNA/datastructures/basic.h>

  struct pu_out
    #include <ViennaRNA/datastructures/basic.h>

    Collection of all free_energy of beeing unpaired values for output.

    Public Members

    int len

      sequence length

          #include <ViennaRNA/datastructures/basic.h>

    int u_vals

      number of different -u values

          #include <ViennaRNA/datastructures/basic.h>

    int contribs

      [-c “SHIME”]

          #include <ViennaRNA/datastructures/basic.h>

    char **header

      header line

          #include <ViennaRNA/datastructures/basic.h>

    double **u_values

      (the -u values * [-c “SHIME”]) * seq len

          #include <ViennaRNA/datastructures/basic.h>

  struct constrain
    #include <ViennaRNA/datastructures/basic.h>

    constraints for cofolding

    Public Members

    int *indx

          #include <ViennaRNA/datastructures/basic.h>

    char *ptype

          #include <ViennaRNA/datastructures/basic.h>

  struct duplexT
    #include <ViennaRNA/datastructures/basic.h>

    Data structure for RNAduplex.

    Public Members

    int i

          #include <ViennaRNA/datastructures/basic.h>

    int j

          #include <ViennaRNA/datastructures/basic.h>

    int end

          #include <ViennaRNA/datastructures/basic.h>

    char *structure

          #include <ViennaRNA/datastructures/basic.h>

    double energy

          #include <ViennaRNA/datastructures/basic.h>

    double energy_backtrack

          #include <ViennaRNA/datastructures/basic.h>

    double opening_backtrack_x

          #include <ViennaRNA/datastructures/basic.h>

    double opening_backtrack_y

          #include <ViennaRNA/datastructures/basic.h>

    int offset

          #include <ViennaRNA/datastructures/basic.h>

    double dG1

          #include <ViennaRNA/datastructures/basic.h>

    double dG2

          #include <ViennaRNA/datastructures/basic.h>

    double ddG

          #include <ViennaRNA/datastructures/basic.h>

    int tb

          #include <ViennaRNA/datastructures/basic.h>

    int te

          #include <ViennaRNA/datastructures/basic.h>

    int qb

          #include <ViennaRNA/datastructures/basic.h>

    int qe

          #include <ViennaRNA/datastructures/basic.h>

  struct node
    #include <ViennaRNA/datastructures/basic.h>

    Data structure for RNAsnoop (fold energy list).

    Public Members

    int k

          #include <ViennaRNA/datastructures/basic.h>

    int energy

          #include <ViennaRNA/datastructures/basic.h>

    struct node *next

          #include <ViennaRNA/datastructures/basic.h>

  struct snoopT
    #include <ViennaRNA/datastructures/basic.h>

    Data structure for RNAsnoop.

    Public Members

    int i

          #include <ViennaRNA/datastructures/basic.h>

    int j

          #include <ViennaRNA/datastructures/basic.h>

    int u

          #include <ViennaRNA/datastructures/basic.h>

    char *structure

          #include <ViennaRNA/datastructures/basic.h>

    float energy

          #include <ViennaRNA/datastructures/basic.h>

    float Duplex_El

          #include <ViennaRNA/datastructures/basic.h>

    float Duplex_Er

          #include <ViennaRNA/datastructures/basic.h>

    float Loop_E

          #include <ViennaRNA/datastructures/basic.h>

    float Loop_D

          #include <ViennaRNA/datastructures/basic.h>

    float pscd

          #include <ViennaRNA/datastructures/basic.h>

    float psct

          #include <ViennaRNA/datastructures/basic.h>

    float pscg

          #include <ViennaRNA/datastructures/basic.h>

    float Duplex_Ol

          #include <ViennaRNA/datastructures/basic.h>

    float Duplex_Or

          #include <ViennaRNA/datastructures/basic.h>

    float Duplex_Ot

          #include <ViennaRNA/datastructures/basic.h>

    float fullStemEnergy

          #include <ViennaRNA/datastructures/basic.h>

  struct dupVar
    #include <ViennaRNA/datastructures/basic.h>

    Data structure used in RNApkplex.

    Public Members

    int i

          #include <ViennaRNA/datastructures/basic.h>

    int j

          #include <ViennaRNA/datastructures/basic.h>

    int end

          #include <ViennaRNA/datastructures/basic.h>

    char *pk_helix

          #include <ViennaRNA/datastructures/basic.h>

    char *structure

          #include <ViennaRNA/datastructures/basic.h>

    double energy

          #include <ViennaRNA/datastructures/basic.h>

    int offset

          #include <ViennaRNA/datastructures/basic.h>

    double dG1

          #include <ViennaRNA/datastructures/basic.h>

    double dG2

          #include <ViennaRNA/datastructures/basic.h>

    double ddG

          #include <ViennaRNA/datastructures/basic.h>

    int tb

          #include <ViennaRNA/datastructures/basic.h>

    int te

          #include <ViennaRNA/datastructures/basic.h>

    int qb

          #include <ViennaRNA/datastructures/basic.h>

    int qe

          #include <ViennaRNA/datastructures/basic.h>

    int inactive

          #include <ViennaRNA/datastructures/basic.h>

    int processed

          #include <ViennaRNA/datastructures/basic.h>

## Backtracking Related Data Structures

  Typedefs

  typedef struct vrna_bt_stack_s *vrna_bts_t

    The backtrack stack data structure.

        #include <ViennaRNA/datastructures/basic.h>

    See also

    vrna_bts_init(), vrna_bts_free(), vrna_bts_push(), vrna_bts_top(), vrna_bts_pop()

  typedef struct vrna_bp_stack_s *vrna_bps_t

    The basepair stack data structure.

        #include <ViennaRNA/datastructures/basic.h>

    See also

    vrna_bps_init(), vrna_bps_free(), vrna_bps_push(), vrna_bps_top(), vrna_bps_pop(), vrna_bps_at()

  typedef struct vrna_basepair_s vrna_bp_t

    Typename for the base pair repesenting data structure vrna_basepair_s.

        #include <ViennaRNA/datastructures/basic.h>

  typedef struct vrna_sect_s vrna_sect_t

    Typename for stack of partial structures vrna_sect_s.

        #include <ViennaRNA/datastructures/basic.h>

  Functions

  vrna_bts_t vrna_bts_init(size_t n)

    Get an initialized backtrack stack.

        #include <ViennaRNA/datastructures/basic.h>

    This function yields an initialized backtracking stack that holds all elements that need to be further evaluated. The individual elements stored in the stack are of type vrna_sect_t and store the sequence delimiters and corresponding backtrack DP matrix flag.

    See also

    vrna_bts_t, vrna_bts_free(), vrna_bts_push(), vrna_bts_top(),vrna_bts_pop(), vrna_bts_size(),

    Note

    Memory for the stack must be released via the vrna_bts_free() function.

    Parameters:

      - n – The initial size of the backtrack stack

    Returns:

      An initialized backtrack stack, ready for usage in backtracking functions

  void vrna_bts_free(vrna_bts_t bts)

    Release memory occupied by a backtrack stack.

        #include <ViennaRNA/datastructures/basic.h>

    Parameters:

      - bts – The backtrack stack that should be free’d

  size_t vrna_bts_push(vrna_bts_t bts, vrna_sect_t element)

    Push a new interval onto the backtrack stack.

        #include <ViennaRNA/datastructures/basic.h>

    This function pushes a new sequence interval for backtracking onto the backstracking stack `bts`.

    Parameters:

      - bts – The backtrack stack

      - element – The sequence interval and corresponding DP matrix flag

    Returns:

      The size of the backtrack stack after pushing the new interval

  vrna_sect_t vrna_bts_top(vrna_bts_t bts)

    Retrieve the top element of the backtrack stack.

        #include <ViennaRNA/datastructures/basic.h>

    Retrieves the last element put onto the stack, or a zero’d out vrna_sect_t structure. The latter is returned on error or when topping an empty stack.

    Parameters:

      - bts – The backtrack stack

    Returns:

      The top element of the backtrack stack, or a zero’d out vrna_sect_t

  vrna_sect_t vrna_bts_pop(vrna_bts_t bts)

    Pop last element of from backtrack stack.

        #include <ViennaRNA/datastructures/basic.h>

    Retrieves and removes the last element put onto the stack, or a zero’d out vrna_sect_t structure. The latter is returned on error or when topping an empty stack.

    Parameters:

      - bts – The backtrack stack

    Returns:

      The top element of the backtrack stack, or a zero’d out vrna_sect_t

  size_t vrna_bts_size(vrna_bts_t bts)

    Get the size of the backtrack stack.

        #include <ViennaRNA/datastructures/basic.h>

    Parameters:

      - bts – The backtrack stack

    Returns:

      The size of the backtracking stack

  vrna_bps_t vrna_bps_init(size_t n)

    Get an initialized base pair stack.

        #include <ViennaRNA/datastructures/basic.h>

    Base pair stacks are used in the backtracking procedure to store all base pairs and structural elements that have been identified so far. Thos function returns an initialized backtracking stack with initial size `n`. Individual elements stored in this stack are of type vrna_bp_t.

    Note

    Memory for the stack must be released via the vrna_bps_free() function.

    Parameters:

      - n – The initial size of the base pair stack

    Returns:

      An initialized base pair stack

  void vrna_bps_free(vrna_bps_t bps)

    Release memory of a base pair stack.

        #include <ViennaRNA/datastructures/basic.h>

    Parameters:

      - bps – The base pair stack to be free’d

  size_t vrna_bps_push(vrna_bps_t bps, vrna_bp_t pair)

    Put a new base pair element on top of the stack.

        #include <ViennaRNA/datastructures/basic.h>

    Parameters:

      - bps – The base pair stack

      - pair – The base pair to be put onto the stack

    Returns:

      The size of the base pair stack after pushing the base pair

  vrna_bp_t vrna_bps_top(vrna_bps_t bps)

    Retrieve the top element of the base pair stack.

        #include <ViennaRNA/datastructures/basic.h>

    Retrieves the last element put onto the stack, or a zero’d out vrna_bp_t structure. The latter is returned on error or when topping an empty stack.

    Parameters:

      - bps – The base pair stack

    Returns:

      The top element of the base pair stack, or a zero’d out vrna_bp_t

  vrna_bp_t vrna_bps_pop(vrna_bps_t bps)

    Pop last element of from base pair stack.

        #include <ViennaRNA/datastructures/basic.h>

    Retrieves and removes the last element put onto the stack, or a zero’d out vrna_bp_t structure. The latter is returned on error or when topping an empty stack.

    Parameters:

      - bps – The base pair stack

    Returns:

      The top element of the backtrack stack, or a zero’d out vrna_bp_t

  vrna_bp_t vrna_bps_at(vrna_bps_t bps, size_t n)

    Retrieve the n’th element of the base pair stack.

        #include <ViennaRNA/datastructures/basic.h>

    Retrieves the n’th element counted from the bottom of the stack (0-based), or a zero’d out vrna_bp_t structure. The latter is returned on error or when `n` is outside the size of the stack.

    Parameters:

      - bps – The base pair stack

      - n – The position within the stack

    Returns:

      The n’th element of the base pair stack, or a zero’d out vrna_bp_t

  size_t vrna_bps_size(vrna_bps_t bps)

    Get the size of the base pair stack.

        #include <ViennaRNA/datastructures/basic.h>

    Parameters:

      - bps – The base pair stack

    Returns:

      The size of the base pair stack

  struct vrna_sect_s
    #include <ViennaRNA/datastructures/basic.h>

    Stack of partial structures for backtracking.

    Public Members

    int i

          #include <ViennaRNA/datastructures/basic.h>

    int j

          #include <ViennaRNA/datastructures/basic.h>

    unsigned int ml

          #include <ViennaRNA/datastructures/basic.h>

  struct vrna_basepair_s
    #include <ViennaRNA/datastructures/basic.h>

    Base pair data structure used in subopt.c.

    Public Members

    unsigned int i

          #include <ViennaRNA/datastructures/basic.h>

    unsigned int j

          #include <ViennaRNA/datastructures/basic.h>

    unsigned int L

          #include <ViennaRNA/datastructures/basic.h>

    unsigned int l[3]

          #include <ViennaRNA/datastructures/basic.h>