RNAlib-2.4.8
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 *vrna_db_pack(const char *struc);
117 
118 
129 char *vrna_db_unpack(const char *packed);
130 
131 
147 void
148 vrna_db_flatten(char *structure,
149  unsigned int options);
150 
151 
171 void
172 vrna_db_flatten_to(char *string,
173  const char target[3],
174  unsigned int options);
175 
176 
183 char *vrna_db_from_ptable(short *pt);
184 
185 
197 char *vrna_db_from_WUSS(const char *wuss);
198 
199 
210  unsigned int n);
211 
212 
219 char *vrna_db_to_element_string(const char *structure);
220 
221 
222 /* End dot-bracket interface */
241 short *vrna_ptable(const char *structure);
242 
243 
259 short *
260 vrna_ptable_from_string(const char *string,
261  unsigned int options);
262 
263 
276 short *vrna_pt_pk_get(const char *structure);
277 
278 
285 short *vrna_ptable_copy(const short *pt);
286 
287 
292 short *vrna_pt_ali_get(const char *structure);
293 
294 
302 short *vrna_pt_snoop_get(const char *structure);
303 
304 
305 /* End pair table interface */
317 #define VRNA_PLIST_TYPE_BASEPAIR 0
318 
319 
323 #define VRNA_PLIST_TYPE_GQUAD 1
324 
325 
329 #define VRNA_PLIST_TYPE_H_MOTIF 2
330 
331 
335 #define VRNA_PLIST_TYPE_I_MOTIF 3
336 
337 
341 #define VRNA_PLIST_TYPE_UD_MOTIF 4
342 
343 
347 #define VRNA_PLIST_TYPE_STACK 5
348 
349 
359  int i;
360  int j;
361  float p;
362  int type;
363 };
364 
380 vrna_ep_t *vrna_plist(const char *struc,
381  float pr);
382 
383 
401  double cut_off);
402 
403 
404 /* End pair list interface */
416 struct vrna_hx_s {
417  unsigned int start;
418  unsigned int end;
419  unsigned int length;
420  unsigned int up5;
421  unsigned int up3;
422 };
423 
424 
431 vrna_hx_t *vrna_hx_from_ptable(short *pt);
432 
433 
437 vrna_hx_t *vrna_hx_merge(const vrna_hx_t *list,
438  int maxdist);
439 
440 
441 /* End helix list interface */
448 int *vrna_loopidx_from_ptable(const short *pt);
449 
450 
462 int vrna_bp_distance(const char *str1,
463  const char *str2);
464 
465 
472 unsigned int *vrna_refBPcnt_matrix(const short *reference_pt,
473  unsigned int turn);
474 
475 
483 unsigned int *vrna_refBPdist_matrix(const short *pt1,
484  const short *pt2,
485  unsigned int turn);
486 
487 
491 char *vrna_db_from_probs(const FLT_OR_DBL *pr,
492  unsigned int length);
493 
494 
498 char vrna_bpp_symbol(const float *x);
499 
500 
513  unsigned int length);
514 
515 
516 void vrna_letter_structure(char *structure,
517  vrna_bp_stack_t *bp,
518  unsigned int length);
519 
520 
537 #define VRNA_STRUCTURE_TREE_HIT 1U
538 
539 
544 #define VRNA_STRUCTURE_TREE_SHAPIRO_SHORT 2U
545 
546 
551 #define VRNA_STRUCTURE_TREE_SHAPIRO 3U
552 
553 
558 #define VRNA_STRUCTURE_TREE_SHAPIRO_EXT 4U
559 
560 
565 #define VRNA_STRUCTURE_TREE_SHAPIRO_WEIGHT 5U
566 
571 #define VRNA_STRUCTURE_TREE_EXPANDED 6U
572 
573 
603 char *
604 vrna_db_to_tree_string(const char *structure,
605  unsigned int type);
606 
607 
619 char *
620 vrna_tree_string_unweight(const char *structure);
621 
622 
634 char *
635 vrna_tree_string_to_db(const char *tree);
636 
637 
638 /* End tree representations */
641 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
642 
643 /*###########################################*/
644 /*# deprecated functions below #*/
645 /*###########################################*/
646 
666 DEPRECATED(void assign_plist_from_db(vrna_ep_t **pl,
667  const char *struc,
668  float pr),
669  "Use vrna_plist() instead");
670 
684 DEPRECATED(char *pack_structure(const char *struc),
685  "Use vrna_db_pack() instead");
686 
698 DEPRECATED(char *unpack_structure(const char *packed),
699  "Use vrna_db_unpack() instead");
700 
713 DEPRECATED(short *make_pair_table(const char *structure),
714  "Use vrna_ptable() instead");
715 
716 DEPRECATED(short *make_pair_table_pk(const char *structure),
717  "Use vrna_ptable_from_string() instead");
718 
728 DEPRECATED(short *copy_pair_table(const short *pt),
729  "Use vrna_ptable_copy() instead");
730 
737 DEPRECATED(short *alimake_pair_table(const char *structure),
738  "Use vrna_pt_ali_get() instead");
739 
747 DEPRECATED(short *make_pair_table_snoop(const char *structure),
748  "Use vrna_pt_snoop_get() instead");
749 
750 DEPRECATED(int *make_loop_index_pt(short *pt),
751  "Use vrna_loopidx_from_ptable() instead");
752 
766 DEPRECATED(int bp_distance(const char *str1,
767  const char *str2),
768  "Use vrna_bp_distance() instead");
769 
779 DEPRECATED(unsigned int *make_referenceBP_array(short *reference_pt,
780  unsigned int turn),
781  "Use vrna_refBPcnt_matrix() instead");
782 
792 DEPRECATED(unsigned int *compute_BPdifferences(short *pt1,
793  short *pt2,
794  unsigned int turn),
795  "Use vrna_refBPdist_matrix() instead");
796 
817 DEPRECATED(void assign_plist_from_pr(vrna_ep_t **pl,
818  FLT_OR_DBL *probs,
819  int length,
820  double cutoff),
821  "Use vrna_plist_from_probs() instead");
822 
831 DEPRECATED(void parenthesis_structure(char *structure,
832  vrna_bp_stack_t *bp,
833  int length),
834  "Use vrna_parenthesis_structure() instead");
835 
845 DEPRECATED(void parenthesis_zuker(char *structure,
846  vrna_bp_stack_t *bp,
847  int length),
848  "Use vrna_parenthesis_zuker() instead");
849 
850 DEPRECATED(void letter_structure(char *structure,
851  vrna_bp_stack_t *bp,
852  int length),
853  "Use vrna_letter_structure() instead");
854 
860 DEPRECATED(void bppm_to_structure(char *structure,
861  FLT_OR_DBL *pr,
862  unsigned int length),
863  "Use vrna_db_from_probs() instead");
864 
870 DEPRECATED(char bppm_symbol(const float *x),
871  "Use vrna_bpp_symbol() instead");
872 
873 #endif
874 
879 #endif
float p
Probability of the element.
Definition: structures.h:361
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:416
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:359
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:360
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:362
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:142
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:358
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.