# Pair Table Representation of Secondary Structures

  Functions

  short *vrna_ptable(const char *structure)
    #include <ViennaRNA/utils/structures.h>

    Create a pair table from a dot-bracket notation of a secondary structure.

    Returns a newly allocated table, such that table[i]=j if (i.j) pair or 0 if i is unpaired, table[0] contains the length of the structure.

    SWIG Wrapper Notes:

      This functions is wrapped as overloaded function `ptable()` that takes an optional argument `options` to specify which type of matching brackets should be considered during conversion. The default set is round brackets, i.e. VRNA_BRACKETS_RND. See, e.g. `RNA.ptable()` in the Python API.

    See also

    vrna_ptable_from_string(), vrna_db_from_ptable()

    Parameters:

      - structure – The secondary structure in dot-bracket notation

    Returns:

      A pointer to the created pair_table

  short *vrna_ptable_from_string(const char *structure, unsigned int options)
    #include <ViennaRNA/utils/structures.h>

    Create a pair table for a secondary structure string.

    This function takes an input string of a secondary structure annotation in dot-bracket-notation or dot-bracket-ext-notation, and converts it into a pair table representation.

    SWIG Wrapper Notes:

      This functions is wrapped as overloaded function `ptable()` that takes an optional argument `options` to specify which type of matching brackets should be considered during conversion. The default set is round brackets, i.e. VRNA_BRACKETS_RND. See, e.g. `RNA.ptable()` in the Python API.

    See also

    vrna_ptable(), vrna_db_from_ptable(), vrna_db_flatten_to(), vrna_pt_pk_remove() VRNA_BRACKETS_RND, VRNA_BRACKETS_ANG, VRNA_BRACKETS_CLY, VRNA_BRACKETS_SQR, VRNA_BRACKETS_ALPHA, VRNA_BRACKETS_DEFAULT, VRNA_BRACKETS_ANY

    Note

    This function also extracts crossing base pairs, i.e. pseudo-knots if more than a single matching bracket type is allowed through the bitmask `options`.

    Parameters:

      - structure – Secondary structure in dot-bracket-ext-notation

      - options – A bitmask to specify which brackets are recognized during conversion to pair table

    Returns:

      A pointer to a new pair table of the provided secondary structure

  short *vrna_pt_pk_get(const char *structure)
    #include <ViennaRNA/utils/structures.h>

    Create a pair table of a secondary structure (pseudo-knot version)

    Returns a newly allocated table, such that table[i]=j if (i.j) pair or 0 if i is unpaired, table[0] contains the length of the structure.

    In contrast to vrna_ptable() this function also recognizes the base pairs denoted by ‘[’ and ‘]’ brackets. Thus, this function behaves like

        vrna_ptable_from_string(structure, VRNA_BRACKETS_RND | VRNA_BRACKETS_SQR)

    See also

    vrna_ptable_from_string()

    Parameters:

      - structure – The secondary structure in (extended) dot-bracket notation

    Returns:

      A pointer to the created pair_table

  short *vrna_ptable_copy(const short *pt)
    #include <ViennaRNA/utils/structures.h>

    Get an exact copy of a pair table.

    Parameters:

      - pt – The pair table to be copied

    Returns:

      A pointer to the copy of ‘pt’

  short *vrna_pt_ali_get(const char *structure)
    #include <ViennaRNA/utils/structures.h>

    Create a pair table of a secondary structure (snoop align version)

  short *vrna_pt_snoop_get(const char *structure)
    #include <ViennaRNA/utils/structures.h>

    Create a pair table of a secondary structure (snoop version)

    returns a newly allocated table, such that: table[i]=j if (i.j) pair or 0 if i is unpaired, table[0] contains the length of the structure. The special pseudoknotted H/ACA-mRNA structure is taken into account.

  short *vrna_pt_pk_remove(const short *ptable, unsigned int options)
    #include <ViennaRNA/utils/structures.h>

    Remove pseudo-knots from a pair table.

    This function removes pseudo-knots from an input structure by determining the minimum number of base pairs that need to be removed to make the structure pseudo-knot free.

    To accomplish that, we use a dynamic programming algorithm similar to the Nussinov maxmimum matching approach.

    See also

    vrna_db_pk_remove()

    Parameters:

      - ptable – Input structure that may include pseudo-knots

      - options –

    Returns:

      The input structure devoid of pseudo-knots