Replace Progs/RNAalifold with x64 binary and add all other programs
[jabaws.git] / binaries / src / ViennaRNA / H / RNAstruct.h
1 #ifndef __VIENNA_RNA_PACKAGE_RNASTRUCT_H__
2 #define __VIENNA_RNA_PACKAGE_RNASTRUCT_H__
3
4 /**
5  *  \file RNAstruct.h
6  *  \brief Parsing and Coarse Graining of Structures
7  * 
8  *   Example:
9  *  \verbatim
10  *   .((..(((...)))..((..)))).   is the bracket or full tree
11  *   becomes expanded:   - expand_Full() -
12  *   ((U)(((U)(U)((((U)(U)(U)P)P)P)(U)(U)(((U)(U)P)P)P)P)(U)R)
13  *   HIT:                - b2HIT() -
14  *   ((U1)((U2)((U3)P3)(U2)((U2)P2)P2)(U1)R)
15  *   Coarse:             - b2C() -
16  *   ((H)((H)M)R)
17  *   becomes expanded:   - expand_Shapiro() -
18  *   (((((H)S)((H)S)M)S)R)
19  *   weighted Shapiro:   - b2Shapiro() -
20  *   ((((((H3)S3)((H2)S2)M4)S2)E2)R)
21  *  \endverbatim
22  */
23
24 #define STRUC     2000
25
26 /**
27  *  \brief Converts the full structure from bracket notation to the HIT
28  *  notation including root.
29  * 
30  *  \param structure
31  *  \return
32  */
33 char *b2HIT(const char *structure);             /* Full   -> HIT    [incl. root] */
34
35 /**
36  *  \brief Converts the full structure from bracket notation to the a
37  *  coarse grained notation using the 'H' 'B' 'I' 'M' and 'R' identifiers.
38  * 
39  *  \param structure
40  *  \return
41  */
42 char *b2C(const char *structure);               /* Full   -> Coarse [incl. root] */
43
44 /**
45  *  \brief Converts the full structure from bracket notation to the
46  *  <i>weighted</i> coarse grained notation using the 'H' 'B' 'I' 'M' 'S' 'E' and
47  *  'R' identifiers.
48  * 
49  *  \param structure
50  *  \return
51  */
52 char *b2Shapiro(const char *structure);         /* Full -> weighted Shapiro [i.r.] */
53
54 /**
55  *  \brief Adds a root to an un-rooted tree in any except bracket notation.
56  * 
57  *  \param  structure
58  *  \return
59  */
60 char *add_root(const char *structure);                   /* {Tree} -> ({Tree}R)          */
61
62 /**
63  *  \brief Inserts missing 'S' identifiers in unweighted coarse grained structures
64  *  as obtained from b2C().
65  * 
66  *  \param coarse
67  *  \return
68  */
69 char  *expand_Shapiro(const char *coarse);
70
71 /* add S for stacks to coarse struct */
72 /**
73  *  \brief Convert the full structure from bracket notation to the
74  *  expanded notation including root.
75  * 
76  *  \param structure
77  *  \return 
78  */
79 char  *expand_Full(const char *structure);      /* Full   -> FFull         */
80
81 /**
82  *  \brief Restores the bracket notation from an expanded full or HIT tree, that is
83  *  any tree using only identifiers 'U' 'P' and 'R'.
84  * 
85  *  \param ffull
86  *  \return 
87  */
88 char  *unexpand_Full(const char *ffull);        /* FFull  -> Full          */
89
90 /**
91  *  \brief Strip weights from any weighted tree.
92  * 
93  *  \param wcoarse
94  *  \return
95  */
96 char  *unweight(const char *wcoarse);           /* remove weights from coarse struct */
97
98 /**
99  *  \brief Converts two aligned structures in expanded notation.
100  * 
101  *  Takes two aligned structures as produced by
102  *  tree_edit_distance() function back to bracket notation with '_'
103  *  as the gap character. The result overwrites the input.
104  * 
105  *  \param align
106  */
107 void   unexpand_aligned_F(char *align[2]);
108
109 /**
110  *  \brief Collects a statistic of structure elements of the full structure in
111  *  bracket notation.
112  * 
113  *  The function writes to the following global variables:
114  *  #loop_size, #loop_degree, #helix_size, #loops, #pairs, #unpaired
115  * 
116  *  \param structure
117  *  \return
118  */
119 void   parse_structure(const char *structure);  /* make structure statistics */
120
121 /**
122  *  \brief contains a list of all loop sizes. loop_size[0] contains the
123  *  number of external bases.
124  */
125 extern int    loop_size[STRUC];       /* loop sizes of a structure */
126
127 /**
128  *  \brief contains a list of all stack sizes.
129  */
130 extern int    helix_size[STRUC];      /* helix sizes of a structure */
131
132 /**
133  *  \brief contains the corresponding list of loop degrees.
134  */
135 extern int    loop_degree[STRUC];     /* loop degrees of a structure */
136
137 /**
138  *  \brief contains the number of loops ( and therefore of stacks ).
139  */
140 extern int    loops;                  /* n of loops and stacks */
141
142 /**
143  *  \brief contains the number of unpaired bases.
144  */
145 extern int    unpaired;
146
147 /**
148  *  \brief contains the number of base pairs in the last parsed structure.
149  */
150 extern int    pairs;        /* n of unpaired digits and pairs */
151
152 #endif