# G-Quadruplexes

  Various functions related to G-quadruplex computations.

  Functions

  int E_gquad(int L, int l[3], vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  FLT_OR_DBL exp_E_gquad(int L, int l[3], vrna_exp_param_t *pf)
    #include <ViennaRNA/gquad.h>
  void E_gquad_ali_en(int i, int L, int l[3], const short **S, unsigned int **a2s, unsigned int n_seq, vrna_param_t *P, int en[2])
    #include <ViennaRNA/gquad.h>
  int *get_gquad_matrix(short *S, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>

    Get a triangular matrix prefilled with minimum free energy contributions of G-quadruplexes.

    At each position ij in the matrix, the minimum free energy of any G-quadruplex delimited by i and j is stored. If no G-quadruplex formation is possible, the matrix element is set to INF. Access the elements in the matrix via matrix[indx[j]+i]. To get the integer array indx see get_jindx().

    See also

    get_jindx(), encode_sequence()

    Parameters:

      - S – The encoded sequence

      - P – A pointer to the data structure containing the precomputed energy contributions

    Returns:

      A pointer to the G-quadruplex contribution matrix

  int *get_gquad_ali_matrix(unsigned int n, short *S_cons, short **S, unsigned int **a2s, int n_seq, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  FLT_OR_DBL *get_gquad_pf_matrix(short *S, FLT_OR_DBL *scale, vrna_exp_param_t *pf)
    #include <ViennaRNA/gquad.h>
  FLT_OR_DBL *get_gquad_pf_matrix_comparative(unsigned int n, short *S_cons, short **S, unsigned int **a2s, FLT_OR_DBL *scale, unsigned int n_seq, vrna_exp_param_t *pf)
    #include <ViennaRNA/gquad.h>
  int **get_gquad_L_matrix(short *S, int start, int maxdist, int n, int **g, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  void vrna_gquad_mx_local_update(vrna_fold_compound_t *fc, int start)
    #include <ViennaRNA/gquad.h>
  void get_gquad_pattern_mfe(short *S, int i, int j, vrna_param_t *P, int *L, int l[3])
    #include <ViennaRNA/gquad.h>
  void get_gquad_pattern_exhaustive(short *S, int i, int j, vrna_param_t *P, int *L, int *l, int threshold)
    #include <ViennaRNA/gquad.h>
  void get_gquad_pattern_pf(short *S, int i, int j, vrna_exp_param_t *pf, int *L, int l[3])
    #include <ViennaRNA/gquad.h>
  plist *get_plist_gquad_from_pr(short *S, int gi, int gj, FLT_OR_DBL *G, FLT_OR_DBL *probs, FLT_OR_DBL *scale, vrna_exp_param_t *pf)
    #include <ViennaRNA/gquad.h>
  plist *get_plist_gquad_from_pr_max(short *S, int gi, int gj, FLT_OR_DBL *G, FLT_OR_DBL *probs, FLT_OR_DBL *scale, int *L, int l[3], vrna_exp_param_t *pf)
    #include <ViennaRNA/gquad.h>
  plist *get_plist_gquad_from_db(const char *structure, float pr)
    #include <ViennaRNA/gquad.h>
  plist *vrna_get_plist_gquad_from_pr(vrna_fold_compound_t *fc, int gi, int gj)
    #include <ViennaRNA/gquad.h>
  plist *vrna_get_plist_gquad_from_pr_max(vrna_fold_compound_t *fc, int gi, int gj, int *Lmax, int lmax[3])
    #include <ViennaRNA/gquad.h>
  int get_gquad_count(short *S, int i, int j)
    #include <ViennaRNA/gquad.h>
  int get_gquad_layer_count(short *S, int i, int j)
    #include <ViennaRNA/gquad.h>
  void get_gquad_pattern_mfe_ali(short **S, unsigned int **a2s, short *S_cons, int n_seq, int i, int j, vrna_param_t *P, int *L, int l[3])
    #include <ViennaRNA/gquad.h>
  int parse_gquad(const char *struc, int *L, int l[3])
    #include <ViennaRNA/gquad.h>

    given a dot-bracket structure (possibly) containing gquads encoded by ‘+’ signs, find first gquad, return end position or 0 if none found Upon return L and l[] contain the number of stacked layers, as well as the lengths of the linker regions. To parse a string with many gquads, call parse_gquad repeatedly e.g. end1 = parse_gquad(struc, &L, l); … ; end2 = parse_gquad(struc+end1, &L, l); end2+=end1; … ; end3 = parse_gquad(struc+end2, &L, l); end3+=end2; … ;

  static int backtrack_GQuad_IntLoop(int c, int i, int j, int type, short *S, int *ggg, int *index, int *p, int *q, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>

    backtrack an interior loop like enclosed g-quadruplex with closing pair (i,j)

    Parameters:

      - c – The total contribution the loop should resemble

      - i – position i of enclosing pair

      - j – position j of enclosing pair

      - type – base pair type of enclosing pair (must be reverse type)

      - S – integer encoded sequence

      - ggg – triangular matrix containing g-quadruplex contributions

      - index – the index for accessing the triangular matrix

      - p – here the 5’ position of the gquad is stored

      - q – here the 3’ position of the gquad is stored

      - P – the datastructure containing the precalculated contibutions

    Returns:

      1 on success, 0 if no gquad found

  static int backtrack_GQuad_IntLoop_comparative(int c, int i, int j, unsigned int *type, short *S_cons, short **S5, short **S3, unsigned int **a2s, int *ggg, int *index, int *p, int *q, int n_seq, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  static int backtrack_GQuad_IntLoop_L(int c, int i, int j, int type, short *S, int **ggg, int maxdist, int *p, int *q, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>

    backtrack an interior loop like enclosed g-quadruplex with closing pair (i,j) with underlying Lfold matrix

    Parameters:

      - c – The total contribution the loop should resemble

      - i – position i of enclosing pair

      - j – position j of enclosing pair

      - type – base pair type of enclosing pair (must be reverse type)

      - S – integer encoded sequence

      - ggg – triangular matrix containing g-quadruplex contributions

      - p – here the 5’ position of the gquad is stored

      - q – here the 3’ position of the gquad is stored

      - P – the datastructure containing the precalculated contibutions

    Returns:

      1 on success, 0 if no gquad found

  static int vrna_BT_gquad_int(vrna_fold_compound_t *fc, int i, int j, int en, vrna_bp_stack_t *bp_stack, int *stack_count)
    #include <ViennaRNA/gquad.h>
  static int vrna_BT_gquad_mfe(vrna_fold_compound_t *fc, int i, int j, vrna_bp_stack_t *bp_stack, int *stack_count)
    #include <ViennaRNA/gquad.h>
  static int backtrack_GQuad_IntLoop_L_comparative(int c, int i, int j, unsigned int *type, short *S_cons, short **S5, short **S3, unsigned int **a2s, int **ggg, int *p, int *q, int n_seq, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  static int E_GQuad_IntLoop(int i, int j, int type, short *S, int *ggg, int *index, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  static int E_GQuad_IntLoop_comparative(int i, int j, unsigned int *tt, short *S_cons, short **S5, short **S3, unsigned int **a2s, int *ggg, int *index, int n_seq, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  static int E_GQuad_IntLoop_L_comparative(int i, int j, unsigned int *tt, short *S_cons, short **S5, short **S3, unsigned int **a2s, int **ggg, int n_seq, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  static int *E_GQuad_IntLoop_exhaustive(int i, int j, int **p_p, int **q_p, int type, short *S, int *ggg, int threshold, int *index, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  static int E_GQuad_IntLoop_L(int i, int j, int type, short *S, int **ggg, int maxdist, vrna_param_t *P)
    #include <ViennaRNA/gquad.h>
  static FLT_OR_DBL exp_E_GQuad_IntLoop(int i, int j, int type, short *S, FLT_OR_DBL *G, FLT_OR_DBL *scale, int *index, vrna_exp_param_t *pf)
    #include <ViennaRNA/gquad.h>
  static FLT_OR_DBL exp_E_GQuad_IntLoop_comparative(int i, int j, unsigned int *tt, short *S_cons, short **S5, short **S3, unsigned int **a2s, FLT_OR_DBL *G, FLT_OR_DBL *scale, int *index, int n_seq, vrna_exp_param_t *pf)
    #include <ViennaRNA/gquad.h>