RNAlib-2.3.1
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 
18 /* below are several convenience typedef's we use throughout the ViennaRNA library */
19 
24 
27 
29 typedef struct vrna_plist_s vrna_plist_t;
30 
33 
35 typedef struct vrna_cpair_s vrna_cpair_t;
36 
38 typedef struct vrna_sect_s vrna_sect_t;
39 
40 typedef struct vrna_data_linear_s vrna_data_lin_t;
41 
42 typedef struct vrna_color_s vrna_color_t;
43 
45 #ifdef USE_FLOAT_PF
46 typedef float FLT_OR_DBL;
47 #else
48 typedef double FLT_OR_DBL;
49 #endif
50 
60 typedef void (vrna_callback_free_auxdata)(void *data);
61 
71 typedef void (vrna_callback_recursion_status)(unsigned char status, void *data);
72 
80 #define VRNA_STATUS_MFE_PRE (unsigned char)1
81 
89 #define VRNA_STATUS_MFE_POST (unsigned char)2
90 
97 #define VRNA_STATUS_PF_PRE (unsigned char)3
98 
105 #define VRNA_STATUS_PF_POST (unsigned char)4
106 
107 
108 #define VRNA_PLIST_TYPE_BASEPAIR 0
109 #define VRNA_PLIST_TYPE_GQUAD 1
110 #define VRNA_PLIST_TYPE_H_MOTIF 2
111 #define VRNA_PLIST_TYPE_I_MOTIF 3
112 #define VRNA_PLIST_TYPE_UD_MOTIF 4
113 
114 
115 /* make this interface backward compatible with RNAlib < 2.2.0 */
116 #define VRNA_BACKWARD_COMPAT
117 
118 
119 #ifdef VRNA_BACKWARD_COMPAT
120 
121 /* the following typedefs are for backward compatibility only */
122 
127 typedef struct vrna_basepair_s PAIR;
128 
133 typedef struct vrna_plist_s plist;
134 
139 typedef struct vrna_cpair_s cpair;
140 
145 typedef struct vrna_sect_s sect;
146 
151 typedef struct vrna_bp_stack_s bondT;
152 
153 #endif
154 
155 #include <ViennaRNA/energy_const.h>
156 #include <ViennaRNA/model.h>
157 #include <ViennaRNA/params.h>
158 #include <ViennaRNA/dp_matrices.h>
159 #include <ViennaRNA/constraints.h>
160 #include <ViennaRNA/grammar.h>
163 
164 /*
165 * ############################################################
166 * Here are the type definitions of various datastructures
167 * shared among the Vienna RNA Package
168 * ############################################################
169 */
170 
175  int i;
176  int j;
177 };
178 
182 struct vrna_plist_s {
183  int i;
184  int j;
185  float p;
186  int type;
187 };
188 
192 struct vrna_cpair_s {
193  int i,j,mfe;
194  float p, hue, sat;
195 };
196 
197 struct vrna_color_s {
198  float hue;
199  float sat;
200  float bri;
201 };
202 
204  unsigned int position;
205  float value;
206  vrna_color_t color;
207 };
208 
209 
213 struct vrna_sect_s {
214  int i;
215  int j;
216  int ml;
217 };
218 
223  unsigned int i;
224  unsigned int j;
225 };
226 
227 
228 /*
229 * ############################################################
230 * RNAup data structures
231 * ############################################################
232 */
233 
237 typedef struct pu_contrib {
238  double **H;
239  double **I;
240  double **M;
241  double **E;
242  int length;
243  int w;
244 } pu_contrib;
245 
249 typedef struct interact {
250  double *Pi;
251  double *Gi;
252  double Gikjl;
254  double Gikjl_wo;
255  int i;
256  int k;
257  int j;
258  int l;
259  int length;
260 } interact;
261 
265 typedef struct pu_out {
266  int len;
267  int u_vals;
268  int contribs;
269  char **header;
270  double **u_values;
271 } pu_out;
272 
276 typedef struct constrain{
277  int *indx;
278  char *ptype;
279 } constrain;
280 
281 /*
282 * ############################################################
283 * RNAduplex data structures
284 * ############################################################
285 */
286 
290 typedef struct {
291  int i;
292  int j;
293  int end;
294  char *structure;
295  double energy;
296  double energy_backtrack;
297  double opening_backtrack_x;
298  double opening_backtrack_y;
299  int offset;
300  double dG1;
301  double dG2;
302  double ddG;
303  int tb;
304  int te;
305  int qb;
306  int qe;
307 } duplexT;
308 
309 /*
310 * ############################################################
311 * RNAsnoop data structures
312 * ############################################################
313 */
314 
318 typedef struct node {
319  int k;
320  int energy;
321  struct node *next;
322 } folden;
323 
327 typedef struct {
328  int i;
329  int j;
330  int u;
331  char *structure;
332  float energy;
333  float Duplex_El;
334  float Duplex_Er;
335  float Loop_E;
336  float Loop_D;
337  float pscd;
338  float psct;
339  float pscg;
340  float Duplex_Ol;
341  float Duplex_Or;
342  float Duplex_Ot;
343  float fullStemEnergy;
344 } snoopT;
345 
346 
347 /*
348 * ############################################################
349 * PKplex data structures
350 * ############################################################
351 */
352 
356 typedef struct dupVar{
357  int i;
358  int j;
359  int end;
360  char *pk_helix;
361  char *structure;
362  double energy;
363  int offset;
364  double dG1;
365  double dG2;
366  double ddG;
367  int tb;
368  int te;
369  int qb;
370  int qe;
371  int inactive;
372  int processed;
373 } dupVar;
374 
405 #ifndef VRNA_DISABLE_C11_FEATURES
406 void vrna_C11_features(void);
407 #endif
408 
414 /*
415 * ############################################################
416 * VRNA fold compound related functions
417 * ############################################################
418 */
419 
436 typedef enum {
440 
441 
454 struct vrna_fc_s{
455 
467  unsigned int length;
468  int cutpoint;
480  int *iindx;
481  int *jindx;
494  void *auxdata;
509  /* data structure to adjust additional structural domains, such as G-quadruplexes */
512  /* data structure to adjust additional contributions to unpaired stretches, e.g. due to protein binding */
515  /* auxiliary (user-defined) extension to the folding grammar */
516  vrna_gr_aux_t *aux_grammar;
517 
522 #ifndef VRNA_DISABLE_C11_FEATURES
523  /* C11 support for unnamed unions/structs */
524  union {
525  struct {
526 #endif
527 
532  char *sequence;
539  short *sequence_encoding2;
540  char *ptype;
562 #ifndef VRNA_DISABLE_C11_FEATURES
563  /* C11 support for unnamed unions/structs */
564  };
565  struct {
566 #endif
567 
572  char **sequences;
576  unsigned int n_seq;
579  char *cons_seq;
582  short *S_cons;
585  short **S;
588  short **S5;
591  short **S3;
594  char **Ss;
595  unsigned short **a2s;
596  int *pscore;
606  int oldAliEn;
607 
611 #ifndef VRNA_DISABLE_C11_FEATURES
612  };
613  };
614 #endif
615 
622  unsigned int maxD1;
623  unsigned int maxD2;
624  short *reference_pt1;
625  short *reference_pt2;
627  unsigned int *referenceBPs1;
628  unsigned int *referenceBPs2;
629  unsigned int *bpdist;
631  unsigned int *mm1;
632  unsigned int *mm2;
645  char **ptype_local;
650 };
651 
652 
653 /* the definitions below should be used for functions that return/receive/destroy fold compound data structures */
654 
658 #define VRNA_OPTION_DEFAULT 0U
659 
666 #define VRNA_OPTION_MFE 1U
667 
674 #define VRNA_OPTION_PF 2U
675 
679 #define VRNA_OPTION_HYBRID 4U
680 
690 #define VRNA_OPTION_EVAL_ONLY 8U
691 
695 #define VRNA_OPTION_WINDOW 16U
696 
737 vrna_fold_compound( const char *sequence,
738  vrna_md_t *md_p,
739  unsigned int options);
740 
779 vrna_fold_compound_comparative( const char **sequences,
780  vrna_md_t *md_p,
781  unsigned int options);
782 
784 vrna_fold_compound_TwoD(const char *sequence,
785  const char *s1,
786  const char *s2,
787  vrna_md_t *md_p,
788  unsigned int options);
789 
790 int
791 vrna_fold_compound_prepare( vrna_fold_compound_t *vc,
792  unsigned int options);
793 
801 void
803 
822  void *data,
824 
842 
843 
848 #endif
short ** S3
Sl[s][i] holds next base 3&#39; of i in sequence s.
Definition: data_structures.h:591
short ** S
Numerical encoding of the sequences in the alignment.
Definition: data_structures.h:585
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.
Definition: structured_domains.h:26
int l
j<l in shorter seq
Definition: data_structures.h:258
double ** M
multi loops
Definition: data_structures.h:240
unsigned int * mm1
Maximum matching matrix, reference struct 1 disallowed.
Definition: data_structures.h:631
Minimum Free Energy (MFE) Dynamic Programming (DP) matrices data structure required within the vrna_f...
Definition: dp_matrices.h:45
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:582
void vrna_C11_features(void)
Dummy symbol to check whether the library was build using C11/C++11 features.
char * ptype
Pair type array.
Definition: data_structures.h:540
Functions to deal with standard dynamic programming (DP) matrices.
short * sequence_encoding
Numerical encoding of the input sequence.
Definition: data_structures.h:535
double ** H
hairpin loops
Definition: data_structures.h:238
vrna_exp_param_t * exp_params
The precomputed free energy contributions as Boltzmann factors.
Definition: data_structures.h:478
struct dupVar dupVar
Data structure used in RNApkplex.
struct constrain constrain
constraints for cofolding
Data structure to store all functionality for ligand binding.
Definition: unstructured_domains.h:147
int u_vals
number of different -u values
Definition: data_structures.h:267
Data structure used in RNApkplex.
Definition: data_structures.h:356
unsigned int * bpdist
Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j].
Definition: data_structures.h:629
short * reference_pt1
A pairtable of the first reference structure.
Definition: data_structures.h:624
vrna_sc_t * sc
The soft constraints for usage in structure prediction and evaluation.
Definition: data_structures.h:554
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:48
The most basic data structure required by many functions throughout the RNAlib.
Definition: data_structures.h:454
char ** sequences
The aligned sequences.
Definition: data_structures.h:572
int j
j<l in shorter seq
Definition: data_structures.h:257
Data structure for RNAsnoop (fold energy list)
Definition: data_structures.h:318
contributions to p_u
Definition: data_structures.h:237
int contribs
[-c "SHIME"]
Definition: data_structures.h:268
The model details data structure and its corresponding modifiers.
void * auxdata
A pointer to auxiliary, user-defined data.
Definition: data_structures.h:494
The datastructure that contains temperature scaled energy parameters.
Definition: params.h:55
short * pscore_pf_compat
Precomputed array of pair types expressed as pairing scores indexed via iindx.
Definition: data_structures.h:599
vrna_sd_t * domains_struc
Additional structured domains.
Definition: data_structures.h:510
int i
k<i in longer seq
Definition: data_structures.h:255
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.
vrna_ud_t * domains_up
Additional unstructured domains.
Definition: data_structures.h:513
Data structure for RNAsnoop.
Definition: data_structures.h:327
double ** u_values
(the -u values * [-c "SHIME"]) * seq len
Definition: data_structures.h:270
char * cons_seq
The consensus sequence of the aligned sequences.
Definition: data_structures.h:579
Definition: grammar.h:18
vrna_hc_t * hc
The hard constraints data structure used for structure prediction.
Definition: data_structures.h:472
char * ptype_pf_compat
ptype array indexed via iindx
Definition: data_structures.h:549
Stack of partial structures for backtracking.
Definition: data_structures.h:213
this datastructure is used as input parameter in functions of PS_dot.c
Definition: data_structures.h:192
int * jindx
DP matrix accessor.
Definition: data_structures.h:481
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:436
Energy parameter constants.
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:174
The soft constraints data structure.
Definition: constraints_soft.h:101
int w
longest unpaired region
Definition: data_structures.h:243
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&#39; of i in sequence s.
Definition: data_structures.h:588
Definition: data_structures.h:203
Functions to deal with sets of energy parameters.
The data structure that contains temperature scaled Boltzmann weights of the energy parameters...
Definition: params.h:99
The data structure that contains the complete model details used throughout the calculations.
Definition: model.h:191
vrna_sc_t ** scs
A set of soft constraints (for each sequence in the alignment)
Definition: data_structures.h:603
void( vrna_callback_free_auxdata)(void *data)
Callback to free memory allocated for auxiliary user-provided data.
Definition: data_structures.h:60
int k
k<i in longer seq
Definition: data_structures.h:256
The hard constraints data structure.
Definition: constraints_hard.h:305
Definition: data_structures.h:438
Functions to modify unstructured domains, e.g. to incorporate ligands binding to unpaired stretches...
interaction data structure for RNAup
Definition: data_structures.h:249
double * Pi
probabilities of interaction
Definition: data_structures.h:250
int oldAliEn
use old alifold energies (with gaps)
constraints for cofolding
Definition: data_structures.h:276
double ** I
interior loops
Definition: data_structures.h:239
struct node folden
Data structure for RNAsnoop (fold energy list)
int len
sequence length
Definition: data_structures.h:266
void( vrna_callback_recursion_status)(unsigned char status, void *data)
Callback to perform specific user-defined actions before, or after recursive computations.
Definition: data_structures.h:71
int length
length of the input sequence
Definition: data_structures.h:242
char ** header
header line
Definition: data_structures.h:269
this datastructure is used as input parameter in functions of PS_dot.h and others ...
Definition: data_structures.h:182
vrna_param_t * params
The precomputed free energy contributions for each type of loop.
Definition: data_structures.h:477
int * pscore
Precomputed array of pair types expressed as pairing scores.
Definition: data_structures.h:596
unsigned int n_seq
The number of sequences in the alignment.
Definition: data_structures.h:576
unsigned int * referenceBPs2
Matrix containing number of basepairs of reference structure2 in interval [i,j].
Definition: data_structures.h:628
int length
length of longer sequence
Definition: data_structures.h:259
char * sequence
The input sequence string.
Definition: data_structures.h:532
vrna_mx_mfe_t * matrices
The MFE DP matrices.
Definition: data_structures.h:474
Definition: data_structures.h:437
struct interact interact
interaction data structure for RNAup
vrna_callback_recursion_status * stat_cb
Recursion status callback (usually called just before, and after recursive computations in the librar...
Definition: data_structures.h:489
int cutpoint
The position of the (cofold) cutpoint within the provided sequence. If there is no cutpoint...
Definition: data_structures.h:468
vrna_callback_free_auxdata * free_auxdata
A callback to free auxiliary user data whenever the fold_compound itself is free&#39;d.
Definition: data_structures.h:498
Collection of all free_energy of beeing unpaired values for output.
Definition: data_structures.h:265
double Gikjl
full free energy for interaction between [k,i] k<i in longer seq and [j,l] j<l in shorter seq ...
Definition: data_structures.h:252
unsigned int length
The length of the sequence (or sequence alignment)
Definition: data_structures.h:467
Base pair stack element.
Definition: data_structures.h:222
Functions and data structures for constraining secondary structure predictions and evaluation...
double * Gi
free energies of interaction
Definition: data_structures.h:251
Definition: data_structures.h:197
short * reference_pt2
A pairtable of the second reference structure.
Definition: data_structures.h:625
This module provides interfaces that deal with additional structured domains in the folding grammar...
unsigned int maxD1
Maximum allowed base pair distance to first reference.
Definition: data_structures.h:622
unsigned int * mm2
Maximum matching matrix, reference struct 2 disallowed.
Definition: data_structures.h:632
Data structure for RNAduplex.
Definition: data_structures.h:290
unsigned int * referenceBPs1
Matrix containing number of basepairs of reference structure1 in interval [i,j].
Definition: data_structures.h:627
Implementations for the RNA folding grammar.
vrna_fc_type_e type
The type of the vrna_fold_compound_t.
Definition: data_structures.h:460
int window_size
window size for local folding sliding window approach
Definition: data_structures.h:644
char ** ptype_local
Pair type array (for local folding)
Definition: data_structures.h:645
double Gikjl_wo
Gikjl without contributions for prob_unpaired.
Definition: data_structures.h:254
int * iindx
DP matrix accessor.
Definition: data_structures.h:480
double ** E
exterior loop
Definition: data_structures.h:241
Partition function (PF) Dynamic Programming (DP) matrices data structure required within the vrna_fol...
Definition: dp_matrices.h:203
unsigned int maxD2
Maximum allowed base pair distance to second reference.
Definition: data_structures.h:623
vrna_mx_pf_t * exp_matrices
The PF DP matrices.
Definition: data_structures.h:475