1 #ifndef VIENNA_RNA_PACKAGE_DATA_STRUCTURES_H
2 #define VIENNA_RNA_PACKAGE_DATA_STRUCTURES_H
3 
4 /**
5  *  @file     ViennaRNA/datastructures/basic.h
6  *  @ingroup  data_structures
7  *  @brief    Various data structures and pre-processor macros
8  */
9 
10 /**
11  *  @addtogroup   data_structures
12  *  @{
13  *
14  *  @brief All datastructures and typedefs shared among the ViennaRNA Package can be found here
15  *
16  */
17 
18 /* below are several convenience typedef's we use throughout the ViennaRNA library */
19 
20 /** @brief Typename for the base pair repesenting data structure #vrna_basepair_s */
21 typedef struct vrna_basepair_s vrna_basepair_t;
22 
23 /** @brief Typename for the base pair list repesenting data structure #vrna_elem_prob_s */
24 typedef struct vrna_elem_prob_s vrna_plist_t;
25 
26 /** @brief Typename for the base pair stack repesenting data structure #vrna_bp_stack_s */
27 typedef struct vrna_bp_stack_s vrna_bp_stack_t;
28 
29 /** @brief Typename for data structure #vrna_cpair_s */
30 typedef struct vrna_cpair_s vrna_cpair_t;
31 
32 /** @brief Typename for stack of partial structures #vrna_sect_s */
33 typedef struct vrna_sect_s vrna_sect_t;
34 
35 typedef struct vrna_data_linear_s vrna_data_lin_t;
36 
37 typedef struct vrna_color_s vrna_color_t;
38 
39 /** @brief Typename for floating point number in partition function computations */
40 #ifdef  USE_FLOAT_PF
41 typedef float FLT_OR_DBL;
42 #else
43 typedef double FLT_OR_DBL;
44 #endif
45 
46 
47 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
48 
49 /* the following typedefs are for backward compatibility only */
50 
51 /**
52  *  @brief Old typename of #vrna_basepair_s
53  *  @deprecated Use #vrna_basepair_t instead!
54  */
55 typedef struct vrna_basepair_s PAIR;
56 
57 /**
58  *  @brief Old typename of #vrna_elem_prob_s
59  *  @deprecated Use #vrna_ep_t or #vrna_elem_prob_s instead!
60  */
61 typedef struct vrna_elem_prob_s plist;
62 /**
63  *  @brief Old typename of #vrna_cpair_s
64  *  @deprecated Use #vrna_cpair_t instead!
65  */
66 typedef struct vrna_cpair_s cpair;
67 
68 /**
69  *  @brief Old typename of #vrna_sect_s
70  *  @deprecated Use #vrna_sect_t instead!
71  */
72 typedef struct vrna_sect_s sect;
73 
74 /**
75  *  @brief Old typename of #vrna_bp_stack_s
76  *  @deprecated Use #vrna_bp_stack_t instead!
77  */
78 typedef struct vrna_bp_stack_s bondT;
79 
80 #endif
81 
82 #include <ViennaRNA/params/constants.h>
83 #include <ViennaRNA/fold_compound.h>
84 #include <ViennaRNA/model.h>
85 #include <ViennaRNA/params/basic.h>
86 #include <ViennaRNA/dp_matrices.h>
87 #include <ViennaRNA/constraints/hard.h>
88 #include <ViennaRNA/constraints/soft.h>
89 #include <ViennaRNA/grammar.h>
90 #include "ViennaRNA/structured_domains.h"
91 #include "ViennaRNA/unstructured_domains.h"
92 #include "ViennaRNA/utils/structures.h"
93 
94 /*
95  * ############################################################
96  * Here are the type definitions of various datastructures
97  * shared among the Vienna RNA Package
98  * ############################################################
99  */
100 
101 /**
102  *  @brief  Base pair data structure used in subopt.c
103  */
104 struct vrna_basepair_s {
105   int i;
106   int j;
107 };
108 
109 /**
110  *  @brief this datastructure is used as input parameter in functions of PS_dot.c
111  */
112 struct vrna_cpair_s {
113   int   i, j, mfe;
114   float p, hue, sat;
115   int   type;
116 };
117 
118 struct vrna_color_s {
119   float hue;
120   float sat;
121   float bri;
122 };
123 
124 struct vrna_data_linear_s {
125   unsigned int  position;
126   float         value;
127   vrna_color_t  color;
128 };
129 
130 
131 /**
132  *  @brief  Stack of partial structures for backtracking
133  */
134 struct vrna_sect_s {
135   int i;
136   int j;
137   int ml;
138 };
139 
140 /**
141  *  @brief  Base pair stack element
142  */
143 struct vrna_bp_stack_s {
144   unsigned int  i;
145   unsigned int  j;
146 };
147 
148 
149 /*
150  * ############################################################
151  * RNAup data structures
152  * ############################################################
153  */
154 
155 /**
156  *  @brief contributions to p_u
157  */
158 typedef struct pu_contrib {
159   double  **H;    /**<  @brief  hairpin loops */
160   double  **I;    /**<  @brief  interior loops */
161   double  **M;    /**<  @brief  multi loops */
162   double  **E;    /**<  @brief  exterior loop */
163   int     length; /**<  @brief  length of the input sequence */
164   int     w;      /**<  @brief  longest unpaired region */
165 } pu_contrib;
166 
167 /**
168  *  @brief  interaction data structure for RNAup
169  */
170 typedef struct interact {
171   double  *Pi;      /**<  @brief  probabilities of interaction */
172   double  *Gi;      /**<  @brief  free energies of interaction */
173   double  Gikjl;    /**<  @brief  full free energy for interaction between [k,i] k<i
174                      *            in longer seq and [j,l] j<l in shorter seq */
175   double  Gikjl_wo; /**<  @brief  Gikjl without contributions for prob_unpaired */
176   int     i;        /**<  @brief  k<i in longer seq */
177   int     k;        /**<  @brief  k<i in longer seq */
178   int     j;        /**<  @brief  j<l in shorter seq */
179   int     l;        /**<  @brief  j<l in shorter seq */
180   int     length;   /**<  @brief  length of longer sequence */
181 } interact;
182 
183 /**
184  *  @brief  Collection of all free_energy of beeing unpaired values for output
185  */
186 typedef struct pu_out {
187   int     len;        /**<  @brief  sequence length */
188   int     u_vals;     /**<  @brief  number of different -u values */
189   int     contribs;   /**<  @brief  [-c "SHIME"] */
190   char    **header;   /**<  @brief  header line */
191   double  **u_values; /**<  @brief  (the -u values * [-c "SHIME"]) * seq len */
192 } pu_out;
193 
194 /**
195  *  @brief  constraints for cofolding
196  */
197 typedef struct constrain {
198   int   *indx;
199   char  *ptype;
200 } constrain;
201 
202 /*
203  * ############################################################
204  * RNAduplex data structures
205  * ############################################################
206  */
207 
208 /**
209  *  @brief  Data structure for RNAduplex
210  */
211 typedef struct {
212   int     i;
213   int     j;
214   int     end;
215   char    *structure;
216   double  energy;
217   double  energy_backtrack;
218   double  opening_backtrack_x;
219   double  opening_backtrack_y;
220   int     offset;
221   double  dG1;
222   double  dG2;
223   double  ddG;
224   int     tb;
225   int     te;
226   int     qb;
227   int     qe;
228 } duplexT;
229 
230 /*
231  * ############################################################
232  * RNAsnoop data structures
233  * ############################################################
234  */
235 
236 /**
237  *  @brief  Data structure for RNAsnoop (fold energy list)
238  */
239 typedef struct node {
240   int         k;
241   int         energy;
242   struct node *next;
243 } folden;
244 
245 /**
246  *  @brief  Data structure for RNAsnoop
247  */
248 typedef struct {
249   int   i;
250   int   j;
251   int   u;
252   char  *structure;
253   float energy;
254   float Duplex_El;
255   float Duplex_Er;
256   float Loop_E;
257   float Loop_D;
258   float pscd;
259   float psct;
260   float pscg;
261   float Duplex_Ol;
262   float Duplex_Or;
263   float Duplex_Ot;
264   float fullStemEnergy;
265 } snoopT;
266 
267 
268 /*
269  * ############################################################
270  * PKplex data structures
271  * ############################################################
272  */
273 
274 /**
275  *  @brief  Data structure used in RNApkplex
276  */
277 typedef struct dupVar {
278   int     i;
279   int     j;
280   int     end;
281   char    *pk_helix;
282   char    *structure;
283   double  energy;
284   int     offset;
285   double  dG1;
286   double  dG2;
287   double  ddG;
288   int     tb;
289   int     te;
290   int     qb;
291   int     qe;
292   int     inactive;
293   int     processed;
294 } dupVar;
295 
296 /**
297  *  @brief  Dummy symbol to check whether the library was build using C11/C++11 features
298  *
299  *  By default, several data structures of our new v3.0 API use C11/C++11 features, such
300  *  as unnamed unions, unnamed structs. However, these features can be deactivated at
301  *  compile time to allow building the library and executables with compilers that do not
302  *  support these features.
303  *
304  *  Now, the problem arises that once our static library is compiled and a third-party
305  *  application is supposed to link against it, it needs to know, at compile time, how to
306  *  correctly address particular data structures. This is usually implicitely taken care of
307  *  through the API exposed in our header files. Unfortunately, we had some preprocessor directives
308  *  in our header files that changed the API depending on the capabilities of the compiler
309  *  the third-party application is build with. This in turn prohibited the use of an RNAlib
310  *  compiled without C11/C++11 support in a program that compiles/links with enabled C11/C++11
311  *  support and vice-versa.
312  *
313  *  Therefore, we introduce this dummy symbol which can be used to check, whether the
314  *  static library was build with C11/C++11 features.
315  *
316  *  @note If the symbol is present, the library was build with enabled C11/C++11 features support
317  *  and no action is required. However, if the symbol is missing in RNAlib >= 2.2.9, programs
318  *  that link to RNAlib must define a pre-processor identifier @em VRNA_DISABLE_C11_FEATURES before
319  *  including any ViennaRNA Package header file, for instance by adding a @em CPPFLAG
320  *  @code
321  * CPPFLAGS+=-DVRNA_DISABLE_C11_FEATURES
322  *  @endcode
323  *
324  *  @since v2.2.9
325  */
326 #ifndef VRNA_DISABLE_C11_FEATURES
327 void vrna_C11_features(void);
328 
329 
330 #endif
331 
332 /**
333  * @}
334  */
335 
336 
337 #endif
338