RNAlib-2.3.4
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,
72  void *data);
73 
81 #define VRNA_STATUS_MFE_PRE (unsigned char)1
82 
90 #define VRNA_STATUS_MFE_POST (unsigned char)2
91 
98 #define VRNA_STATUS_PF_PRE (unsigned char)3
99 
106 #define VRNA_STATUS_PF_POST (unsigned char)4
107 
108 
109 #define VRNA_PLIST_TYPE_BASEPAIR 0
110 #define VRNA_PLIST_TYPE_GQUAD 1
111 #define VRNA_PLIST_TYPE_H_MOTIF 2
112 #define VRNA_PLIST_TYPE_I_MOTIF 3
113 #define VRNA_PLIST_TYPE_UD_MOTIF 4
114 
115 
116 /* make this interface backward compatible with RNAlib < 2.2.0 */
117 #define VRNA_BACKWARD_COMPAT
118 
119 
120 #ifdef VRNA_BACKWARD_COMPAT
121 
122 /* the following typedefs are for backward compatibility only */
123 
128 typedef struct vrna_basepair_s PAIR;
129 
134 typedef struct vrna_plist_s plist;
135 
140 typedef struct vrna_cpair_s cpair;
141 
146 typedef struct vrna_sect_s sect;
147 
152 typedef struct vrna_bp_stack_s bondT;
153 
154 #endif
155 
156 #include <ViennaRNA/energy_const.h>
157 #include <ViennaRNA/model.h>
158 #include <ViennaRNA/params.h>
159 #include <ViennaRNA/dp_matrices.h>
160 #include <ViennaRNA/constraints.h>
161 #include <ViennaRNA/grammar.h>
164 
165 /*
166  * ############################################################
167  * Here are the type definitions of various datastructures
168  * shared among the Vienna RNA Package
169  * ############################################################
170  */
171 
176  int i;
177  int j;
178 };
179 
183 struct vrna_plist_s {
184  int i;
185  int j;
186  float p;
187  int type;
188 };
189 
193 struct vrna_cpair_s {
194  int i, j, mfe;
195  float p, hue, sat;
196 };
197 
198 struct vrna_color_s {
199  float hue;
200  float sat;
201  float bri;
202 };
203 
205  unsigned int position;
206  float value;
207  vrna_color_t color;
208 };
209 
210 
214 struct vrna_sect_s {
215  int i;
216  int j;
217  int ml;
218 };
219 
224  unsigned int i;
225  unsigned int j;
226 };
227 
228 
229 /*
230  * ############################################################
231  * RNAup data structures
232  * ############################################################
233  */
234 
238 typedef struct pu_contrib {
239  double **H;
240  double **I;
241  double **M;
242  double **E;
243  int length;
244  int w;
245 } pu_contrib;
246 
250 typedef struct interact {
251  double *Pi;
252  double *Gi;
253  double Gikjl;
255  double Gikjl_wo;
256  int i;
257  int k;
258  int j;
259  int l;
260  int length;
261 } interact;
262 
266 typedef struct pu_out {
267  int len;
268  int u_vals;
269  int contribs;
270  char **header;
271  double **u_values;
272 } pu_out;
273 
277 typedef struct constrain {
278  int *indx;
279  char *ptype;
280 } constrain;
281 
282 /*
283  * ############################################################
284  * RNAduplex data structures
285  * ############################################################
286  */
287 
291 typedef struct {
292  int i;
293  int j;
294  int end;
295  char *structure;
296  double energy;
297  double energy_backtrack;
298  double opening_backtrack_x;
299  double opening_backtrack_y;
300  int offset;
301  double dG1;
302  double dG2;
303  double ddG;
304  int tb;
305  int te;
306  int qb;
307  int qe;
308 } duplexT;
309 
310 /*
311  * ############################################################
312  * RNAsnoop data structures
313  * ############################################################
314  */
315 
319 typedef struct node {
320  int k;
321  int energy;
322  struct node *next;
323 } folden;
324 
328 typedef struct {
329  int i;
330  int j;
331  int u;
332  char *structure;
333  float energy;
334  float Duplex_El;
335  float Duplex_Er;
336  float Loop_E;
337  float Loop_D;
338  float pscd;
339  float psct;
340  float pscg;
341  float Duplex_Ol;
342  float Duplex_Or;
343  float Duplex_Ot;
344  float fullStemEnergy;
345 } snoopT;
346 
347 
348 /*
349  * ############################################################
350  * PKplex data structures
351  * ############################################################
352  */
353 
357 typedef struct dupVar {
358  int i;
359  int j;
360  int end;
361  char *pk_helix;
362  char *structure;
363  double energy;
364  int offset;
365  double dG1;
366  double dG2;
367  double ddG;
368  int tb;
369  int te;
370  int qb;
371  int qe;
372  int inactive;
373  int processed;
374 } dupVar;
375 
406 #ifndef VRNA_DISABLE_C11_FEATURES
407 void vrna_C11_features(void);
408 
409 
410 #endif
411 
417 /*
418  * ############################################################
419  * VRNA fold compound related functions
420  * ############################################################
421  */
422 
439 typedef enum {
443 
444 
457 struct vrna_fc_s {
469  unsigned int length;
470  int cutpoint;
474  unsigned int *strand_number;
484  int *iindx;
485  int *jindx;
498  void *auxdata;
513  /* data structure to adjust additional structural domains, such as G-quadruplexes */
516  /* data structure to adjust additional contributions to unpaired stretches, e.g. due to protein binding */
519  /* auxiliary (user-defined) extension to the folding grammar */
520  vrna_gr_aux_t *aux_grammar;
521 
526 #ifndef VRNA_DISABLE_C11_FEATURES
527  /* C11 support for unnamed unions/structs */
528  union {
529  struct {
530 #endif
531 
536  char *sequence;
543  short *sequence_encoding2;
544  char *ptype;
566 #ifndef VRNA_DISABLE_C11_FEATURES
567  /* C11 support for unnamed unions/structs */
568 };
569 struct {
570 #endif
571 
576  char **sequences;
580  unsigned int n_seq;
583  char *cons_seq;
586  short *S_cons;
589  short **S;
592  short **S5;
595  short **S3;
598  char **Ss;
599  unsigned short **a2s;
600  int *pscore;
603  int **pscore_local;
613  int oldAliEn;
614 
618 #ifndef VRNA_DISABLE_C11_FEATURES
619 };
620 };
621 #endif
622 
629  unsigned int maxD1;
630  unsigned int maxD2;
631  short *reference_pt1;
632  short *reference_pt2;
634  unsigned int *referenceBPs1;
635  unsigned int *referenceBPs2;
636  unsigned int *bpdist;
638  unsigned int *mm1;
639  unsigned int *mm2;
652  char **ptype_local;
656 };
657 
658 
659 /* the definitions below should be used for functions that return/receive/destroy fold compound data structures */
660 
664 #define VRNA_OPTION_DEFAULT 0U
665 
672 #define VRNA_OPTION_MFE 1U
673 
680 #define VRNA_OPTION_PF 2U
681 
685 #define VRNA_OPTION_HYBRID 4U
686 
696 #define VRNA_OPTION_EVAL_ONLY 8U
697 
701 #define VRNA_OPTION_WINDOW 16U
702 
743 vrna_fold_compound(const char *sequence,
744  vrna_md_t *md_p,
745  unsigned int options);
746 
747 
786 vrna_fold_compound_comparative(const char **sequences,
787  vrna_md_t *md_p,
788  unsigned int options);
789 
790 
792 vrna_fold_compound_TwoD(const char *sequence,
793  const char *s1,
794  const char *s2,
795  vrna_md_t *md_p,
796  unsigned int options);
797 
798 
799 int
800 vrna_fold_compound_prepare(vrna_fold_compound_t *vc,
801  unsigned int options);
802 
803 
811 void
813 
814 
833  void *data,
835 
836 
854 
855 
860 #endif
short ** S3
Sl[s][i] holds next base 3&#39; of i in sequence s.
Definition: data_structures.h:595
short ** S
Numerical encoding of the sequences in the alignment.
Definition: data_structures.h:589
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:259
double ** M
multi loops
Definition: data_structures.h:241
unsigned int * mm1
Maximum matching matrix, reference struct 1 disallowed.
Definition: data_structures.h:638
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:586
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:544
Functions to deal with standard dynamic programming (DP) matrices.
short * sequence_encoding
Numerical encoding of the input sequence.
Definition: data_structures.h:539
double ** H
hairpin loops
Definition: data_structures.h:239
vrna_exp_param_t * exp_params
The precomputed free energy contributions as Boltzmann factors.
Definition: data_structures.h:482
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:268
Data structure used in RNApkplex.
Definition: data_structures.h:357
unsigned int * bpdist
Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j].
Definition: data_structures.h:636
short * reference_pt1
A pairtable of the first reference structure.
Definition: data_structures.h:631
vrna_sc_t * sc
The soft constraints for usage in structure prediction and evaluation.
Definition: data_structures.h:558
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:457
char ** sequences
The aligned sequences.
Definition: data_structures.h:576
int j
j<l in shorter seq
Definition: data_structures.h:258
Data structure for RNAsnoop (fold energy list)
Definition: data_structures.h:319
contributions to p_u
Definition: data_structures.h:238
int contribs
[-c "SHIME"]
Definition: data_structures.h:269
The model details data structure and its corresponding modifiers.
void * auxdata
A pointer to auxiliary, user-defined data.
Definition: data_structures.h:498
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:606
vrna_sd_t * domains_struc
Additional structured domains.
Definition: data_structures.h:514
int i
k<i in longer seq
Definition: data_structures.h:256
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:517
Data structure for RNAsnoop.
Definition: data_structures.h:328
double ** u_values
(the -u values * [-c "SHIME"]) * seq len
Definition: data_structures.h:271
char * cons_seq
The consensus sequence of the aligned sequences.
Definition: data_structures.h:583
Definition: grammar.h:18
vrna_hc_t * hc
The hard constraints data structure used for structure prediction.
Definition: data_structures.h:476
char * ptype_pf_compat
ptype array indexed via iindx
Definition: data_structures.h:553
Stack of partial structures for backtracking.
Definition: data_structures.h:214
this datastructure is used as input parameter in functions of PS_dot.c
Definition: data_structures.h:193
int * jindx
DP matrix accessor.
Definition: data_structures.h:485
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:439
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:175
The soft constraints data structure.
Definition: constraints_soft.h:101
int w
longest unpaired region
Definition: data_structures.h:244
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:592
Definition: data_structures.h:204
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:610
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:257
The hard constraints data structure.
Definition: constraints_hard.h:305
Definition: data_structures.h:441
Functions to modify unstructured domains, e.g. to incorporate ligands binding to unpaired stretches...
interaction data structure for RNAup
Definition: data_structures.h:250
double * Pi
probabilities of interaction
Definition: data_structures.h:251
int oldAliEn
use old alifold energies (with gaps)
constraints for cofolding
Definition: data_structures.h:277
double ** I
interior loops
Definition: data_structures.h:240
struct node folden
Data structure for RNAsnoop (fold energy list)
int len
sequence length
Definition: data_structures.h:267
unsigned int * strand_number
The strand number a particular nucleotide is associated with.
Definition: data_structures.h:474
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:243
char ** header
header line
Definition: data_structures.h:270
this datastructure is used as input parameter in functions of PS_dot.h and others ...
Definition: data_structures.h:183
vrna_param_t * params
The precomputed free energy contributions for each type of loop.
Definition: data_structures.h:481
int * pscore
Precomputed array of pair types expressed as pairing scores.
Definition: data_structures.h:600
unsigned int n_seq
The number of sequences in the alignment.
Definition: data_structures.h:580
unsigned int * referenceBPs2
Matrix containing number of basepairs of reference structure2 in interval [i,j].
Definition: data_structures.h:635
int length
length of longer sequence
Definition: data_structures.h:260
char * sequence
The input sequence string.
Definition: data_structures.h:536
vrna_mx_mfe_t * matrices
The MFE DP matrices.
Definition: data_structures.h:478
Definition: data_structures.h:440
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:493
int cutpoint
The position of the (cofold) cutpoint within the provided sequence. If there is no cutpoint...
Definition: data_structures.h:470
int ** pscore_local
Precomputed array of pair types expressed as pairing scores.
Definition: data_structures.h:603
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:502
Collection of all free_energy of beeing unpaired values for output.
Definition: data_structures.h:266
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:253
unsigned int length
The length of the sequence (or sequence alignment)
Definition: data_structures.h:469
Base pair stack element.
Definition: data_structures.h:223
Functions and data structures for constraining secondary structure predictions and evaluation...
double * Gi
free energies of interaction
Definition: data_structures.h:252
Definition: data_structures.h:198
short * reference_pt2
A pairtable of the second reference structure.
Definition: data_structures.h:632
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:629
unsigned int * mm2
Maximum matching matrix, reference struct 2 disallowed.
Definition: data_structures.h:639
Data structure for RNAduplex.
Definition: data_structures.h:291
unsigned int * referenceBPs1
Matrix containing number of basepairs of reference structure1 in interval [i,j].
Definition: data_structures.h:634
Implementations for the RNA folding grammar.
vrna_fc_type_e type
The type of the vrna_fold_compound_t.
Definition: data_structures.h:462
int window_size
window size for local folding sliding window approach
Definition: data_structures.h:651
char ** ptype_local
Pair type array (for local folding)
Definition: data_structures.h:652
double Gikjl_wo
Gikjl without contributions for prob_unpaired.
Definition: data_structures.h:255
int * iindx
DP matrix accessor.
Definition: data_structures.h:484
double ** E
exterior loop
Definition: data_structures.h:242
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:630
vrna_mx_pf_t * exp_matrices
The PF DP matrices.
Definition: data_structures.h:479