RNAlib-2.2.0-RC3
constraints.h
1 #ifndef VIENNA_RNA_PACKAGE_CONSTRAINTS_H
2 #define VIENNA_RNA_PACKAGE_CONSTRAINTS_H
3 
4 #ifdef __GNUC__
5 #define DEPRECATED(func) func __attribute__ ((deprecated))
6 #else
7 #define DEPRECATED(func) func
8 #endif
9 
10 
11 /* make this interface backward compatible with RNAlib < 2.2.0 */
12 #define VRNA_BACKWARD_COMPAT
13 
37 
49 #define VRNA_CONSTRAINT_DB_PIPE 1U
50 
59 #define VRNA_CONSTRAINT_DB_DOT 2U
60 
68 #define VRNA_CONSTRAINT_DB_X 4U
69 
77 #define VRNA_CONSTRAINT_DB_ANG_BRACK 8U
78 
86 #define VRNA_CONSTRAINT_DB_RND_BRACK 16U
87 
99 #define VRNA_CONSTRAINT_DB_INTRAMOL 2048U
100 
112 #define VRNA_CONSTRAINT_DB_INTERMOL 4096U
113 
122 #define VRNA_CONSTRAINT_DB_GQUAD 8192U
123 
134 #define VRNA_CONSTRAINT_DB_ENFORCE_BP 16384U
135 
142 #define VRNA_CONSTRAINT_MULTILINE 32U
143 
149 #define VRNA_CONSTRAINT_NO_HEADER 64U
150 
156 #define VRNA_CONSTRAINT_ALL 128U
157 
166 #define VRNA_CONSTRAINT_DB 256U
167 
176 #define VRNA_CONSTRAINT_FILE 512U
177 
184 #define VRNA_CONSTRAINT_SOFT_MFE 8192U
185 
192 #define VRNA_CONSTRAINT_SOFT_PF 16384U
193 
194 
201 #define VRNA_CONSTRAINT_CONTEXT_EXT_LOOP (char)0x01
202 
209 #define VRNA_CONSTRAINT_CONTEXT_HP_LOOP (char)0x02
210 
217 #define VRNA_CONSTRAINT_CONTEXT_INT_LOOP (char)0x04
218 
225 #define VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC (char)0x08
226 
233 #define VRNA_CONSTRAINT_CONTEXT_MB_LOOP (char)0x10
234 
241 #define VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC (char)0x20
242 
243 #define VRNA_CONSTRAINT_CONTEXT_ENFORCE (char)0x40
244 
245 #define VRNA_CONSTRAINT_CONTEXT_NO_REMOVE (char)0x80
246 
253 #define VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS (char)( VRNA_CONSTRAINT_CONTEXT_EXT_LOOP \
254  | VRNA_CONSTRAINT_CONTEXT_HP_LOOP \
255  | VRNA_CONSTRAINT_CONTEXT_INT_LOOP \
256  | VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC \
257  | VRNA_CONSTRAINT_CONTEXT_MB_LOOP \
258  | VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC)
259 
266 #define VRNA_DECOMP_PAIR_HP 1
267 
274 #define VRNA_DECOMP_PAIR_IL 2
275 
280 #define VRNA_DECOMP_PAIR_ML 3
281 
286 #define VRNA_DECOMP_ML_ML_ML 5
287 
292 #define VRNA_DECOMP_ML_UP_3 4
293 
298 #define VRNA_DECOMP_ML_UP_5 6
299 
304 #define VRNA_DECOMP_ML_UP 11
305 
310 #define VRNA_DECOMP_EXT_EXT 9
311 
316 #define VRNA_DECOMP_EXT_UP_3 7
317 
322 #define VRNA_DECOMP_EXT_UP_5 10
323 
328 #define VRNA_DECOMP_EXT_UP 8
329 
334 #define VRNA_DECOMP_EXT_STEM_UP 12
335 
336 
350 #define VRNA_SC_GEN_MFE (char)1
351 
365 #define VRNA_SC_GEN_PF (char)2
366 
390 typedef struct vrna_hc_t {
391  char *matrix;
394  int *up_ext;
397  int *up_hp;
400  int *up_int;
403  int *up_ml;
406 } vrna_hc_t;
407 
413 typedef struct vrna_sc_t {
415  int *en_basepair;
416  FLT_OR_DBL **boltzmann_factors;
417  FLT_OR_DBL *exp_en_basepair;
419  int *en_stack;
420  FLT_OR_DBL *exp_en_stack;
422  /* generalized soft contraints below */
423  int (*f)( int,
424  int,
425  int,
426  int,
427  char,
428  void *);
433  PAIR *(*bt)(int,
434  int,
435  int,
436  int,
437  char,
438  void *);
444  FLT_OR_DBL (*exp_f)(int,
445  int,
446  int,
447  int,
448  char,
449  void *);
456  char);
463  char);
470  void *data;
474 } vrna_sc_t;
475 
498 void vrna_message_constraint_options(unsigned int option);
499 
511 
545  const char *constraint,
546  unsigned int options);
547 
563 
579  int i,
580  char option);
581 
599  int i,
600  int j,
601  char option);
602 
621  int i,
622  int d,
623  char option);
624 
636 void vrna_hc_free(vrna_hc_t *hc);
637 
655 
666  const double **constraints,
667  unsigned int options);
668 
679  const double *constraints,
680  unsigned int options);
681 
692 
700 void vrna_sc_free(vrna_sc_t *sc);
701 
714 int vrna_sc_SHAPE_parse_method( const char *method_string,
715  char *method,
716  float *param_1,
717  float *param_2);
718 
745  const double *reactivities,
746  double m,
747  double b,
748  unsigned int options);
749 
763  const char **shape_files,
764  const int *shape_file_association,
765  double m,
766  double b,
767  unsigned int options);
768 
790  const double *reactivities,
791  double b,
792  double default_value,
793  const char *shape_conversion,
794  unsigned int options);
795 
810 int vrna_sc_SHAPE_to_pr(const char *shape_conversion,
811  double *values,
812  int length,
813  double default_value);
814 
830  int (*f)( int, int, int, int, char, void *),
831  void *data);
832 
849  PAIR *(*f)( int, int, int, int, char, void *));
850 
867  FLT_OR_DBL (*exp_f)( int, int, int, int, char, void *),
868  void *data);
869 
885 void vrna_sc_add_pre(vrna_fold_compound *vc, void (*pre)( vrna_fold_compound *, char));
886 
902 void vrna_sc_add_post( vrna_fold_compound *vc, void (*post)( vrna_fold_compound *, char));
903 
904 #ifdef VRNA_BACKWARD_COMPAT
905 
913 DEPRECATED(void print_tty_constraint(unsigned int option));
914 
921 DEPRECATED(void print_tty_constraint_full(void));
922 
935 DEPRECATED(void constrain_ptypes(const char *constraint, unsigned int length, char *ptype, int *BP, int min_loop_size, unsigned int idx_type));
936 
937 #endif
938 
939 #endif
void vrna_sc_add_pre(vrna_fold_compound *vc, void(*pre)(vrna_fold_compound *, char))
Add a pre-processing function for the generalized soft constraints feature.
int vrna_sc_SHAPE_add_deigan(vrna_fold_compound *vc, const double *reactivities, double m, double b, unsigned int options)
Add SHAPE reactivity data as soft constraints (Deigan et al. method)
FLT_OR_DBL ** boltzmann_factors
Boltzmann Factors of the energy contributions for unpaired sequence stretches.
Definition: constraints.h:416
int vrna_sc_SHAPE_to_pr(const char *shape_conversion, double *values, int length, double default_value)
Convert SHAPE reactivity values to probabilities for being unpaired.
void(* pre)(vrna_fold_compound *, char)
A function pointer to some generalized soft constraints preprocessing function.
Definition: constraints.h:455
int * up_hp
A linear array that holds the number of allowed unpaired nucleotides in a hairpin loop...
Definition: constraints.h:397
void vrna_hc_init(vrna_fold_compound *vc)
Initialize/Reset hard constraints to default values.
void vrna_sc_free(vrna_sc_t *sc)
Free memory occupied by a vrna_sc_t data structure.
The hard constraints data structure.
Definition: constraints.h:390
char * matrix
Upper triangular matrix encoding where a base pair or unpaired nucleotide is allowed.
Definition: constraints.h:391
int * up_int
A linear array that holds the number of allowed unpaired nucleotides in an interior loop...
Definition: constraints.h:400
void vrna_hc_add_bp(vrna_fold_compound *vc, int i, int j, char option)
Favorize/Enforce a certain base pair (i,j)
int * up_ml
A linear array that holds the number of allowed unpaired nucleotides in a multi branched loop...
Definition: constraints.h:403
void(* post)(vrna_fold_compound *, char)
A function pointer to some generalized soft constraints postprocessing function.
Definition: constraints.h:462
void vrna_hc_add_bp_nonspecific(vrna_fold_compound *vc, int i, int d, char option)
Enforce a nucleotide to be paired (upstream/downstream)
void vrna_hc_add_up(vrna_fold_compound *vc, int i, char option)
Make a certain nucleotide unpaired.
int * up_ext
A linear array that holds the number of allowed unpaired nucleotides in an exterior loop...
Definition: constraints.h:394
void vrna_sc_remove(vrna_fold_compound *vc)
Remove soft constraints from vrna_fold_compound.
int ** free_energies
Energy contribution for unpaired sequence stretches.
Definition: constraints.h:414
void vrna_sc_init(vrna_fold_compound *vc)
Initialize an empty soft constraints data structure within a vrna_fold_compound.
FLT_OR_DBL * exp_en_basepair
Boltzmann Factors of the energy contribution for base pairs.
Definition: constraints.h:417
The most basic data structure required by many functions throughout the RNAlib.
Definition: data_structures.h:698
void vrna_add_constraints(vrna_fold_compound *vc, const char *constraint, unsigned int options)
Add constraints to a vrna_fold_compound data structure.
void vrna_sc_add_post(vrna_fold_compound *vc, void(*post)(vrna_fold_compound *, char))
Add a post-processing function for the generalized soft constraints feature.
FLT_OR_DBL * exp_en_stack
Boltzmann weighted pseudo energy contribution per nucleotide involved in a stack. ...
Definition: constraints.h:420
void vrna_sc_add_bt(vrna_fold_compound *vc, PAIR *(*f)(int, int, int, int, char, void *))
Bind a backtracking function pointer for generalized soft constraint feature.
void vrna_sc_add_f(vrna_fold_compound *vc, int(*f)(int, int, int, int, char, void *), void *data)
Bind a function pointer for generalized soft constraint feature (MFE version)
The soft constraints data structure.
Definition: constraints.h:413
int vrna_sc_SHAPE_add_deigan_ali(vrna_fold_compound *vc, const char **shape_files, const int *shape_file_association, double m, double b, unsigned int options)
Add SHAPE reactivity data from files as soft constraints for consensus structure prediction (Deigan e...
void * data
A pointer to the data object provided for for pseudo energy contribution functions of the generalized...
Definition: constraints.h:470
void vrna_sc_add_bp(vrna_fold_compound *vc, const double **constraints, unsigned int options)
Add soft constraints for paired nucleotides.
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)
Base pair data structure used in subopt.c.
Definition: data_structures.h:97
void vrna_sc_add_exp_f(vrna_fold_compound *vc, FLT_OR_DBL(*exp_f)(int, int, int, int, char, void *), void *data)
Bind a function pointer for generalized soft constraint feature (PF version)
void vrna_message_constraints_all(void)
Print structure constraint characters to stdout (full constraint support)
void vrna_sc_add_up(vrna_fold_compound *vc, const double *constraints, unsigned int options)
Add soft constraints for unpaired nucleotides.
int * en_basepair
Energy contribution for base pairs.
Definition: constraints.h:415
int * en_stack
Pseudo Energy contribution per base pair involved in a stack.
Definition: constraints.h:419
int vrna_sc_SHAPE_add_zarringhalam(vrna_fold_compound *vc, const double *reactivities, double b, double default_value, const char *shape_conversion, unsigned int options)
Add SHAPE reactivity data as soft constraints (Zarringhalam et al. method)
FLT_OR_DBL(* exp_f)(int, int, int, int, char, void *)
A function pointer used for pseudo energy contribution boltzmann factors in PF calculations.
Definition: constraints.h:444
void vrna_hc_free(vrna_hc_t *hc)
Free the memory allocated by a vrna_hc_t data structure.
int(* f)(int, int, int, int, char, void *)
A function pointer used for pseudo energy contribution in MFE calculations.
Definition: constraints.h:423