RNAlib-2.2.2
data_structures.h
Go to the documentation of this file.
1 #ifndef VIENNA_RNA_PACKAGE_DATA_STRUCTURES_H
2 #define VIENNA_RNA_PACKAGE_DATA_STRUCTURES_H
3 
13 /* below are several convenience typedef's we use throughout the ViennaRNA library */
14 
19 
22 
24 typedef struct vrna_plist_s vrna_plist_t;
25 
28 
30 typedef struct vrna_cpair_s vrna_cpair_t;
31 
33 typedef struct vrna_sect_s vrna_sect_t;
34 
36 #ifdef USE_FLOAT_PF
37 typedef float FLT_OR_DBL;
38 #else
39 typedef double FLT_OR_DBL;
40 #endif
41 
51 typedef void (vrna_callback_free_auxdata)(void *data);
52 
61 typedef void (vrna_callback_recursion_status)(vrna_fold_compound_t *vc, unsigned char status);
62 
63 
71 #define VRNA_STATUS_MFE_PRE (unsigned char)1
72 
80 #define VRNA_STATUS_MFE_POST (unsigned char)2
81 
88 #define VRNA_STATUS_PF_PRE (unsigned char)3
89 
96 #define VRNA_STATUS_PF_POST (unsigned char)4
97 
98 
99 /* make this interface backward compatible with RNAlib < 2.2.0 */
100 #define VRNA_BACKWARD_COMPAT
101 
102 
103 #ifdef VRNA_BACKWARD_COMPAT
104 
105 /* the following typedefs are for backward compatibility only */
106 
111 typedef struct vrna_basepair_s PAIR;
112 
117 typedef struct vrna_plist_s plist;
118 
123 typedef struct vrna_cpair_s cpair;
124 
129 typedef struct vrna_sect_s sect;
130 
135 typedef struct vrna_bp_stack_s bondT;
136 
137 #endif
138 
139 #include <ViennaRNA/energy_const.h>
140 #include <ViennaRNA/model.h>
141 #include <ViennaRNA/params.h>
142 #include <ViennaRNA/dp_matrices.h>
143 #include <ViennaRNA/constraints.h>
144 
145 /*
146 * ############################################################
147 * Here are the type definitions of various datastructures
148 * shared among the Vienna RNA Package
149 * ############################################################
150 */
151 
156  int i;
157  int j;
158 };
159 
163 struct vrna_plist_s {
164  int i;
165  int j;
166  float p;
167  int type;
168 };
169 
173 struct vrna_cpair_s {
174  int i,j,mfe;
175  float p, hue, sat;
176 };
177 
178 
182 struct vrna_sect_s {
183  int i;
184  int j;
185  int ml;
186 };
187 
192  unsigned int i;
193  unsigned int j;
194 };
195 
196 
197 /*
198 * ############################################################
199 * RNAup data structures
200 * ############################################################
201 */
202 
206 typedef struct pu_contrib {
207  double **H;
208  double **I;
209  double **M;
210  double **E;
211  int length;
212  int w;
213 } pu_contrib;
214 
218 typedef struct interact {
219  double *Pi;
220  double *Gi;
221  double Gikjl;
223  double Gikjl_wo;
224  int i;
225  int k;
226  int j;
227  int l;
228  int length;
229 } interact;
230 
234 typedef struct pu_out {
235  int len;
236  int u_vals;
237  int contribs;
238  char **header;
239  double **u_values;
240 } pu_out;
241 
245 typedef struct constrain{
246  int *indx;
247  char *ptype;
248 } constrain;
249 
250 /*
251 * ############################################################
252 * RNAduplex data structures
253 * ############################################################
254 */
255 
259 typedef struct {
260  int i;
261  int j;
262  int end;
263  char *structure;
264  double energy;
265  double energy_backtrack;
266  double opening_backtrack_x;
267  double opening_backtrack_y;
268  int offset;
269  double dG1;
270  double dG2;
271  double ddG;
272  int tb;
273  int te;
274  int qb;
275  int qe;
276 } duplexT;
277 
278 /*
279 * ############################################################
280 * RNAsnoop data structures
281 * ############################################################
282 */
283 
287 typedef struct node {
288  int k;
289  int energy;
290  struct node *next;
291 } folden;
292 
296 typedef struct {
297  int i;
298  int j;
299  int u;
300  char *structure;
301  float energy;
302  float Duplex_El;
303  float Duplex_Er;
304  float Loop_E;
305  float Loop_D;
306  float pscd;
307  float psct;
308  float pscg;
309  float Duplex_Ol;
310  float Duplex_Or;
311  float Duplex_Ot;
312  float fullStemEnergy;
313 } snoopT;
314 
315 
316 /*
317 * ############################################################
318 * PKplex data structures
319 * ############################################################
320 */
321 
325 typedef struct dupVar{
326  int i;
327  int j;
328  int end;
329  char *pk_helix;
330  char *structure;
331  double energy;
332  int offset;
333  double dG1;
334  double dG2;
335  double ddG;
336  int tb;
337  int te;
338  int qb;
339  int qe;
340  int inactive;
341  int processed;
342 } dupVar;
343 
349 /*
350 * ############################################################
351 * VRNA fold compound related functions
352 * ############################################################
353 */
354 
371 typedef enum {
375 
376 
389 struct vrna_fc_s{
390 
402  unsigned int length;
403  int cutpoint;
415  int *iindx;
416  int *jindx;
429  void *auxdata;
441 #if __STDC_VERSION__ >= 201112L
442  /* C11 support for unnamed unions/structs */
443  union {
444  struct {
445 #endif
446 
451  char *sequence;
458  short *sequence_encoding2;
459  char *ptype;
481 #if __STDC_VERSION__ >= 201112L
482  /* C11 support for unnamed unions/structs */
483  };
484  struct {
485 #endif
486 
491  char **sequences;
495  unsigned int n_seq;
498  char *cons_seq;
501  short *S_cons;
504  short **S;
507  short **S5;
510  short **S3;
513  char **Ss;
514  unsigned short **a2s;
515  int *pscore;
521  int oldAliEn;
522 
526 #if __STDC_VERSION__ >= 201112L
527  };
528  };
529 #endif
530 
537  unsigned int maxD1;
538  unsigned int maxD2;
539  short *reference_pt1;
540  short *reference_pt2;
542  unsigned int *referenceBPs1;
543  unsigned int *referenceBPs2;
544  unsigned int *bpdist;
546  unsigned int *mm1;
547  unsigned int *mm2;
560  char **ptype_local;
565 };
566 
567 
568 /* the definitions below should be used for functions that return/receive/destroy fold compound data structures */
569 
576 #define VRNA_OPTION_MFE 1
577 
584 #define VRNA_OPTION_PF 2
585 
586 #define VRNA_OPTION_HYBRID 4
587 
597 #define VRNA_OPTION_EVAL_ONLY 8
598 
599 #define VRNA_OPTION_WINDOW 16
600 
601 
633 vrna_fold_compound( const char *sequence,
634  vrna_md_t *md_p,
635  unsigned int options);
636 
666 vrna_fold_compound_comparative( const char **sequences,
667  vrna_md_t *md_p,
668  unsigned int options);
669 
671 vrna_fold_compound_TwoD(const char *sequence,
672  const char *s1,
673  const char *s2,
674  vrna_md_t *md_p,
675  unsigned int options);
676 
684 void
686 
705  void *data,
707 
725 
730 #endif
short ** S3
Sl[s][i] holds next base 3' of i in sequence s.
Definition: data_structures.h:510
short ** S
Numerical encoding of the sequences in the alignment.
Definition: data_structures.h:504
void vrna_fold_compound_add_callback(vrna_fold_compound_t *vc, vrna_callback_recursion_status *f)
Add a recursion status callback to the vrna_fold_compound_t.
int l
j
Definition: data_structures.h:227
double ** M
multi loops
Definition: data_structures.h:209
unsigned int * mm1
Maximum matching matrix, reference struct 1 disallowed.
Definition: data_structures.h:546
Minimum Free Energy (MFE) Dynamic Programming (DP) matrices data structure required within the vrna_f...
Definition: dp_matrices.h:39
vrna_fold_compound_t * vrna_fold_compound_comparative(const char **sequences, vrna_md_t *md_p, unsigned int options)
Retrieve a vrna_fold_compound_t data structure for sequence alignments.
short * S_cons
Numerical encoding of the consensus sequence.
Definition: data_structures.h:501
char * ptype
Pair type array.
Definition: data_structures.h:459
short * sequence_encoding
Numerical encoding of the input sequence.
Definition: data_structures.h:454
double ** H
hairpin loops
Definition: data_structures.h:207
vrna_exp_param_t * exp_params
The precomputed free energy contributions as Boltzmann factors.
Definition: data_structures.h:413
struct constrain constrain
constraints for cofolding
int u_vals
number of different -u values
Definition: data_structures.h:236
Definition: data_structures.h:325
unsigned int * bpdist
Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j].
Definition: data_structures.h:544
short * reference_pt1
A pairtable of the first reference structure.
Definition: data_structures.h:539
vrna_sc_t * sc
The soft constraints for usage in structure prediction and evaluation.
Definition: data_structures.h:473
struct pu_contrib pu_contrib
contributions to p_u
double FLT_OR_DBL
Typename for floating point number in partition function computations.
Definition: data_structures.h:39
The most basic data structure required by many functions throughout the RNAlib.
Definition: data_structures.h:389
char ** sequences
The aligned sequences.
Definition: data_structures.h:491
int j
j
Definition: data_structures.h:226
Definition: data_structures.h:287
contributions to p_u
Definition: data_structures.h:206
int contribs
[-c "SHIME"]
Definition: data_structures.h:237
The model details data structure and its corresponding modifiers.
void * auxdata
A pointer to auxiliary, user-defined data.
Definition: data_structures.h:429
The datastructure that contains temperature scaled energy parameters.
Definition: params.h:50
int i
k
Definition: data_structures.h:224
void vrna_fold_compound_add_auxdata(vrna_fold_compound_t *vc, void *data, vrna_callback_free_auxdata *f)
Add auxiliary data to the vrna_fold_compound_t.
Definition: data_structures.h:296
double ** u_values
(the -u values * [-c "SHIME"]) * seq len
Definition: data_structures.h:239
char * cons_seq
The consensus sequence of the aligned sequences.
Definition: data_structures.h:498
vrna_hc_t * hc
The hard constraints data structure used for structure prediction.
Definition: data_structures.h:407
char * ptype_pf_compat
ptype array indexed via iindx
Definition: data_structures.h:468
Definition: data_structures.h:372
Stack of partial structures for backtracking.
Definition: data_structures.h:182
this datastructure is used as input parameter in functions of PS_dot.c
Definition: data_structures.h:173
int * jindx
DP matrix accessor.
Definition: data_structures.h:416
void vrna_fold_compound_free(vrna_fold_compound_t *vc)
Free memory occupied by a vrna_fold_compound_t.
vrna_fc_type_e
An enumerator that is used to specify the type of a vrna_fold_compound_t.
Definition: data_structures.h:371
vrna_fold_compound_t * vrna_fold_compound(const char *sequence, vrna_md_t *md_p, unsigned int options)
Retrieve a vrna_fold_compound_t data structure for single sequences and hybridizing sequences...
Base pair data structure used in subopt.c.
Definition: data_structures.h:155
The data structure that contains the complete model details used throughout the calculations.
Definition: model.h:187
The soft constraints data structure.
Definition: constraints.h:511
int w
longest unpaired region
Definition: data_structures.h:212
struct pu_out pu_out
Collection of all free_energy of beeing unpaired values for output.
short ** S5
S5[s][i] holds next base 5' of i in sequence s.
Definition: data_structures.h:507
void( vrna_callback_recursion_status)(vrna_fold_compound_t *vc, unsigned char status)
Callback to perform specific user-defined actions before, or after recursive computations.
Definition: data_structures.h:61
The datastructure that contains temperature scaled Boltzmann weights of the energy parameters...
Definition: params.h:94
vrna_sc_t ** scs
A set of soft constraints (for each sequence in the alignment)
Definition: data_structures.h:518
void( vrna_callback_free_auxdata)(void *data)
Callback to free memory allocated for auxiliary user-provided data.
Definition: data_structures.h:51
int k
k
Definition: data_structures.h:225
The hard constraints data structure.
Definition: constraints.h:468
Definition: data_structures.h:218
double * Pi
probabilities of interaction
Definition: data_structures.h:219
constraints for cofolding
Definition: data_structures.h:245
double ** I
interior loops
Definition: data_structures.h:208
int len
sequence length
Definition: data_structures.h:235
int length
length of the input sequence
Definition: data_structures.h:211
char ** header
header line
Definition: data_structures.h:238
this datastructure is used as input parameter in functions of PS_dot.h and others ...
Definition: data_structures.h:163
vrna_param_t * params
The precomputed free energy contributions for each type of loop.
Definition: data_structures.h:412
int * pscore
Precomputed array of pair types expressed as pairing scores.
Definition: data_structures.h:515
unsigned int n_seq
The number of sequences in the alignment.
Definition: data_structures.h:495
unsigned int * referenceBPs2
Matrix containing number of basepairs of reference structure2 in interval [i,j].
Definition: data_structures.h:543
int length
length of longer sequence
Definition: data_structures.h:228
char * sequence
The input sequence string.
Definition: data_structures.h:451
vrna_mx_mfe_t * matrices
The MFE DP matrices.
Definition: data_structures.h:409
Definition: data_structures.h:373
vrna_callback_recursion_status * stat_cb
Recursion status callback (usually called just before, and after recursive computations in the librar...
Definition: data_structures.h:424
int cutpoint
The position of the (cofold) cutpoint within the provided sequence. If there is no cutpoint...
Definition: data_structures.h:403
vrna_callback_free_auxdata * free_auxdata
A callback to free auxiliary user data whenever the fold_compound itself is free'd.
Definition: data_structures.h:433
Collection of all free_energy of beeing unpaired values for output.
Definition: data_structures.h:234
double Gikjl
full free energy for interaction between [k,i] k
Definition: data_structures.h:221
unsigned int length
The length of the sequence (or sequence alignment)
Definition: data_structures.h:402
Base pair stack element.
Definition: data_structures.h:191
double * Gi
free energies of interaction
Definition: data_structures.h:220
short * reference_pt2
A pairtable of the second reference structure.
Definition: data_structures.h:540
unsigned int maxD1
Maximum allowed base pair distance to first reference.
Definition: data_structures.h:537
unsigned int * mm2
Maximum matching matrix, reference struct 2 disallowed.
Definition: data_structures.h:547
Definition: data_structures.h:259
unsigned int * referenceBPs1
Matrix containing number of basepairs of reference structure1 in interval [i,j].
Definition: data_structures.h:542
vrna_fc_type_e type
The type of the vrna_fold_compound_t.
Definition: data_structures.h:395
int window_size
window size for local folding sliding window approach
Definition: data_structures.h:559
char ** ptype_local
Pair type array (for local folding)
Definition: data_structures.h:560
double Gikjl_wo
Gikjl without contributions for prob_unpaired.
Definition: data_structures.h:223
int * iindx
DP matrix accessor.
Definition: data_structures.h:415
double ** E
exterior loop
Definition: data_structures.h:210
Partition function (PF) Dynamic Programming (DP) matrices data structure required within the vrna_fol...
Definition: dp_matrices.h:197
unsigned int maxD2
Maximum allowed base pair distance to second reference.
Definition: data_structures.h:538
vrna_mx_pf_t * exp_matrices
The PF DP matrices.
Definition: data_structures.h:410