RNAlib-2.6.3
 
Loading...
Searching...
No Matches
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
33typedef struct vrna_hx_s vrna_hx_t;
34
35
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
157char *
158vrna_db_pack(const char *struc);
159
160
172char *
173vrna_db_unpack(const char *packed);
174
175
191void
192vrna_db_flatten(char *structure,
193 unsigned int options);
194
195
215void
217 const char target[3],
218 unsigned int options);
219
220
238char *
239vrna_db_from_ptable(const short *pt);
240
241
252char *
254 unsigned int n);
255
256
263char *
264vrna_db_to_element_string(const char *structure);
265
266
298char *
299vrna_db_pk_remove(const char *structure,
300 unsigned int options);
301
302/* End dot-bracket interface */
321short *
322vrna_ptable(const char *structure);
323
324
344short *
345vrna_ptable_from_string(const char *structure,
346 unsigned int options);
347
348
366short *
367vrna_pt_pk_get(const char *structure);
368
369
376short *
377vrna_ptable_copy(const short *pt);
378
379
384short *
385vrna_pt_ali_get(const char *structure);
386
387
395short *
396vrna_pt_snoop_get(const char *structure);
397
398
415short *
416vrna_pt_pk_remove(const short *ptable,
417 unsigned int options);
418
419
420/* End pair table interface */
432#define VRNA_PLIST_TYPE_BASEPAIR 0
433
434
438#define VRNA_PLIST_TYPE_GQUAD 1
439
440
444#define VRNA_PLIST_TYPE_H_MOTIF 2
445
446
450#define VRNA_PLIST_TYPE_I_MOTIF 3
451
452
456#define VRNA_PLIST_TYPE_UD_MOTIF 4
457
458
462#define VRNA_PLIST_TYPE_STACK 5
463
464
468#define VRNA_PLIST_TYPE_UNPAIRED 6
469
470
474#define VRNA_PLIST_TYPE_TRIPLE 7
475
476
487 int i;
488 int j;
489 float p;
490 int type;
491};
492
508vrna_ep_t *vrna_plist(const char *struc,
509 float pr);
510
511
529 double cut_off);
530
531
532/* End pair list interface */
600char *
601vrna_db_from_WUSS(const char *wuss);
602
603
604/* End WUSS notation interface */
652char *
653vrna_abstract_shapes(const char *structure,
654 unsigned int level);
655
656
672char *
674 unsigned int level);
675
676
677/* End abstract shapes interface */
689struct vrna_hx_s {
690 unsigned int start;
691 unsigned int end;
692 unsigned int length;
693 unsigned int up5;
694 unsigned int up3;
695};
696
697
704vrna_hx_t *
706
707
711vrna_hx_t *
713 int maxdist);
714
715
716/* End helix list interface */
723int *
725
726
745int
746vrna_bp_distance_pt(const short *pt1,
747 const short *pt2);
748
763int
764vrna_bp_distance(const char *str1,
765 const char *str2);
766
767
768double
769vrna_dist_mountain(const char *str1,
770 const char *str2,
771 unsigned int p);
772
773
774/* End metrics interface */
783unsigned int *
784vrna_refBPcnt_matrix(const short *reference_pt,
785 unsigned int turn);
786
787
795unsigned int *
796vrna_refBPdist_matrix(const short *pt1,
797 const short *pt2,
798 unsigned int turn);
799
800
804char *
806 unsigned int length);
807
808
812char
813vrna_bpp_symbol(const float *x);
814
815
827char *
829 unsigned int length);
830
831
832void
833vrna_letter_structure(char *structure,
834 vrna_bp_stack_t *bp,
835 unsigned int length);
836
837
923#define VRNA_STRUCTURE_TREE_HIT 1U
924
925
930#define VRNA_STRUCTURE_TREE_SHAPIRO_SHORT 2U
931
932
937#define VRNA_STRUCTURE_TREE_SHAPIRO 3U
938
939
944#define VRNA_STRUCTURE_TREE_SHAPIRO_EXT 4U
945
946
951#define VRNA_STRUCTURE_TREE_SHAPIRO_WEIGHT 5U
952
957#define VRNA_STRUCTURE_TREE_EXPANDED 6U
958
959
989char *
990vrna_db_to_tree_string(const char *structure,
991 unsigned int type);
992
993
1005char *
1006vrna_tree_string_unweight(const char *structure);
1007
1008
1020char *
1021vrna_tree_string_to_db(const char *tree);
1022
1023
1024/* End tree representations */
1027#ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
1028
1029/*###########################################*/
1030/*# deprecated functions below #*/
1031/*###########################################*/
1032
1052DEPRECATED(void assign_plist_from_db(vrna_ep_t **pl,
1053 const char *struc,
1054 float pr),
1055 "Use vrna_plist() instead");
1056
1070DEPRECATED(char *pack_structure(const char *struc),
1071 "Use vrna_db_pack() instead");
1072
1084DEPRECATED(char *unpack_structure(const char *packed),
1085 "Use vrna_db_unpack() instead");
1086
1099DEPRECATED(short *make_pair_table(const char *structure),
1100 "Use vrna_ptable() instead");
1101
1102DEPRECATED(short *make_pair_table_pk(const char *structure),
1103 "Use vrna_ptable_from_string() instead");
1104
1114DEPRECATED(short *copy_pair_table(const short *pt),
1115 "Use vrna_ptable_copy() instead");
1116
1123DEPRECATED(short *alimake_pair_table(const char *structure),
1124 "Use vrna_pt_ali_get() instead");
1125
1133DEPRECATED(short *make_pair_table_snoop(const char *structure),
1134 "Use vrna_pt_snoop_get() instead");
1135
1136DEPRECATED(int *make_loop_index_pt(short *pt),
1137 "Use vrna_loopidx_from_ptable() instead");
1138
1152DEPRECATED(int bp_distance(const char *str1,
1153 const char *str2),
1154 "Use vrna_bp_distance() instead");
1155
1165DEPRECATED(unsigned int *make_referenceBP_array(short *reference_pt,
1166 unsigned int turn),
1167 "Use vrna_refBPcnt_matrix() instead");
1168
1178DEPRECATED(unsigned int *compute_BPdifferences(short *pt1,
1179 short *pt2,
1180 unsigned int turn),
1181 "Use vrna_refBPdist_matrix() instead");
1182
1203DEPRECATED(void assign_plist_from_pr(vrna_ep_t **pl,
1204 FLT_OR_DBL *probs,
1205 int length,
1206 double cutoff),
1207 "Use vrna_plist_from_probs() instead");
1208
1217DEPRECATED(void parenthesis_structure(char *structure,
1218 vrna_bp_stack_t *bp,
1219 int length),
1220 "Use vrna_parenthesis_structure() instead");
1221
1231DEPRECATED(void parenthesis_zuker(char *structure,
1232 vrna_bp_stack_t *bp,
1233 int length),
1234 "Use vrna_parenthesis_zuker() instead");
1235
1236DEPRECATED(void letter_structure(char *structure,
1237 vrna_bp_stack_t *bp,
1238 int length),
1239 "Use vrna_letter_structure() instead");
1240
1246DEPRECATED(void bppm_to_structure(char *structure,
1247 FLT_OR_DBL *pr,
1248 unsigned int length),
1249 "Use vrna_db_from_probs() instead");
1250
1256DEPRECATED(char bppm_symbol(const float *x),
1257 "Use vrna_bpp_symbol() instead");
1258
1259#endif
1260
1265#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:168
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 *fc, 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.
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 * copy_pair_table(const short *pt)
Get an exact copy of a pair table.
char * unpack_structure(const char *packed)
Unpack secondary structure previously packed with pack_structure()
char bppm_symbol(const float *x)
Get a pseudo dot bracket notation for a given probability information.
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 * alimake_pair_table(const char *structure)
char * pack_structure(const char *struc)
Pack secondary secondary structure, 5:1 compression using base 3 encoding.
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...
void parenthesis_structure(char *structure, vrna_bp_stack_t *bp, int length)
Create a dot-backet/parenthesis structure from backtracking stack.
unsigned int * make_referenceBP_array(short *reference_pt, unsigned int turn)
Make a reference base pair count matrix.
unsigned int * compute_BPdifferences(short *pt1, short *pt2, unsigned int turn)
Make a reference base pair distance 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.
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_from_ptable(const short *pt)
Convert a pair table into dot-parenthesis notation.
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_pk_remove(const char *structure, unsigned int options)
Remove pseudo-knots from an input structure.
char * vrna_db_unpack(const char *packed)
Unpack secondary structure previously packed with vrna_db_pack()
char * vrna_db_pack(const char *struc)
Pack secondary secondary structure, 5:1 compression using base 3 encoding.
void vrna_db_flatten(char *structure, unsigned int options)
Substitute pairs of brackets in a string with parenthesis.
vrna_hx_t * vrna_hx_from_ptable(short *pt)
Convert a pair table representation of a secondary structure into a helix list.
vrna_hx_t * vrna_hx_merge(const vrna_hx_t *list, int maxdist)
Create a merged helix list from another helix list.
Data structure representing an entry of a helix list.
Definition structures.h:689
int vrna_bp_distance(const char *str1, const char *str2)
Compute the "base pair" distance between two secondary structures s1 and s2.
int vrna_bp_distance_pt(const short *pt1, const short *pt2)
Compute the "base pair" distance between two pair tables pt1 and pt2 of secondary structures.
short * vrna_pt_pk_get(const char *structure)
Create a pair table of a secondary structure (pseudo-knot version)
short * vrna_pt_snoop_get(const char *structure)
Create a pair table of a secondary structure (snoop version)
short * vrna_pt_pk_remove(const short *ptable, unsigned int options)
Remove pseudo-knots from a pair table.
short * vrna_ptable_from_string(const char *structure, unsigned int options)
Create a pair table for a secondary structure string.
short * vrna_pt_ali_get(const char *structure)
Create a pair table of a secondary structure (snoop align version)
short * vrna_ptable(const char *structure)
Create a pair table from a dot-bracket notation of a secondary structure.
short * vrna_ptable_copy(const short *pt)
Get an exact copy of a pair table.
int i
Start position (usually 5' nucleotide that starts the element, e.g. base pair)
Definition structures.h:487
int type
Type of the element.
Definition structures.h:490
float p
Probability of the element.
Definition structures.h:489
int j
End position (usually 3' nucleotide that ends the element, e.g. base pair)
Definition structures.h:488
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:486
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_to_tree_string(const char *structure, unsigned int type)
Convert a Dot-Bracket structure string into tree string representation.
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.
unsigned int * vrna_refBPdist_matrix(const short *pt1, const short *pt2, unsigned int turn)
Make a reference base pair distance matrix.
char * vrna_db_from_bp_stack(vrna_bp_stack_t *bp, unsigned int length)
Create a dot-backet/parenthesis structure from backtracking stack.
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.
unsigned int * vrna_refBPcnt_matrix(const short *reference_pt, unsigned int turn)
Make a reference base pair count matrix.