RNAlib-2.4.18
structures.h
Go to the documentation of this file.
1 #ifndef VIENNA_RNA_PACKAGE_STRUCT_UTILS_H
2 #define VIENNA_RNA_PACKAGE_STRUCT_UTILS_H
3 
4 #ifdef VRNA_WARN_DEPRECATED
5 # if defined(__clang__)
6 # define DEPRECATED(func, msg) func __attribute__ ((deprecated("", msg)))
7 # elif defined(__GNUC__)
8 # define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
9 # else
10 # define DEPRECATED(func, msg) func
11 # endif
12 #else
13 # define DEPRECATED(func, msg) func
14 #endif
15 
33 typedef struct vrna_hx_s vrna_hx_t;
34 
35 
40 typedef struct vrna_elem_prob_s vrna_ep_t;
41 
42 
73 #define VRNA_BRACKETS_ALPHA 4U
74 
75 
81 #define VRNA_BRACKETS_RND 8U
82 
83 
89 #define VRNA_BRACKETS_CLY 16U
90 
91 
97 #define VRNA_BRACKETS_ANG 32U
98 
99 
105 #define VRNA_BRACKETS_SQR 64U
106 
107 
119 #define VRNA_BRACKETS_DEFAULT \
120  (VRNA_BRACKETS_RND | \
121  VRNA_BRACKETS_CLY | \
122  VRNA_BRACKETS_ANG | \
123  VRNA_BRACKETS_SQR)
124 
125 
132 #define VRNA_BRACKETS_ANY \
133  (VRNA_BRACKETS_RND | \
134  VRNA_BRACKETS_CLY | \
135  VRNA_BRACKETS_ANG | \
136  VRNA_BRACKETS_SQR | \
137  VRNA_BRACKETS_ALPHA)
138 
139 
140 #include <stdio.h>
141 
143 
156 char *
157 vrna_db_pack(const char *struc);
158 
159 
170 char *
171 vrna_db_unpack(const char *packed);
172 
173 
189 void
190 vrna_db_flatten(char *structure,
191  unsigned int options);
192 
193 
213 void
214 vrna_db_flatten_to(char *string,
215  const char target[3],
216  unsigned int options);
217 
218 
225 char *
227 
228 
238 char *
240  unsigned int n);
241 
242 
249 char *
250 vrna_db_to_element_string(const char *structure);
251 
252 
284 char *
285 vrna_db_pk_remove(const char *structure,
286  unsigned int options);
287 
288 /* End dot-bracket interface */
307 short *
308 vrna_ptable(const char *structure);
309 
310 
330 short *
331 vrna_ptable_from_string(const char *string,
332  unsigned int options);
333 
334 
352 short *
353 vrna_pt_pk_get(const char *structure);
354 
355 
362 short *
363 vrna_ptable_copy(const short *pt);
364 
365 
370 short *
371 vrna_pt_ali_get(const char *structure);
372 
373 
381 short *
382 vrna_pt_snoop_get(const char *structure);
383 
384 
401 short *
402 vrna_pt_pk_remove(const short *ptable,
403  unsigned int options);
404 
405 
406 /* End pair table interface */
418 #define VRNA_PLIST_TYPE_BASEPAIR 0
419 
420 
424 #define VRNA_PLIST_TYPE_GQUAD 1
425 
426 
430 #define VRNA_PLIST_TYPE_H_MOTIF 2
431 
432 
436 #define VRNA_PLIST_TYPE_I_MOTIF 3
437 
438 
442 #define VRNA_PLIST_TYPE_UD_MOTIF 4
443 
444 
448 #define VRNA_PLIST_TYPE_STACK 5
449 
450 
460  int i;
461  int j;
462  float p;
463  int type;
464 };
465 
481 vrna_ep_t *vrna_plist(const char *struc,
482  float pr);
483 
484 
502  double cut_off);
503 
504 
505 /* End pair list interface */
573 char *
574 vrna_db_from_WUSS(const char *wuss);
575 
576 
577 /* End WUSS notation interface */
625 char *
626 vrna_abstract_shapes(const char *structure,
627  unsigned int level);
628 
629 
645 char *
646 vrna_abstract_shapes_pt(const short *pt,
647  unsigned int level);
648 
649 
650 /* End abstract shapes interface */
662 struct vrna_hx_s {
663  unsigned int start;
664  unsigned int end;
665  unsigned int length;
666  unsigned int up5;
667  unsigned int up3;
668 };
669 
670 
677 vrna_hx_t *
679 
680 
684 vrna_hx_t *
686  int maxdist);
687 
688 
689 /* End helix list interface */
696 int *
697 vrna_loopidx_from_ptable(const short *pt);
698 
699 
711 int
712 vrna_bp_distance(const char *str1,
713  const char *str2);
714 
715 
716 double
717 vrna_dist_mountain(const char *str1,
718  const char *str2,
719  unsigned int p);
720 
721 
728 unsigned int *
729 vrna_refBPcnt_matrix(const short *reference_pt,
730  unsigned int turn);
731 
732 
740 unsigned int *
741 vrna_refBPdist_matrix(const short *pt1,
742  const short *pt2,
743  unsigned int turn);
744 
745 
749 char *
751  unsigned int length);
752 
753 
757 char
758 vrna_bpp_symbol(const float *x);
759 
760 
772 char *
774  unsigned int length);
775 
776 
777 void
778 vrna_letter_structure(char *structure,
779  vrna_bp_stack_t *bp,
780  unsigned int length);
781 
782 
868 #define VRNA_STRUCTURE_TREE_HIT 1U
869 
870 
875 #define VRNA_STRUCTURE_TREE_SHAPIRO_SHORT 2U
876 
877 
882 #define VRNA_STRUCTURE_TREE_SHAPIRO 3U
883 
884 
889 #define VRNA_STRUCTURE_TREE_SHAPIRO_EXT 4U
890 
891 
896 #define VRNA_STRUCTURE_TREE_SHAPIRO_WEIGHT 5U
897 
902 #define VRNA_STRUCTURE_TREE_EXPANDED 6U
903 
904 
934 char *
935 vrna_db_to_tree_string(const char *structure,
936  unsigned int type);
937 
938 
950 char *
951 vrna_tree_string_unweight(const char *structure);
952 
953 
965 char *
966 vrna_tree_string_to_db(const char *tree);
967 
968 
969 /* End tree representations */
972 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
973 
974 /*###########################################*/
975 /*# deprecated functions below #*/
976 /*###########################################*/
977 
997 DEPRECATED(void assign_plist_from_db(vrna_ep_t **pl,
998  const char *struc,
999  float pr),
1000  "Use vrna_plist() instead");
1001 
1015 DEPRECATED(char *pack_structure(const char *struc),
1016  "Use vrna_db_pack() instead");
1017 
1029 DEPRECATED(char *unpack_structure(const char *packed),
1030  "Use vrna_db_unpack() instead");
1031 
1044 DEPRECATED(short *make_pair_table(const char *structure),
1045  "Use vrna_ptable() instead");
1046 
1047 DEPRECATED(short *make_pair_table_pk(const char *structure),
1048  "Use vrna_ptable_from_string() instead");
1049 
1059 DEPRECATED(short *copy_pair_table(const short *pt),
1060  "Use vrna_ptable_copy() instead");
1061 
1068 DEPRECATED(short *alimake_pair_table(const char *structure),
1069  "Use vrna_pt_ali_get() instead");
1070 
1078 DEPRECATED(short *make_pair_table_snoop(const char *structure),
1079  "Use vrna_pt_snoop_get() instead");
1080 
1081 DEPRECATED(int *make_loop_index_pt(short *pt),
1082  "Use vrna_loopidx_from_ptable() instead");
1083 
1097 DEPRECATED(int bp_distance(const char *str1,
1098  const char *str2),
1099  "Use vrna_bp_distance() instead");
1100 
1110 DEPRECATED(unsigned int *make_referenceBP_array(short *reference_pt,
1111  unsigned int turn),
1112  "Use vrna_refBPcnt_matrix() instead");
1113 
1123 DEPRECATED(unsigned int *compute_BPdifferences(short *pt1,
1124  short *pt2,
1125  unsigned int turn),
1126  "Use vrna_refBPdist_matrix() instead");
1127 
1148 DEPRECATED(void assign_plist_from_pr(vrna_ep_t **pl,
1149  FLT_OR_DBL *probs,
1150  int length,
1151  double cutoff),
1152  "Use vrna_plist_from_probs() instead");
1153 
1162 DEPRECATED(void parenthesis_structure(char *structure,
1163  vrna_bp_stack_t *bp,
1164  int length),
1165  "Use vrna_parenthesis_structure() instead");
1166 
1176 DEPRECATED(void parenthesis_zuker(char *structure,
1177  vrna_bp_stack_t *bp,
1178  int length),
1179  "Use vrna_parenthesis_zuker() instead");
1180 
1181 DEPRECATED(void letter_structure(char *structure,
1182  vrna_bp_stack_t *bp,
1183  int length),
1184  "Use vrna_letter_structure() instead");
1185 
1191 DEPRECATED(void bppm_to_structure(char *structure,
1192  FLT_OR_DBL *pr,
1193  unsigned int length),
1194  "Use vrna_db_from_probs() instead");
1195 
1201 DEPRECATED(char bppm_symbol(const float *x),
1202  "Use vrna_bpp_symbol() instead");
1203 
1204 #endif
1205 
1210 #endif
Various data structures and pre-processor macros.
FLT_OR_DBL * pr
A pointer to the base pair probability matrix.
double FLT_OR_DBL
Typename for floating point number in partition function computations.
Definition: basic.h:43
Base pair stack element.
Definition: basic.h:143
The most basic data structure required by many functions throughout the RNAlib.
Definition: fold_compound.h:137
void assign_plist_from_pr(vrna_ep_t **pl, FLT_OR_DBL *probs, int length, double cutoff)
Create a vrna_ep_t from a probability matrix.
void assign_plist_from_db(vrna_ep_t **pl, const char *struc, float pr)
Create a vrna_ep_t from a dot-bracket string.
vrna_ep_t * vrna_plist_from_probs(vrna_fold_compound_t *vc, double cut_off)
Create a vrna_ep_t from base pair probability matrix.
char * vrna_abstract_shapes_pt(const short *pt, unsigned int level)
Convert a secondary structure to its abstract shapes representation.
char * vrna_abstract_shapes(const char *structure, unsigned int level)
Convert a secondary structure in dot-bracket notation to its abstract shapes representation.
char * unpack_structure(const char *packed)
Unpack secondary structure previously packed with pack_structure()
void bppm_to_structure(char *structure, FLT_OR_DBL *pr, unsigned int length)
Create a dot-bracket like structure string from base pair probability matrix.
short * alimake_pair_table(const char *structure)
char bppm_symbol(const float *x)
Get a pseudo dot bracket notation for a given probability information.
unsigned int * make_referenceBP_array(short *reference_pt, unsigned int turn)
Make a reference base pair count matrix.
int pairs
contains the number of base pairs in the last parsed structure.
int bp_distance(const char *str1, const char *str2)
Compute the "base pair" distance between two secondary structures s1 and s2.
short * make_pair_table(const char *structure)
Create a pair table of a secondary structure.
short * make_pair_table_snoop(const char *structure)
void parenthesis_zuker(char *structure, vrna_bp_stack_t *bp, int length)
Create a dot-backet/parenthesis structure from backtracking stack obtained by zuker suboptimal calcul...
char * pack_structure(const char *struc)
Pack secondary secondary structure, 5:1 compression using base 3 encoding.
unsigned int * compute_BPdifferences(short *pt1, short *pt2, unsigned int turn)
Make a reference base pair distance matrix.
void parenthesis_structure(char *structure, vrna_bp_stack_t *bp, int length)
Create a dot-backet/parenthesis structure from backtracking stack.
short * copy_pair_table(const short *pt)
Get an exact copy of a pair table.
char * vrna_db_to_element_string(const char *structure)
Convert a secondary structure in dot-bracket notation to a nucleotide annotation of loop contexts.
char * vrna_db_pack(const char *struc)
Pack secondary secondary structure, 5:1 compression using base 3 encoding.
char * vrna_db_unpack(const char *packed)
Unpack secondary structure previously packed with vrna_db_pack()
void vrna_db_flatten_to(char *string, const char target[3], unsigned int options)
Substitute pairs of brackets in a string with another type of pair characters.
char * vrna_db_from_plist(vrna_ep_t *pairs, unsigned int n)
Convert a list of base pairs into dot-bracket notation.
char * vrna_db_pk_remove(const char *structure, unsigned int options)
Remove pseudo-knots from an input structure.
char * vrna_db_from_ptable(short *pt)
Convert a pair table into dot-parenthesis notation.
void vrna_db_flatten(char *structure, unsigned int options)
Substitute pairs of brackets in a string with parenthesis.
vrna_hx_t * vrna_hx_merge(const vrna_hx_t *list, int maxdist)
Create a merged helix list from another helix list.
vrna_hx_t * vrna_hx_from_ptable(short *pt)
Convert a pair table representation of a secondary structure into a helix list.
Data structure representing an entry of a helix list.
Definition: structures.h:662
short * vrna_pt_ali_get(const char *structure)
Create a pair table of a secondary structure (snoop align version)
short * vrna_ptable_from_string(const char *string, unsigned int options)
Create a pair table for a secondary structure string.
short * vrna_ptable_copy(const short *pt)
Get an exact copy of a pair table.
short * vrna_ptable(const char *structure)
Create a pair table from a dot-bracket notation of a secondary structure.
short * vrna_pt_pk_get(const char *structure)
Create a pair table of a secondary structure (pseudo-knot version)
short * vrna_pt_pk_remove(const short *ptable, unsigned int options)
Remove pseudo-knots from a pair table.
short * vrna_pt_snoop_get(const char *structure)
Create a pair table of a secondary structure (snoop version)
int i
Start position (usually 5' nucleotide that starts the element, e.g. base pair)
Definition: structures.h:460
int type
Type of the element.
Definition: structures.h:463
float p
Probability of the element.
Definition: structures.h:462
int j
End position (usually 3' nucleotide that ends the element, e.g. base pair)
Definition: structures.h:461
vrna_ep_t * vrna_plist(const char *struc, float pr)
Create a vrna_ep_t from a dot-bracket string.
Data structure representing a single entry of an element probability list (e.g. list of pair probabil...
Definition: structures.h:459
char * vrna_db_to_tree_string(const char *structure, unsigned int type)
Convert a Dot-Bracket structure string into tree string representation.
char * vrna_tree_string_to_db(const char *tree)
Convert a linear tree string representation of a secondary structure back to Dot-Bracket notation.
char * vrna_tree_string_unweight(const char *structure)
Remove weights from a linear string tree representation of a secondary structure.
char * vrna_db_from_WUSS(const char *wuss)
Convert a WUSS annotation string to dot-bracket format.
char vrna_bpp_symbol(const float *x)
Get a pseudo dot bracket notation for a given probability information.
int * vrna_loopidx_from_ptable(const short *pt)
Get a loop index representation of a structure.
char * vrna_db_from_probs(const FLT_OR_DBL *pr, unsigned int length)
Create a dot-bracket like structure string from base pair probability matrix.
char * vrna_db_from_bp_stack(vrna_bp_stack_t *bp, unsigned int length)
Create a dot-backet/parenthesis structure from backtracking stack.
unsigned int * vrna_refBPdist_matrix(const short *pt1, const short *pt2, unsigned int turn)
Make a reference base pair distance matrix.
int vrna_bp_distance(const char *str1, const char *str2)
Compute the "base pair" distance between two secondary structures s1 and s2.
unsigned int * vrna_refBPcnt_matrix(const short *reference_pt, unsigned int turn)
Make a reference base pair count matrix.