RNAlib-2.2.0-RC2
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 
130 #define VRNA_CONSTRAINT_MULTILINE 32U
131 
137 #define VRNA_CONSTRAINT_NO_HEADER 64U
138 
144 #define VRNA_CONSTRAINT_ALL 128U
145 
154 #define VRNA_CONSTRAINT_DB 256U
155 
164 #define VRNA_CONSTRAINT_FILE 512U
165 
172 #define VRNA_CONSTRAINT_SOFT_MFE 8192U
173 
180 #define VRNA_CONSTRAINT_SOFT_PF 16384U
181 
182 
189 #define VRNA_CONSTRAINT_CONTEXT_EXT_LOOP (char)0x01
190 
197 #define VRNA_CONSTRAINT_CONTEXT_HP_LOOP (char)0x02
198 
205 #define VRNA_CONSTRAINT_CONTEXT_INT_LOOP (char)0x04
206 
213 #define VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC (char)0x08
214 
221 #define VRNA_CONSTRAINT_CONTEXT_MB_LOOP (char)0x10
222 
229 #define VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC (char)0x20
230 
231 #define VRNA_CONSTRAINT_CONTEXT_ENFORCE (char)0x40
232 
233 #define VRNA_CONSTRAINT_CONTEXT_NO_REMOVE (char)0x80
234 
241 #define VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS (char)( VRNA_CONSTRAINT_CONTEXT_EXT_LOOP \
242  | VRNA_CONSTRAINT_CONTEXT_HP_LOOP \
243  | VRNA_CONSTRAINT_CONTEXT_INT_LOOP \
244  | VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC \
245  | VRNA_CONSTRAINT_CONTEXT_MB_LOOP \
246  | VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC)
247 
254 #define VRNA_DECOMP_PAIR_HP 1
255 
262 #define VRNA_DECOMP_PAIR_IL 2
263 
268 #define VRNA_DECOMP_PAIR_ML 3
269 
274 #define VRNA_DECOMP_ML_ML_ML 5
275 
280 #define VRNA_DECOMP_ML_UP_3 4
281 
286 #define VRNA_DECOMP_ML_UP_5 6
287 
292 #define VRNA_DECOMP_ML_UP 11
293 
298 #define VRNA_DECOMP_EXT_EXT 9
299 
304 #define VRNA_DECOMP_EXT_UP_3 7
305 
310 #define VRNA_DECOMP_EXT_UP_5 10
311 
316 #define VRNA_DECOMP_EXT_UP 8
317 
322 #define VRNA_DECOMP_EXT_STEM_UP 12
323 
324 
338 #define VRNA_SC_GEN_MFE (char)1
339 
353 #define VRNA_SC_GEN_PF (char)2
354 
378 typedef struct vrna_hc_t {
379  char *matrix;
382  int *up_ext;
385  int *up_hp;
388  int *up_int;
391  int *up_ml;
394 } vrna_hc_t;
395 
401 typedef struct vrna_sc_t {
403  int *en_basepair;
404  FLT_OR_DBL **boltzmann_factors;
405  FLT_OR_DBL *exp_en_basepair;
407  int *en_stack;
408  FLT_OR_DBL *exp_en_stack;
410  /* generalized soft contraints below */
411  int (*f)( int,
412  int,
413  int,
414  int,
415  char,
416  void *);
421  FLT_OR_DBL (*exp_f)(int,
422  int,
423  int,
424  int,
425  char,
426  void *);
433  char);
440  char);
447  void *data;
451 } vrna_sc_t;
452 
475 void vrna_message_constraint_options(unsigned int option);
476 
488 
522  const char *constraint,
523  unsigned int options);
524 
540 
556  int i,
557  char option);
558 
576  int i,
577  int j,
578  char option);
579 
598  int i,
599  int d,
600  char option);
601 
613 void vrna_hc_free(vrna_hc_t *hc);
614 
632 
643  const double **constraints,
644  unsigned int options);
645 
656  const double *constraints,
657  unsigned int options);
658 
669 
677 void vrna_sc_free(vrna_sc_t *sc);
678 
691 int vrna_sc_SHAPE_parse_method( const char *method_string,
692  char *method,
693  float *param_1,
694  float *param_2);
695 
722  const double *reactivities,
723  double m,
724  double b,
725  unsigned int options);
726 
740  const char **shape_files,
741  const int *shape_file_association,
742  double m,
743  double b,
744  unsigned int options);
745 
767  const double *reactivities,
768  double b,
769  double default_value,
770  const char *shape_conversion,
771  unsigned int options);
772 
787 int vrna_sc_SHAPE_to_pr(const char *shape_conversion,
788  double *values,
789  int length,
790  double default_value);
791 
807  int (*f)( int, int, int, int, char, void *),
808  void *data);
809 
826  FLT_OR_DBL (*exp_f)( int, int, int, int, char, void *),
827  void *data);
828 
844 void vrna_sc_add_pre(vrna_fold_compound *vc, void (*pre)( vrna_fold_compound *, char));
845 
861 void vrna_sc_add_post( vrna_fold_compound *vc, void (*post)( vrna_fold_compound *, char));
862 
863 #ifdef VRNA_BACKWARD_COMPAT
864 
872 DEPRECATED(void print_tty_constraint(unsigned int option));
873 
880 DEPRECATED(void print_tty_constraint_full(void));
881 
894 DEPRECATED(void constrain_ptypes(const char *constraint, unsigned int length, char *ptype, int *BP, int min_loop_size, unsigned int idx_type));
895 
896 #endif
897 
898 #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:404
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:432
int * up_hp
A linear array that holds the number of allowed unpaired nucleotides in a hairpin loop...
Definition: constraints.h:385
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:378
char * matrix
Upper triangular matrix encoding where a base pair or unpaired nucleotide is allowed.
Definition: constraints.h:379
int * up_int
A linear array that holds the number of allowed unpaired nucleotides in an interior loop...
Definition: constraints.h:388
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:391
void(* post)(vrna_fold_compound *, char)
A function pointer to some generalized soft constraints postprocessing function.
Definition: constraints.h:439
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:382
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:402
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:405
The most basic data structure required by many functions throughout the RNAlib.
Definition: data_structures.h:689
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:408
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:401
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:447
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)
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:403
int * en_stack
Pseudo Energy contribution per base pair involved in a stack.
Definition: constraints.h:407
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:421
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:411