RNAlib-2.2.9
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 
261 #define VRNA_CONSTRAINT_CONTEXT_ENFORCE (char)0x40
262 
266 #define VRNA_CONSTRAINT_CONTEXT_NO_REMOVE (char)0x80
267 
274 #define VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS (char)( VRNA_CONSTRAINT_CONTEXT_EXT_LOOP \
275  | VRNA_CONSTRAINT_CONTEXT_HP_LOOP \
276  | VRNA_CONSTRAINT_CONTEXT_INT_LOOP \
277  | VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC \
278  | VRNA_CONSTRAINT_CONTEXT_MB_LOOP \
279  | VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC)
280 
305 struct vrna_hc_s {
306  char *matrix;
309  int *up_ext;
312  int *up_hp;
315  int *up_int;
318  int *up_ml;
326  void *data;
341 };
342 
348 struct vrna_hc_up_s {
349  int position;
350  char options;
351 };
352 
375 void vrna_message_constraint_options(unsigned int option);
376 
388 
404 
420  int i,
421  char option);
422 
432 int
434  vrna_hc_up_t *constraints);
435 
453  int i,
454  int j,
455  char option);
456 
475  int i,
476  int d,
477  char option);
478 
490 void vrna_hc_free(vrna_hc_t *hc);
491 
492 #ifdef WITH_GEN_HC
493 
498 void vrna_hc_add_f( vrna_fold_compound_t *vc,
500 
512 void vrna_hc_add_data(vrna_fold_compound_t *vc,
513  void *data,
515 
516 #endif
517 
536 int
538  const char *constraint,
539  unsigned int options);
540 
541 
542 #ifdef VRNA_BACKWARD_COMPAT
543 
551 DEPRECATED(void print_tty_constraint(unsigned int option));
552 
559 DEPRECATED(void print_tty_constraint_full(void));
560 
573 DEPRECATED(void constrain_ptypes(const char *constraint, unsigned int length, char *ptype, int *BP, int min_loop_size, unsigned int idx_type));
574 
575 #endif
576 
577 #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:312
char options
The hard constraint option.
Definition: constraints_hard.h:350
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:424
char * matrix
Upper triangular matrix that encodes where a base pair or unpaired nucleotide is allowed.
Definition: constraints_hard.h:306
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:318
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:348
vrna_callback_hc_evaluate * f
A function pointer that returns whether or not a certain decomposition may be evaluated.
Definition: constraints_hard.h:322
void * data
A pointer to some structure where the user may store necessary data to evaluate its generic hard cons...
Definition: constraints_hard.h:326
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:305
int * up_ext
A linear array that holds the number of allowed unpaired nucleotides in an exterior loop...
Definition: constraints_hard.h:309
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:315
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:331
int position
The sequence position (1-based)
Definition: constraints_hard.h:349
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.