RNAlib-2.4.12
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 
16 #include <stdio.h>
17 
19 
37 typedef struct vrna_hx_s vrna_hx_t;
38 
39 
44 typedef struct vrna_elem_prob_s vrna_ep_t;
45 
46 
57 #define VRNA_BRACKETS_ALPHA 4U
58 
59 
65 #define VRNA_BRACKETS_RND 8U
66 
67 
73 #define VRNA_BRACKETS_CLY 16U
74 
75 
81 #define VRNA_BRACKETS_ANG 32U
82 
83 
89 #define VRNA_BRACKETS_SQR 64U
90 
91 
97 #define VRNA_BRACKETS_DEFAULT \
98  (VRNA_BRACKETS_RND | \
99  VRNA_BRACKETS_CLY | \
100  VRNA_BRACKETS_ANG | \
101  VRNA_BRACKETS_SQR)
102 
103 
116 char *
117 vrna_db_pack(const char *struc);
118 
119 
130 char *
131 vrna_db_unpack(const char *packed);
132 
133 
149 void
150 vrna_db_flatten(char *structure,
151  unsigned int options);
152 
153 
173 void
174 vrna_db_flatten_to(char *string,
175  const char target[3],
176  unsigned int options);
177 
178 
185 char *
186 vrna_db_from_ptable(short *pt);
187 
188 
200 char *
201 vrna_db_from_WUSS(const char *wuss);
202 
203 
213 char *
215  unsigned int n);
216 
217 
224 char *
225 vrna_db_to_element_string(const char *structure);
226 
227 
228 /* End dot-bracket interface */
247 short *
248 vrna_ptable(const char *structure);
249 
250 
266 short *
267 vrna_ptable_from_string(const char *string,
268  unsigned int options);
269 
270 
283 short *
284 vrna_pt_pk_get(const char *structure);
285 
286 
293 short *
294 vrna_ptable_copy(const short *pt);
295 
296 
301 short *
302 vrna_pt_ali_get(const char *structure);
303 
304 
312 short *
313 vrna_pt_snoop_get(const char *structure);
314 
315 
316 /* End pair table interface */
328 #define VRNA_PLIST_TYPE_BASEPAIR 0
329 
330 
334 #define VRNA_PLIST_TYPE_GQUAD 1
335 
336 
340 #define VRNA_PLIST_TYPE_H_MOTIF 2
341 
342 
346 #define VRNA_PLIST_TYPE_I_MOTIF 3
347 
348 
352 #define VRNA_PLIST_TYPE_UD_MOTIF 4
353 
354 
358 #define VRNA_PLIST_TYPE_STACK 5
359 
360 
370  int i;
371  int j;
372  float p;
373  int type;
374 };
375 
391 vrna_ep_t *vrna_plist(const char *struc,
392  float pr);
393 
394 
412  double cut_off);
413 
414 
415 /* End pair list interface */
427 struct vrna_hx_s {
428  unsigned int start;
429  unsigned int end;
430  unsigned int length;
431  unsigned int up5;
432  unsigned int up3;
433 };
434 
435 
442 vrna_hx_t *
443 vrna_hx_from_ptable(short *pt);
444 
445 
449 vrna_hx_t *
450 vrna_hx_merge(const vrna_hx_t *list,
451  int maxdist);
452 
453 
454 /* End helix list interface */
461 int *
462 vrna_loopidx_from_ptable(const short *pt);
463 
464 
476 int
477 vrna_bp_distance(const char *str1,
478  const char *str2);
479 
480 
481 double
482 vrna_dist_mountain(const char *str1,
483  const char *str2,
484  unsigned int p);
485 
486 
493 unsigned int *
494 vrna_refBPcnt_matrix(const short *reference_pt,
495  unsigned int turn);
496 
497 
505 unsigned int *
506 vrna_refBPdist_matrix(const short *pt1,
507  const short *pt2,
508  unsigned int turn);
509 
510 
514 char *
516  unsigned int length);
517 
518 
522 char
523 vrna_bpp_symbol(const float *x);
524 
525 
537 char *
539  unsigned int length);
540 
541 
542 void
543 vrna_letter_structure(char *structure,
544  vrna_bp_stack_t *bp,
545  unsigned int length);
546 
547 
564 #define VRNA_STRUCTURE_TREE_HIT 1U
565 
566 
571 #define VRNA_STRUCTURE_TREE_SHAPIRO_SHORT 2U
572 
573 
578 #define VRNA_STRUCTURE_TREE_SHAPIRO 3U
579 
580 
585 #define VRNA_STRUCTURE_TREE_SHAPIRO_EXT 4U
586 
587 
592 #define VRNA_STRUCTURE_TREE_SHAPIRO_WEIGHT 5U
593 
598 #define VRNA_STRUCTURE_TREE_EXPANDED 6U
599 
600 
630 char *
631 vrna_db_to_tree_string(const char *structure,
632  unsigned int type);
633 
634 
646 char *
647 vrna_tree_string_unweight(const char *structure);
648 
649 
661 char *
662 vrna_tree_string_to_db(const char *tree);
663 
664 
665 /* End tree representations */
668 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
669 
670 /*###########################################*/
671 /*# deprecated functions below #*/
672 /*###########################################*/
673 
693 DEPRECATED(void assign_plist_from_db(vrna_ep_t **pl,
694  const char *struc,
695  float pr),
696  "Use vrna_plist() instead");
697 
711 DEPRECATED(char *pack_structure(const char *struc),
712  "Use vrna_db_pack() instead");
713 
725 DEPRECATED(char *unpack_structure(const char *packed),
726  "Use vrna_db_unpack() instead");
727 
740 DEPRECATED(short *make_pair_table(const char *structure),
741  "Use vrna_ptable() instead");
742 
743 DEPRECATED(short *make_pair_table_pk(const char *structure),
744  "Use vrna_ptable_from_string() instead");
745 
755 DEPRECATED(short *copy_pair_table(const short *pt),
756  "Use vrna_ptable_copy() instead");
757 
764 DEPRECATED(short *alimake_pair_table(const char *structure),
765  "Use vrna_pt_ali_get() instead");
766 
774 DEPRECATED(short *make_pair_table_snoop(const char *structure),
775  "Use vrna_pt_snoop_get() instead");
776 
777 DEPRECATED(int *make_loop_index_pt(short *pt),
778  "Use vrna_loopidx_from_ptable() instead");
779 
793 DEPRECATED(int bp_distance(const char *str1,
794  const char *str2),
795  "Use vrna_bp_distance() instead");
796 
806 DEPRECATED(unsigned int *make_referenceBP_array(short *reference_pt,
807  unsigned int turn),
808  "Use vrna_refBPcnt_matrix() instead");
809 
819 DEPRECATED(unsigned int *compute_BPdifferences(short *pt1,
820  short *pt2,
821  unsigned int turn),
822  "Use vrna_refBPdist_matrix() instead");
823 
844 DEPRECATED(void assign_plist_from_pr(vrna_ep_t **pl,
845  FLT_OR_DBL *probs,
846  int length,
847  double cutoff),
848  "Use vrna_plist_from_probs() instead");
849 
858 DEPRECATED(void parenthesis_structure(char *structure,
859  vrna_bp_stack_t *bp,
860  int length),
861  "Use vrna_parenthesis_structure() instead");
862 
872 DEPRECATED(void parenthesis_zuker(char *structure,
873  vrna_bp_stack_t *bp,
874  int length),
875  "Use vrna_parenthesis_zuker() instead");
876 
877 DEPRECATED(void letter_structure(char *structure,
878  vrna_bp_stack_t *bp,
879  int length),
880  "Use vrna_letter_structure() instead");
881 
887 DEPRECATED(void bppm_to_structure(char *structure,
888  FLT_OR_DBL *pr,
889  unsigned int length),
890  "Use vrna_db_from_probs() instead");
891 
897 DEPRECATED(char bppm_symbol(const float *x),
898  "Use vrna_bpp_symbol() instead");
899 
900 #endif
901 
906 #endif
float p
Probability of the element.
Definition: structures.h:372
char * vrna_db_pack(const char *struc)
Pack secondary secondary structure, 5:1 compression using base 3 encoding.
char vrna_bpp_symbol(const float *x)
Get a pseudo dot bracket notation for a given probability information.
short * vrna_ptable(const char *structure)
Create a pair table from a dot-bracket notation of a secondary structure.
char * pack_structure(const char *struc)
Pack secondary secondary structure, 5:1 compression using base 3 encoding.
int * vrna_loopidx_from_ptable(const short *pt)
Get a loop index representation of a structure.
int vrna_bp_distance(const char *str1, const char *str2)
Compute the "base pair" distance between two secondary structures s1 and s2.
Data structure representing an entry of a helix list.
Definition: structures.h:427
char bppm_symbol(const float *x)
Get a pseudo dot bracket notation for a given probability information.
char * vrna_db_from_bp_stack(vrna_bp_stack_t *bp, unsigned int length)
Create a dot-backet/parenthesis structure from backtracking stack.
short * make_pair_table_snoop(const char *structure)
double FLT_OR_DBL
Typename for floating point number in partition function computations.
Definition: basic.h:43
void parenthesis_structure(char *structure, vrna_bp_stack_t *bp, int length)
Create a dot-backet/parenthesis structure from backtracking stack.
The most basic data structure required by many functions throughout the RNAlib.
Definition: fold_compound.h:132
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_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_to_element_string(const char *structure)
Convert a secondary structure in dot-bracket notation to a nucleotide annotation of loop contexts...
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.
int i
Start position (usually 5&#39; nucleotide that starts the element, e.g. base pair)
Definition: structures.h:370
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.
short * make_pair_table(const char *structure)
Create a pair table of a secondary 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.
int pairs
contains the number of base pairs in the last parsed structure.
Various data structures and pre-processor macros.
short * copy_pair_table(const short *pt)
Get an exact copy of a pair table.
char * vrna_db_to_tree_string(const char *structure, unsigned int type)
Convert a Dot-Bracket structure string into tree string representation.
short * vrna_pt_pk_get(const char *structure)
Create a pair table of a secondary structure (pseudo-knot version)
char * vrna_db_from_WUSS(const char *wuss)
Convert a WUSS annotation string to dot-bracket format.
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.
unsigned int * vrna_refBPdist_matrix(const short *pt1, const short *pt2, unsigned int turn)
Make a reference base pair distance matrix.
int j
End position (usually 3&#39; nucleotide that ends the element, e.g. base pair)
Definition: structures.h:371
char * unpack_structure(const char *packed)
Unpack secondary structure previously packed with pack_structure()
unsigned int * compute_BPdifferences(short *pt1, short *pt2, unsigned int turn)
Make a reference base pair distance matrix.
int type
Type of the element.
Definition: structures.h:373
int bp_distance(const char *str1, const char *str2)
Compute the "base pair" distance between two secondary structures s1 and s2.
short * vrna_ptable_copy(const short *pt)
Get an exact copy of a pair table.
short * alimake_pair_table(const char *structure)
vrna_hx_t * vrna_hx_merge(const vrna_hx_t *list, int maxdist)
Create a merged helix list from another helix list.
short * vrna_pt_snoop_get(const char *structure)
Create a pair table of a secondary structure (snoop version)
char * vrna_db_from_ptable(short *pt)
Convert a pair table into dot-parenthesis notation.
char * vrna_db_unpack(const char *packed)
Unpack secondary structure previously packed with vrna_db_pack()
vrna_hx_t * vrna_hx_from_ptable(short *pt)
Convert a pair table representation of a secondary structure into a helix list.
Base pair stack element.
Definition: basic.h:143
FLT_OR_DBL * pr
A pointer to the base pair probability matrix.
char * vrna_tree_string_unweight(const char *structure)
Remove weights from a linear string tree representation of a secondary structure. ...
vrna_ep_t * vrna_plist(const char *struc, float pr)
Create a vrna_ep_t from a dot-bracket string.
short * vrna_pt_ali_get(const char *structure)
Create a pair table of a secondary structure (snoop align version)
char * vrna_db_from_plist(vrna_ep_t *pairs, unsigned int n)
Convert a list of base pairs into dot-bracket notation.
void vrna_db_flatten(char *structure, unsigned int options)
Substitute pairs of brackets in a string with parenthesis.
Data structure representing a single entry of an element probability list (e.g. list of pair probabil...
Definition: structures.h:369
short * vrna_ptable_from_string(const char *string, unsigned int options)
Create a pair table for a secondary structure string.
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...
unsigned int * make_referenceBP_array(short *reference_pt, unsigned int turn)
Make a reference base pair count matrix.
unsigned int * vrna_refBPcnt_matrix(const short *reference_pt, unsigned int turn)
Make a reference base pair count matrix.