RNAlib-2.4.0
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 
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 
71 typedef void (vrna_callback_free_auxdata)(void *data);
72 
94 typedef void (vrna_callback_recursion_status)(unsigned char status,
95  void *data);
96 
104 #define VRNA_STATUS_MFE_PRE (unsigned char)1
105 
113 #define VRNA_STATUS_MFE_POST (unsigned char)2
114 
121 #define VRNA_STATUS_PF_PRE (unsigned char)3
122 
129 #define VRNA_STATUS_PF_POST (unsigned char)4
130 
131 
132 /* make this interface backward compatible with RNAlib < 2.2.0 */
133 #define VRNA_BACKWARD_COMPAT
134 
135 
136 #ifdef VRNA_BACKWARD_COMPAT
137 
138 /* the following typedefs are for backward compatibility only */
139 
144 typedef struct vrna_basepair_s PAIR;
145 
150 typedef struct vrna_elem_prob_s plist;
155 typedef struct vrna_cpair_s cpair;
156 
161 typedef struct vrna_sect_s sect;
162 
167 typedef struct vrna_bp_stack_s bondT;
168 
169 #endif
170 
171 #include <ViennaRNA/energy_const.h>
172 #include <ViennaRNA/model.h>
173 #include <ViennaRNA/params.h>
174 #include <ViennaRNA/dp_matrices.h>
175 #include <ViennaRNA/constraints.h>
176 #include <ViennaRNA/grammar.h>
180 
181 /*
182  * ############################################################
183  * Here are the type definitions of various datastructures
184  * shared among the Vienna RNA Package
185  * ############################################################
186  */
187 
192  int i;
193  int j;
194 };
195 
199 struct vrna_cpair_s {
200  int i, j, mfe;
201  float p, hue, sat;
202 };
203 
204 struct vrna_color_s {
205  float hue;
206  float sat;
207  float bri;
208 };
209 
211  unsigned int position;
212  float value;
213  vrna_color_t color;
214 };
215 
216 
220 struct vrna_sect_s {
221  int i;
222  int j;
223  int ml;
224 };
225 
230  unsigned int i;
231  unsigned int j;
232 };
233 
234 
235 /*
236  * ############################################################
237  * RNAup data structures
238  * ############################################################
239  */
240 
244 typedef struct pu_contrib {
245  double **H;
246  double **I;
247  double **M;
248  double **E;
249  int length;
250  int w;
251 } pu_contrib;
252 
256 typedef struct interact {
257  double *Pi;
258  double *Gi;
259  double Gikjl;
261  double Gikjl_wo;
262  int i;
263  int k;
264  int j;
265  int l;
266  int length;
267 } interact;
268 
272 typedef struct pu_out {
273  int len;
274  int u_vals;
275  int contribs;
276  char **header;
277  double **u_values;
278 } pu_out;
279 
283 typedef struct constrain {
284  int *indx;
285  char *ptype;
286 } constrain;
287 
288 /*
289  * ############################################################
290  * RNAduplex data structures
291  * ############################################################
292  */
293 
297 typedef struct {
298  int i;
299  int j;
300  int end;
301  char *structure;
302  double energy;
303  double energy_backtrack;
304  double opening_backtrack_x;
305  double opening_backtrack_y;
306  int offset;
307  double dG1;
308  double dG2;
309  double ddG;
310  int tb;
311  int te;
312  int qb;
313  int qe;
314 } duplexT;
315 
316 /*
317  * ############################################################
318  * RNAsnoop data structures
319  * ############################################################
320  */
321 
325 typedef struct node {
326  int k;
327  int energy;
328  struct node *next;
329 } folden;
330 
334 typedef struct {
335  int i;
336  int j;
337  int u;
338  char *structure;
339  float energy;
340  float Duplex_El;
341  float Duplex_Er;
342  float Loop_E;
343  float Loop_D;
344  float pscd;
345  float psct;
346  float pscg;
347  float Duplex_Ol;
348  float Duplex_Or;
349  float Duplex_Ot;
350  float fullStemEnergy;
351 } snoopT;
352 
353 
354 /*
355  * ############################################################
356  * PKplex data structures
357  * ############################################################
358  */
359 
363 typedef struct dupVar {
364  int i;
365  int j;
366  int end;
367  char *pk_helix;
368  char *structure;
369  double energy;
370  int offset;
371  double dG1;
372  double dG2;
373  double ddG;
374  int tb;
375  int te;
376  int qb;
377  int qe;
378  int inactive;
379  int processed;
380 } dupVar;
381 
412 #ifndef VRNA_DISABLE_C11_FEATURES
413 void vrna_C11_features(void);
414 
415 
416 #endif
417 
423 /*
424  * ############################################################
425  * VRNA fold compound related functions
426  * ############################################################
427  */
428 
445 typedef enum {
449 
450 
463 struct vrna_fc_s {
475  unsigned int length;
476  int cutpoint;
480  unsigned int *strand_number;
490  int *iindx;
491  int *jindx;
504  void *auxdata;
519  /* data structure to adjust additional structural domains, such as G-quadruplexes */
522  /* data structure to adjust additional contributions to unpaired stretches, e.g. due to protein binding */
525  /* auxiliary (user-defined) extension to the folding grammar */
526  vrna_gr_aux_t *aux_grammar;
527 
532 #ifndef VRNA_DISABLE_C11_FEATURES
533  /* C11 support for unnamed unions/structs */
534  union {
535  struct {
536 #endif
537 
542  char *sequence;
549  short *sequence_encoding2;
550  char *ptype;
572 #ifndef VRNA_DISABLE_C11_FEATURES
573  /* C11 support for unnamed unions/structs */
574 };
575 struct {
576 #endif
577 
582  char **sequences;
586  unsigned int n_seq;
589  char *cons_seq;
592  short *S_cons;
595  short **S;
598  short **S5;
601  short **S3;
604  char **Ss;
605  unsigned int **a2s;
606  int *pscore;
609  int **pscore_local;
619  int oldAliEn;
620 
624 #ifndef VRNA_DISABLE_C11_FEATURES
625 };
626 };
627 #endif
628 
635  unsigned int maxD1;
636  unsigned int maxD2;
637  short *reference_pt1;
638  short *reference_pt2;
640  unsigned int *referenceBPs1;
641  unsigned int *referenceBPs2;
642  unsigned int *bpdist;
644  unsigned int *mm1;
645  unsigned int *mm2;
658  char **ptype_local;
662 };
663 
664 
665 /* the definitions below should be used for functions that return/receive/destroy fold compound data structures */
666 
670 #define VRNA_OPTION_DEFAULT 0U
671 
678 #define VRNA_OPTION_MFE 1U
679 
686 #define VRNA_OPTION_PF 2U
687 
691 #define VRNA_OPTION_HYBRID 4U
692 
702 #define VRNA_OPTION_EVAL_ONLY 8U
703 
707 #define VRNA_OPTION_WINDOW 16U
708 
749 vrna_fold_compound(const char *sequence,
750  vrna_md_t *md_p,
751  unsigned int options);
752 
753 
792 vrna_fold_compound_comparative(const char **sequences,
793  vrna_md_t *md_p,
794  unsigned int options);
795 
796 
798 vrna_fold_compound_TwoD(const char *sequence,
799  const char *s1,
800  const char *s2,
801  vrna_md_t *md_p,
802  unsigned int options);
803 
804 
805 int
806 vrna_fold_compound_prepare(vrna_fold_compound_t *vc,
807  unsigned int options);
808 
809 
817 void
819 
820 
839  void *data,
841 
842 
860 
861 
866 #endif
short ** S3
Sl[s][i] holds next base 3&#39; of i in sequence s.
Definition: data_structures.h:601
short ** S
Numerical encoding of the sequences in the alignment.
Definition: data_structures.h:595
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:265
double ** M
multi loops
Definition: data_structures.h:247
unsigned int * mm1
Maximum matching matrix, reference struct 1 disallowed.
Definition: data_structures.h:644
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:592
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:550
Functions to deal with standard dynamic programming (DP) matrices.
short * sequence_encoding
Numerical encoding of the input sequence.
Definition: data_structures.h:545
double ** H
hairpin loops
Definition: data_structures.h:245
vrna_exp_param_t * exp_params
The precomputed free energy contributions as Boltzmann factors.
Definition: data_structures.h:488
struct dupVar dupVar
Data structure used in RNApkplex.
Data structure representing a single entry of an element probability list (e.g. list of pair probabil...
Definition: structure_utils.h:69
struct constrain constrain
constraints for cofolding
Data structure to store all functionality for ligand binding.
Definition: unstructured_domains.h:197
int u_vals
number of different -u values
Definition: data_structures.h:274
Data structure used in RNApkplex.
Definition: data_structures.h:363
unsigned int * bpdist
Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j].
Definition: data_structures.h:642
short * reference_pt1
A pairtable of the first reference structure.
Definition: data_structures.h:637
vrna_sc_t * sc
The soft constraints for usage in structure prediction and evaluation.
Definition: data_structures.h:564
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:463
char ** sequences
The aligned sequences.
Definition: data_structures.h:582
int j
j<l in shorter seq
Definition: data_structures.h:264
Data structure for RNAsnoop (fold energy list)
Definition: data_structures.h:325
contributions to p_u
Definition: data_structures.h:244
int contribs
[-c "SHIME"]
Definition: data_structures.h:275
The model details data structure and its corresponding modifiers.
void * auxdata
A pointer to auxiliary, user-defined data.
Definition: data_structures.h:504
The datastructure that contains temperature scaled energy parameters.
Definition: params.h:57
short * pscore_pf_compat
Precomputed array of pair types expressed as pairing scores indexed via iindx.
Definition: data_structures.h:612
vrna_sd_t * domains_struc
Additional structured domains.
Definition: data_structures.h:520
int i
k<i in longer seq
Definition: data_structures.h:262
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:523
Data structure for RNAsnoop.
Definition: data_structures.h:334
double ** u_values
(the -u values * [-c "SHIME"]) * seq len
Definition: data_structures.h:277
char * cons_seq
The consensus sequence of the aligned sequences.
Definition: data_structures.h:589
Definition: grammar.h:18
vrna_hc_t * hc
The hard constraints data structure used for structure prediction.
Definition: data_structures.h:482
char * ptype_pf_compat
ptype array indexed via iindx
Definition: data_structures.h:559
Stack of partial structures for backtracking.
Definition: data_structures.h:220
this datastructure is used as input parameter in functions of PS_dot.c
Definition: data_structures.h:199
int * jindx
DP matrix accessor.
Definition: data_structures.h:491
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:445
Energy parameter constants.
Various utility- and helper-functions for secondary structure parsing, converting, etc.
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:191
The soft constraints data structure.
Definition: constraints_soft.h:154
int w
longest unpaired region
Definition: data_structures.h:250
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:598
Definition: data_structures.h:210
Functions to deal with sets of energy parameters.
The data structure that contains temperature scaled Boltzmann weights of the energy parameters...
Definition: params.h:101
The data structure that contains the complete model details used throughout the calculations.
Definition: model.h:189
vrna_sc_t ** scs
A set of soft constraints (for each sequence in the alignment)
Definition: data_structures.h:616
void( vrna_callback_free_auxdata)(void *data)
Callback to free memory allocated for auxiliary user-provided data.
Definition: data_structures.h:71
int k
k<i in longer seq
Definition: data_structures.h:263
The hard constraints data structure.
Definition: constraints_hard.h:341
Definition: data_structures.h:447
Functions to modify unstructured domains, e.g. to incorporate ligands binding to unpaired stretches...
interaction data structure for RNAup
Definition: data_structures.h:256
double * Pi
probabilities of interaction
Definition: data_structures.h:257
int oldAliEn
use old alifold energies (with gaps)
constraints for cofolding
Definition: data_structures.h:283
double ** I
interior loops
Definition: data_structures.h:246
struct node folden
Data structure for RNAsnoop (fold energy list)
int len
sequence length
Definition: data_structures.h:273
unsigned int * strand_number
The strand number a particular nucleotide is associated with.
Definition: data_structures.h:480
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:94
int length
length of the input sequence
Definition: data_structures.h:249
char ** header
header line
Definition: data_structures.h:276
vrna_param_t * params
The precomputed free energy contributions for each type of loop.
Definition: data_structures.h:487
int * pscore
Precomputed array of pair types expressed as pairing scores.
Definition: data_structures.h:606
unsigned int n_seq
The number of sequences in the alignment.
Definition: data_structures.h:586
unsigned int * referenceBPs2
Matrix containing number of basepairs of reference structure2 in interval [i,j].
Definition: data_structures.h:641
int length
length of longer sequence
Definition: data_structures.h:266
char * sequence
The input sequence string.
Definition: data_structures.h:542
vrna_mx_mfe_t * matrices
The MFE DP matrices.
Definition: data_structures.h:484
Definition: data_structures.h:446
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:499
int cutpoint
The position of the (cofold) cutpoint within the provided sequence. If there is no cutpoint...
Definition: data_structures.h:476
int ** pscore_local
Precomputed array of pair types expressed as pairing scores.
Definition: data_structures.h:609
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:508
Collection of all free_energy of beeing unpaired values for output.
Definition: data_structures.h:272
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:259
unsigned int length
The length of the sequence (or sequence alignment)
Definition: data_structures.h:475
Base pair stack element.
Definition: data_structures.h:229
Functions and data structures for constraining secondary structure predictions and evaluation...
double * Gi
free energies of interaction
Definition: data_structures.h:258
Definition: data_structures.h:204
short * reference_pt2
A pairtable of the second reference structure.
Definition: data_structures.h:638
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:635
unsigned int * mm2
Maximum matching matrix, reference struct 2 disallowed.
Definition: data_structures.h:645
Data structure for RNAduplex.
Definition: data_structures.h:297
unsigned int * referenceBPs1
Matrix containing number of basepairs of reference structure1 in interval [i,j].
Definition: data_structures.h:640
Implementations for the RNA folding grammar.
vrna_fc_type_e type
The type of the vrna_fold_compound_t.
Definition: data_structures.h:468
int window_size
window size for local folding sliding window approach
Definition: data_structures.h:657
char ** ptype_local
Pair type array (for local folding)
Definition: data_structures.h:658
double Gikjl_wo
Gikjl without contributions for prob_unpaired.
Definition: data_structures.h:261
int * iindx
DP matrix accessor.
Definition: data_structures.h:490
double ** E
exterior loop
Definition: data_structures.h:248
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:636
vrna_mx_pf_t * exp_matrices
The PF DP matrices.
Definition: data_structures.h:485