RNAlib-2.2.7
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 
62 typedef void (vrna_callback_recursion_status)(unsigned char status, void *data);
63 
64 
72 #define VRNA_STATUS_MFE_PRE (unsigned char)1
73 
81 #define VRNA_STATUS_MFE_POST (unsigned char)2
82 
89 #define VRNA_STATUS_PF_PRE (unsigned char)3
90 
97 #define VRNA_STATUS_PF_POST (unsigned char)4
98 
99 
100 /* make this interface backward compatible with RNAlib < 2.2.0 */
101 #define VRNA_BACKWARD_COMPAT
102 
103 
104 #ifdef VRNA_BACKWARD_COMPAT
105 
106 /* the following typedefs are for backward compatibility only */
107 
112 typedef struct vrna_basepair_s PAIR;
113 
118 typedef struct vrna_plist_s plist;
119 
124 typedef struct vrna_cpair_s cpair;
125 
130 typedef struct vrna_sect_s sect;
131 
136 typedef struct vrna_bp_stack_s bondT;
137 
138 #endif
139 
140 #include <ViennaRNA/energy_const.h>
141 #include <ViennaRNA/model.h>
142 #include <ViennaRNA/params.h>
143 #include <ViennaRNA/dp_matrices.h>
144 #include <ViennaRNA/constraints.h>
145 
146 /*
147 * ############################################################
148 * Here are the type definitions of various datastructures
149 * shared among the Vienna RNA Package
150 * ############################################################
151 */
152 
157  int i;
158  int j;
159 };
160 
164 struct vrna_plist_s {
165  int i;
166  int j;
167  float p;
168  int type;
169 };
170 
174 struct vrna_cpair_s {
175  int i,j,mfe;
176  float p, hue, sat;
177 };
178 
179 
183 struct vrna_sect_s {
184  int i;
185  int j;
186  int ml;
187 };
188 
193  unsigned int i;
194  unsigned int j;
195 };
196 
197 
198 /*
199 * ############################################################
200 * RNAup data structures
201 * ############################################################
202 */
203 
207 typedef struct pu_contrib {
208  double **H;
209  double **I;
210  double **M;
211  double **E;
212  int length;
213  int w;
214 } pu_contrib;
215 
219 typedef struct interact {
220  double *Pi;
221  double *Gi;
222  double Gikjl;
224  double Gikjl_wo;
225  int i;
226  int k;
227  int j;
228  int l;
229  int length;
230 } interact;
231 
235 typedef struct pu_out {
236  int len;
237  int u_vals;
238  int contribs;
239  char **header;
240  double **u_values;
241 } pu_out;
242 
246 typedef struct constrain{
247  int *indx;
248  char *ptype;
249 } constrain;
250 
251 /*
252 * ############################################################
253 * RNAduplex data structures
254 * ############################################################
255 */
256 
260 typedef struct {
261  int i;
262  int j;
263  int end;
264  char *structure;
265  double energy;
266  double energy_backtrack;
267  double opening_backtrack_x;
268  double opening_backtrack_y;
269  int offset;
270  double dG1;
271  double dG2;
272  double ddG;
273  int tb;
274  int te;
275  int qb;
276  int qe;
277 } duplexT;
278 
279 /*
280 * ############################################################
281 * RNAsnoop data structures
282 * ############################################################
283 */
284 
288 typedef struct node {
289  int k;
290  int energy;
291  struct node *next;
292 } folden;
293 
297 typedef struct {
298  int i;
299  int j;
300  int u;
301  char *structure;
302  float energy;
303  float Duplex_El;
304  float Duplex_Er;
305  float Loop_E;
306  float Loop_D;
307  float pscd;
308  float psct;
309  float pscg;
310  float Duplex_Ol;
311  float Duplex_Or;
312  float Duplex_Ot;
313  float fullStemEnergy;
314 } snoopT;
315 
316 
317 /*
318 * ############################################################
319 * PKplex data structures
320 * ############################################################
321 */
322 
326 typedef struct dupVar{
327  int i;
328  int j;
329  int end;
330  char *pk_helix;
331  char *structure;
332  double energy;
333  int offset;
334  double dG1;
335  double dG2;
336  double ddG;
337  int tb;
338  int te;
339  int qb;
340  int qe;
341  int inactive;
342  int processed;
343 } dupVar;
344 
350 /*
351 * ############################################################
352 * VRNA fold compound related functions
353 * ############################################################
354 */
355 
372 typedef enum {
376 
377 
390 struct vrna_fc_s{
391 
403  unsigned int length;
404  int cutpoint;
416  int *iindx;
417  int *jindx;
430  void *auxdata;
442 #if ( __STDC_VERSION__ >= 201112L ) || ( __cplusplus >= 201103L )
443  /* C11 support for unnamed unions/structs */
444  union {
445  struct {
446 #endif
447 
452  char *sequence;
459  short *sequence_encoding2;
460  char *ptype;
482 #if ( __STDC_VERSION__ >= 201112L ) || ( __cplusplus >= 201103L )
483  /* C11 support for unnamed unions/structs */
484  };
485  struct {
486 #endif
487 
492  char **sequences;
496  unsigned int n_seq;
499  char *cons_seq;
502  short *S_cons;
505  short **S;
508  short **S5;
511  short **S3;
514  char **Ss;
515  unsigned short **a2s;
516  int *pscore;
526  int oldAliEn;
527 
531 #if ( __STDC_VERSION__ >= 201112L ) || ( __cplusplus >= 201103L )
532  };
533  };
534 #endif
535 
542  unsigned int maxD1;
543  unsigned int maxD2;
544  short *reference_pt1;
545  short *reference_pt2;
547  unsigned int *referenceBPs1;
548  unsigned int *referenceBPs2;
549  unsigned int *bpdist;
551  unsigned int *mm1;
552  unsigned int *mm2;
565  char **ptype_local;
570 };
571 
572 
573 /* the definitions below should be used for functions that return/receive/destroy fold compound data structures */
574 
575 #define VRNA_OPTION_DEFAULT 0U
576 
583 #define VRNA_OPTION_MFE 1U
584 
591 #define VRNA_OPTION_PF 2U
592 
593 #define VRNA_OPTION_HYBRID 4U
594 
604 #define VRNA_OPTION_EVAL_ONLY 8U
605 
606 #define VRNA_OPTION_WINDOW 16U
607 
648 vrna_fold_compound( const char *sequence,
649  vrna_md_t *md_p,
650  unsigned int options);
651 
690 vrna_fold_compound_comparative( const char **sequences,
691  vrna_md_t *md_p,
692  unsigned int options);
693 
695 vrna_fold_compound_TwoD(const char *sequence,
696  const char *s1,
697  const char *s2,
698  vrna_md_t *md_p,
699  unsigned int options);
700 
701 int
702 vrna_fold_compound_prepare( vrna_fold_compound_t *vc,
703  unsigned int options);
704 
712 void
714 
733  void *data,
735 
753 
758 #endif
short ** S3
Sl[s][i] holds next base 3' of i in sequence s.
Definition: data_structures.h:511
short ** S
Numerical encoding of the sequences in the alignment.
Definition: data_structures.h:505
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:228
double ** M
multi loops
Definition: data_structures.h:210
unsigned int * mm1
Maximum matching matrix, reference struct 1 disallowed.
Definition: data_structures.h:551
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:502
char * ptype
Pair type array.
Definition: data_structures.h:460
short * sequence_encoding
Numerical encoding of the input sequence.
Definition: data_structures.h:455
double ** H
hairpin loops
Definition: data_structures.h:208
vrna_exp_param_t * exp_params
The precomputed free energy contributions as Boltzmann factors.
Definition: data_structures.h:414
struct constrain constrain
constraints for cofolding
int u_vals
number of different -u values
Definition: data_structures.h:237
Definition: data_structures.h:326
unsigned int * bpdist
Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j].
Definition: data_structures.h:549
short * reference_pt1
A pairtable of the first reference structure.
Definition: data_structures.h:544
vrna_sc_t * sc
The soft constraints for usage in structure prediction and evaluation.
Definition: data_structures.h:474
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:390
char ** sequences
The aligned sequences.
Definition: data_structures.h:492
int j
j
Definition: data_structures.h:227
Definition: data_structures.h:288
contributions to p_u
Definition: data_structures.h:207
int contribs
[-c "SHIME"]
Definition: data_structures.h:238
The model details data structure and its corresponding modifiers.
void * auxdata
A pointer to auxiliary, user-defined data.
Definition: data_structures.h:430
The datastructure that contains temperature scaled energy parameters.
Definition: params.h:50
short * pscore_pf_compat
Precomputed array of pair types expressed as pairing scores indexed via iindx.
Definition: data_structures.h:519
int i
k
Definition: data_structures.h:225
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:297
double ** u_values
(the -u values * [-c "SHIME"]) * seq len
Definition: data_structures.h:240
char * cons_seq
The consensus sequence of the aligned sequences.
Definition: data_structures.h:499
vrna_hc_t * hc
The hard constraints data structure used for structure prediction.
Definition: data_structures.h:408
char * ptype_pf_compat
ptype array indexed via iindx
Definition: data_structures.h:469
Definition: data_structures.h:373
Stack of partial structures for backtracking.
Definition: data_structures.h:183
this datastructure is used as input parameter in functions of PS_dot.c
Definition: data_structures.h:174
int * jindx
DP matrix accessor.
Definition: data_structures.h:417
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:372
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:156
The data structure that contains the complete model details used throughout the calculations.
Definition: model.h:187
The soft constraints data structure.
Definition: constraints_soft.h:111
int w
longest unpaired region
Definition: data_structures.h:213
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:508
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:523
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:226
The hard constraints data structure.
Definition: constraints_hard.h:300
Definition: data_structures.h:219
double * Pi
probabilities of interaction
Definition: data_structures.h:220
constraints for cofolding
Definition: data_structures.h:246
double ** I
interior loops
Definition: data_structures.h:209
int len
sequence length
Definition: data_structures.h:236
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:62
int length
length of the input sequence
Definition: data_structures.h:212
char ** header
header line
Definition: data_structures.h:239
this datastructure is used as input parameter in functions of PS_dot.h and others ...
Definition: data_structures.h:164
vrna_param_t * params
The precomputed free energy contributions for each type of loop.
Definition: data_structures.h:413
int * pscore
Precomputed array of pair types expressed as pairing scores.
Definition: data_structures.h:516
unsigned int n_seq
The number of sequences in the alignment.
Definition: data_structures.h:496
unsigned int * referenceBPs2
Matrix containing number of basepairs of reference structure2 in interval [i,j].
Definition: data_structures.h:548
int length
length of longer sequence
Definition: data_structures.h:229
char * sequence
The input sequence string.
Definition: data_structures.h:452
vrna_mx_mfe_t * matrices
The MFE DP matrices.
Definition: data_structures.h:410
Definition: data_structures.h:374
vrna_callback_recursion_status * stat_cb
Recursion status callback (usually called just before, and after recursive computations in the librar...
Definition: data_structures.h:425
int cutpoint
The position of the (cofold) cutpoint within the provided sequence. If there is no cutpoint...
Definition: data_structures.h:404
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:434
Collection of all free_energy of beeing unpaired values for output.
Definition: data_structures.h:235
double Gikjl
full free energy for interaction between [k,i] k
Definition: data_structures.h:222
unsigned int length
The length of the sequence (or sequence alignment)
Definition: data_structures.h:403
Base pair stack element.
Definition: data_structures.h:192
Functions and data structures for constraining secondary structure predictions and evaluation...
double * Gi
free energies of interaction
Definition: data_structures.h:221
short * reference_pt2
A pairtable of the second reference structure.
Definition: data_structures.h:545
unsigned int maxD1
Maximum allowed base pair distance to first reference.
Definition: data_structures.h:542
unsigned int * mm2
Maximum matching matrix, reference struct 2 disallowed.
Definition: data_structures.h:552
Definition: data_structures.h:260
unsigned int * referenceBPs1
Matrix containing number of basepairs of reference structure1 in interval [i,j].
Definition: data_structures.h:547
vrna_fc_type_e type
The type of the vrna_fold_compound_t.
Definition: data_structures.h:396
int window_size
window size for local folding sliding window approach
Definition: data_structures.h:564
char ** ptype_local
Pair type array (for local folding)
Definition: data_structures.h:565
double Gikjl_wo
Gikjl without contributions for prob_unpaired.
Definition: data_structures.h:224
int * iindx
DP matrix accessor.
Definition: data_structures.h:416
double ** E
exterior loop
Definition: data_structures.h:211
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:543
vrna_mx_pf_t * exp_matrices
The PF DP matrices.
Definition: data_structures.h:411