RNAlib-2.6.0b
 
Loading...
Searching...
No Matches
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 VRNA_WARN_DEPRECATED
5# if defined(__clang__)
6# define DEPRECATED(func, msg) func __attribute__ ((deprecated("", msg)))
7# elif defined(__GNUC__)
8# define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
9# else
10# define DEPRECATED(func, msg) func
11# endif
12#else
13# define DEPRECATED(func, msg) func
14#endif
15
16
34typedef struct vrna_hc_s vrna_hc_t;
35
41
42typedef struct vrna_hc_depot_s vrna_hc_depot_t;
43
46
78typedef unsigned char (*vrna_hc_eval_f)(int i,
79 int j,
80 int k,
81 int l,
82 unsigned char d,
83 void *data);
84
85DEPRECATED(typedef unsigned char (vrna_callback_hc_evaluate)(int i,
86 int j,
87 int k,
88 int l,
89 unsigned char d,
90 void *data),
91 "Use vrna_hc_eval_f instead!");
92
93
99#define VRNA_CONSTRAINT_NO_HEADER 0
100
109#define VRNA_CONSTRAINT_DB 16384U
110
122#define VRNA_CONSTRAINT_DB_ENFORCE_BP 32768U
123
135#define VRNA_CONSTRAINT_DB_PIPE 65536U
136
145#define VRNA_CONSTRAINT_DB_DOT 131072U
154#define VRNA_CONSTRAINT_DB_X 262144U
161#define VRNA_CONSTRAINT_DB_ANG_BRACK 524288U
170#define VRNA_CONSTRAINT_DB_RND_BRACK 1048576U
171
183#define VRNA_CONSTRAINT_DB_INTRAMOL 2097152U
184
196#define VRNA_CONSTRAINT_DB_INTERMOL 4194304U
197
208#define VRNA_CONSTRAINT_DB_GQUAD 8388608U
209
210#define VRNA_CONSTRAINT_DB_CANONICAL_BP 16777216U
211
220#define VRNA_CONSTRAINT_DB_WUSS 33554432U
221
222
234#define VRNA_CONSTRAINT_DB_DEFAULT \
235 (VRNA_CONSTRAINT_DB \
236 | VRNA_CONSTRAINT_DB_PIPE \
237 | VRNA_CONSTRAINT_DB_DOT \
238 | VRNA_CONSTRAINT_DB_X \
239 | VRNA_CONSTRAINT_DB_ANG_BRACK \
240 | VRNA_CONSTRAINT_DB_RND_BRACK \
241 | VRNA_CONSTRAINT_DB_INTRAMOL \
242 | VRNA_CONSTRAINT_DB_INTERMOL \
243 | VRNA_CONSTRAINT_DB_GQUAD \
244 )
245
252#define VRNA_CONSTRAINT_CONTEXT_EXT_LOOP (unsigned char)0x01
253
260#define VRNA_CONSTRAINT_CONTEXT_HP_LOOP (unsigned char)0x02
261
268#define VRNA_CONSTRAINT_CONTEXT_INT_LOOP (unsigned char)0x04
269
276#define VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC (unsigned char)0x08
277
284#define VRNA_CONSTRAINT_CONTEXT_MB_LOOP (unsigned char)0x10
285
292#define VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC (unsigned char)0x20
293
297#define VRNA_CONSTRAINT_CONTEXT_ENFORCE (unsigned char)0x40
298
302#define VRNA_CONSTRAINT_CONTEXT_NO_REMOVE (unsigned char)0x80
303
304
308#define VRNA_CONSTRAINT_CONTEXT_NONE (unsigned char)0
309
313#define VRNA_CONSTRAINT_CONTEXT_CLOSING_LOOPS (unsigned char)(VRNA_CONSTRAINT_CONTEXT_EXT_LOOP | \
314 VRNA_CONSTRAINT_CONTEXT_HP_LOOP | \
315 VRNA_CONSTRAINT_CONTEXT_INT_LOOP | \
316 VRNA_CONSTRAINT_CONTEXT_MB_LOOP)
317
321#define VRNA_CONSTRAINT_CONTEXT_ENCLOSED_LOOPS (unsigned char)(VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC | \
322 VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC)
323
330#define VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS (unsigned char)(VRNA_CONSTRAINT_CONTEXT_CLOSING_LOOPS | \
331 VRNA_CONSTRAINT_CONTEXT_ENCLOSED_LOOPS)
332
333
334#define VRNA_CONSTRAINT_WINDOW_UPDATE_5 1U
335
336#define VRNA_CONSTRAINT_WINDOW_UPDATE_3 2U
337
344typedef enum {
351
352
377struct vrna_hc_s {
378 vrna_hc_type_e type;
379 unsigned int n;
380
381 unsigned char state;
382
383#ifndef VRNA_DISABLE_C11_FEATURES
384 /* C11 support for unnamed unions/structs */
385 union {
386 struct {
387#endif
388 unsigned char *mx;
389#ifndef VRNA_DISABLE_C11_FEATURES
390};
391struct {
392#endif
393 unsigned char **matrix_local;
394#ifndef VRNA_DISABLE_C11_FEATURES
395};
396};
397#endif
398
399 int *up_ext;
402 int *up_hp;
405 int *up_int;
408 int *up_ml;
416 void *data;
432 vrna_hc_depot_t *depot;
433};
434
442 int strand;
443 unsigned char options;
444};
445
468void
470
471
482void
484
485
500void
502
503
504void
505vrna_hc_init_window(vrna_fold_compound_t *vc);
506
507
508int
509vrna_hc_prepare(vrna_fold_compound_t *fc,
510 unsigned int options);
511
512
513void
514vrna_hc_update(vrna_fold_compound_t *fc,
515 unsigned int i,
516 unsigned int options);
517
518
533void
535 int i,
536 unsigned char option);
537
538
539int
540vrna_hc_add_up_strand(vrna_fold_compound_t *fc,
541 unsigned int i,
542 unsigned int strand,
543 unsigned char option);
544
545
555int
557 vrna_hc_up_t *constraints);
558
559
560int
561vrna_hc_add_up_strand_batch(vrna_fold_compound_t *fc,
562 vrna_hc_up_t *constraints);
563
564
581int
583 int i,
584 int j,
585 unsigned char option);
586
587
588int
589vrna_hc_add_bp_strand(vrna_fold_compound_t *fc,
590 unsigned int i,
591 unsigned int strand_i,
592 unsigned int j,
593 unsigned int strand_j,
594 unsigned char option);
595
596
614void
616 int i,
617 int d,
618 unsigned char option);
619
620
632void
634
635
640void
643
644
656void
658 void *data,
660
661
680int
682 const char *constraint,
683 unsigned int options);
684
685
686#ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
687
695DEPRECATED(void
696 print_tty_constraint(unsigned int option),
697 "Use vrna_message_constraint_options() instead");
698
705DEPRECATED(void
707 "Use vrna_message_constraint_options_all() instead");
708
721DEPRECATED(void
722 constrain_ptypes(const char *constraint,
723 unsigned int length,
724 char *ptype,
725 int *BP,
726 int min_loop_size,
727 unsigned int idx_type),
728 "Use the new API and the hard constraint framework instead");
729
730#endif
731
732#endif
Functions and data structures for constraining secondary structure predictions and evaluation.
The Basic Fold Compound API.
void vrna_message_constraint_options(unsigned int option)
Print a help message for pseudo dot-bracket structure constraint characters to stdout....
void vrna_message_constraint_options_all(void)
Print structure constraint characters to stdout (full constraint support)
void(* vrna_auxdata_free_f)(void *data)
Callback to free memory allocated for auxiliary user-provided data.
Definition: fold_compound.h:58
The most basic data structure required by many functions throughout the RNAlib.
Definition: fold_compound.h:156
int * up_int
A linear array that holds the number of allowed unpaired nucleotides in an interior loop.
Definition: hard.h:405
unsigned char options
The hard constraint option
Definition: hard.h:443
int * up_ext
A linear array that holds the number of allowed unpaired nucleotides in an exterior loop.
Definition: hard.h:399
int position
The sequence position (1-based)
Definition: hard.h:441
int * up_hp
A linear array that holds the number of allowed unpaired nucleotides in a hairpin loop.
Definition: hard.h:402
int * up_ml
A linear array that holds the number of allowed unpaired nucleotides in a multi branched loop.
Definition: hard.h:408
vrna_auxdata_free_f free_data
A pointer to a function to free memory occupied by auxiliary data.
Definition: hard.h:421
vrna_hc_eval_f f
A function pointer that returns whether or not a certain decomposition may be evaluated.
Definition: hard.h:412
void * data
A pointer to some structure where the user may store necessary data to evaluate its generic hard cons...
Definition: hard.h:416
unsigned char(* vrna_hc_eval_f)(int i, int j, int k, int l, unsigned char d, void *data)
Callback to evaluate whether or not a particular decomposition step is contributing to the solution s...
Definition: hard.h:78
void vrna_hc_init(vrna_fold_compound_t *vc)
Initialize/Reset hard constraints to default values.
void vrna_hc_add_up(vrna_fold_compound_t *vc, int i, unsigned char option)
Make a certain nucleotide unpaired.
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 vrna_hc_add_from_db(vrna_fold_compound_t *vc, const char *constraint, unsigned int options)
Add hard constraints from pseudo dot-bracket notation.
void vrna_hc_free(vrna_hc_t *hc)
Free the memory allocated by a vrna_hc_t data structure.
int vrna_hc_add_bp(vrna_fold_compound_t *vc, int i, int j, unsigned char option)
Favorize/Enforce a certain base pair (i,j)
void vrna_hc_add_bp_nonspecific(vrna_fold_compound_t *vc, int i, int d, unsigned char option)
Enforce a nucleotide to be paired (upstream/downstream)
The hard constraints data structure.
Definition: hard.h:377
A single hard constraint for a single nucleotide.
Definition: hard.h:440
vrna_hc_type_e
The hard constraints type.
Definition: hard.h:344
@ VRNA_HC_DEFAULT
Default Hard Constraints.
Definition: hard.h:345
@ VRNA_HC_WINDOW
Hard Constraints suitable for local structure prediction using window approach.
Definition: hard.h:346
void vrna_hc_add_data(vrna_fold_compound_t *vc, void *data, vrna_auxdata_free_f f)
Add an auxiliary data structure for the generic hard constraints callback function.
void vrna_hc_add_f(vrna_fold_compound_t *vc, vrna_hc_eval_f f)
Add a function pointer pointer for the generic hard constraint feature.
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.
void print_tty_constraint(unsigned int option)
Print structure constraint characters to stdout. (constraint support is specified by option parameter...
void print_tty_constraint_full(void)
Print structure constraint characters to stdout (full constraint support)