RNAlib-2.2.7
constraints_hard.h
Go to the documentation of this file.
1 #ifndef VIENNA_RNA_PACKAGE_CONSTRAINTS_HARD_H
2 #define VIENNA_RNA_PACKAGE_CONSTRAINTS_HARD_H
3 
4 #ifdef DEPRECATION_WARNINGS
5 # ifdef __GNUC__
6 # define DEPRECATED(func) func __attribute__ ((deprecated))
7 # else
8 # define DEPRECATED(func) func
9 # endif
10 #else
11 # define DEPRECATED(func) func
12 #endif
13 
14 
15 /* make this interface backward compatible with RNAlib < 2.2.0 */
16 #define VRNA_BACKWARD_COMPAT
17 
24 
36 typedef struct vrna_hc_s vrna_hc_t;
37 
42 typedef struct vrna_hc_up_s vrna_hc_up_t;
43 
69 typedef char (vrna_callback_hc_evaluate)(int i, int j, int k, int l, char d, void *data);
70 
76 #define VRNA_CONSTRAINT_NO_HEADER 0
77 
86 #define VRNA_CONSTRAINT_DB 16384U
87 
99 #define VRNA_CONSTRAINT_DB_ENFORCE_BP 32768U
100 
112 #define VRNA_CONSTRAINT_DB_PIPE 65536U
113 
122 #define VRNA_CONSTRAINT_DB_DOT 131072U
123 
131 #define VRNA_CONSTRAINT_DB_X 262144U
132 
138 #define VRNA_CONSTRAINT_DB_ANG_BRACK 524288U
139 
147 #define VRNA_CONSTRAINT_DB_RND_BRACK 1048576U
148 
160 #define VRNA_CONSTRAINT_DB_INTRAMOL 2097152U
161 
173 #define VRNA_CONSTRAINT_DB_INTERMOL 4194304U
174 
185 #define VRNA_CONSTRAINT_DB_GQUAD 8388608U
186 
198 #define VRNA_CONSTRAINT_DB_DEFAULT \
199  ( VRNA_CONSTRAINT_DB \
200  | VRNA_CONSTRAINT_DB_PIPE \
201  | VRNA_CONSTRAINT_DB_DOT \
202  | VRNA_CONSTRAINT_DB_X \
203  | VRNA_CONSTRAINT_DB_ANG_BRACK \
204  | VRNA_CONSTRAINT_DB_RND_BRACK \
205  | VRNA_CONSTRAINT_DB_INTRAMOL \
206  | VRNA_CONSTRAINT_DB_INTERMOL \
207  | VRNA_CONSTRAINT_DB_GQUAD \
208  )
209 
216 #define VRNA_CONSTRAINT_CONTEXT_EXT_LOOP (char)0x01
217 
224 #define VRNA_CONSTRAINT_CONTEXT_HP_LOOP (char)0x02
225 
232 #define VRNA_CONSTRAINT_CONTEXT_INT_LOOP (char)0x04
233 
240 #define VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC (char)0x08
241 
248 #define VRNA_CONSTRAINT_CONTEXT_MB_LOOP (char)0x10
249 
256 #define VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC (char)0x20
257 
258 #define VRNA_CONSTRAINT_CONTEXT_ENFORCE (char)0x40
259 
260 #define VRNA_CONSTRAINT_CONTEXT_NO_REMOVE (char)0x80
261 
268 #define VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS (char)( VRNA_CONSTRAINT_CONTEXT_EXT_LOOP \
269  | VRNA_CONSTRAINT_CONTEXT_HP_LOOP \
270  | VRNA_CONSTRAINT_CONTEXT_INT_LOOP \
271  | VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC \
272  | VRNA_CONSTRAINT_CONTEXT_MB_LOOP \
273  | VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC)
274 
300 struct vrna_hc_s {
301  char *matrix;
304  int *up_ext;
307  int *up_hp;
310  int *up_int;
313  int *up_ml;
321  void *data;
336 };
337 
343 struct vrna_hc_up_s {
344  int position;
345  char options;
346 };
347 
370 void vrna_message_constraint_options(unsigned int option);
371 
383 
399 
415  int i,
416  char option);
417 
427 int
429  vrna_hc_up_t *constraints);
430 
448  int i,
449  int j,
450  char option);
451 
470  int i,
471  int d,
472  char option);
473 
485 void vrna_hc_free(vrna_hc_t *hc);
486 
487 #ifdef WITH_GEN_HC
488 
493 void vrna_hc_add_f( vrna_fold_compound_t *vc,
495 
507 void vrna_hc_add_data(vrna_fold_compound_t *vc,
508  void *data,
510 
511 #endif
512 
531 int
533  const char *constraint,
534  unsigned int options);
535 
536 
537 #ifdef VRNA_BACKWARD_COMPAT
538 
546 DEPRECATED(void print_tty_constraint(unsigned int option));
547 
554 DEPRECATED(void print_tty_constraint_full(void));
555 
568 DEPRECATED(void constrain_ptypes(const char *constraint, unsigned int length, char *ptype, int *BP, int min_loop_size, unsigned int idx_type));
569 
570 #endif
571 
572 #endif
void vrna_hc_add_up(vrna_fold_compound_t *vc, int i, char option)
Make a certain nucleotide unpaired.
void constrain_ptypes(const char *constraint, unsigned int length, char *ptype, int *BP, int min_loop_size, unsigned int idx_type)
Insert constraining pair types according to constraint structure string.
int * up_hp
A linear array that holds the number of allowed unpaired nucleotides in a hairpin loop...
Definition: constraints_hard.h:307
char options
The hard constraint option.
Definition: constraints_hard.h:345
int vrna_hc_add_from_db(vrna_fold_compound_t *vc, const char *constraint, unsigned int options)
Add hard constraints from pseudo dot-bracket notation.
The most basic data structure required by many functions throughout the RNAlib.
Definition: data_structures.h:390
char * matrix
Upper triangular matrix that encodes where a base pair or unpaired nucleotide is allowed.
Definition: constraints_hard.h:301
void print_tty_constraint_full(void)
Print structure constraint characters to stdout (full constraint support)
int * up_ml
A linear array that holds the number of allowed unpaired nucleotides in a multi branched loop...
Definition: constraints_hard.h:313
void vrna_hc_add_bp(vrna_fold_compound_t *vc, int i, int j, char option)
Favorize/Enforce a certain base pair (i,j)
char( vrna_callback_hc_evaluate)(int i, int j, int k, int l, char d, void *data)
Callback to evaluate whether or not a particular decomposition step is contributing to the solution s...
Definition: constraints_hard.h:69
void vrna_message_constraint_options_all(void)
Print structure constraint characters to stdout (full constraint support)
A single hard constraint for a single nucleotide.
Definition: constraints_hard.h:343
vrna_callback_hc_evaluate * f
A function pointer that returns whether or not a certain decomposition may be evaluated.
Definition: constraints_hard.h:317
void * data
A pointer to some structure where the user may store necessary data to evaluate its generic hard cons...
Definition: constraints_hard.h:321
void( vrna_callback_free_auxdata)(void *data)
Callback to free memory allocated for auxiliary user-provided data.
Definition: data_structures.h:51
The hard constraints data structure.
Definition: constraints_hard.h:300
int * up_ext
A linear array that holds the number of allowed unpaired nucleotides in an exterior loop...
Definition: constraints_hard.h:304
int vrna_hc_add_up_batch(vrna_fold_compound_t *vc, vrna_hc_up_t *constraints)
Apply a list of hard constraints for single nucleotides.
int * up_int
A linear array that holds the number of allowed unpaired nucleotides in an interior loop...
Definition: constraints_hard.h:310
void vrna_hc_add_bp_nonspecific(vrna_fold_compound_t *vc, int i, int d, char option)
Enforce a nucleotide to be paired (upstream/downstream)
void print_tty_constraint(unsigned int option)
Print structure constraint characters to stdout. (constraint support is specified by option parameter...
void vrna_message_constraint_options(unsigned int option)
Print a help message for pseudo dot-bracket structure constraint characters to stdout. (constraint support is specified by option parameter)
vrna_callback_free_auxdata * free_data
A pointer to a function to free memory occupied by auxiliary data.
Definition: constraints_hard.h:326
int position
The sequence position (1-based)
Definition: constraints_hard.h:344
void vrna_hc_init(vrna_fold_compound_t *vc)
Initialize/Reset hard constraints to default values.
void vrna_hc_free(vrna_hc_t *hc)
Free the memory allocated by a vrna_hc_t data structure.