RNAlib-2.0.0
|
00001 #ifndef __VIENNA_RNA_PACKAGE_UTILS_H__ 00002 #define __VIENNA_RNA_PACKAGE_UTILS_H__ 00003 00012 #define VRNA_INPUT_ERROR 1U 00013 00016 #define VRNA_INPUT_QUIT 2U 00017 00020 #define VRNA_INPUT_MISC 4U 00021 00027 #define VRNA_INPUT_FASTA_HEADER 8U 00028 00032 #define VRNA_INPUT_SEQUENCE 16U 00033 00037 #define VRNA_INPUT_CONSTRAINT 32U 00038 00042 #define VRNA_INPUT_NO_TRUNCATION 256U 00043 00046 #define VRNA_INPUT_NO_REST 512U 00047 00050 #define VRNA_INPUT_NO_SPAN 1024U 00051 00054 #define VRNA_INPUT_NOSKIP_BLANK_LINES 2048U 00055 00058 #define VRNA_INPUT_BLANK_LINE 4096U 00059 00062 #define VRNA_INPUT_NOSKIP_COMMENTS 128U 00063 00066 #define VRNA_INPUT_COMMENT 8192U 00067 00068 00069 00070 00074 #define VRNA_CONSTRAINT_PIPE 1U 00075 00078 #define VRNA_CONSTRAINT_DOT 2U 00079 00082 #define VRNA_CONSTRAINT_X 4U 00083 00086 #define VRNA_CONSTRAINT_ANG_BRACK 8U 00087 00090 #define VRNA_CONSTRAINT_RND_BRACK 16U 00091 00094 #define VRNA_CONSTRAINT_MULTILINE 32U 00095 00098 #define VRNA_CONSTRAINT_NO_HEADER 64U 00099 00102 #define VRNA_CONSTRAINT_ALL 128U 00103 00107 #define MIN2(A, B) ((A) < (B) ? (A) : (B)) 00108 00111 #define MAX2(A, B) ((A) > (B) ? (A) : (B)) 00112 00115 #define MIN3(A, B, C) (MIN2( (MIN2((A),(B))) ,(C))) 00116 00119 #define MAX3(A, B, C) (MAX2( (MAX2((A),(B))) ,(C))) 00120 00121 #ifdef HAVE_CONFIG_H 00122 #include <config.h> 00123 #ifndef HAVE_STRDUP 00124 char *strdup(const char *s); 00125 #endif 00126 #endif 00127 #ifdef WITH_DMALLOC 00128 /* use dmalloc library to check for memory management bugs */ 00129 #include "dmalloc.h" 00130 #define space(S) calloc(1,(S)) 00131 #else 00132 00139 /*@only@*/ /*@notnull@*/ 00140 void *space(unsigned size) /*@ensures MaxSet(result) == (size-1);@*/; 00141 00149 /*@only@*/ /*@notnull@*/ 00150 void *xrealloc(/*@null@*/ /*@only@*/ /*@out@*/ /*@returned@*/ void *p, 00151 unsigned size) /*@modifies *p @*/ /*@ensures MaxSet(result) == (size-1) @*/; 00152 #endif 00153 00160 /*@exits@*/ 00161 void nrerror(const char message[]); 00162 00170 void warn_user(const char message[]); 00171 00175 void init_rand(void); 00176 00185 extern unsigned short xsubi[3]; 00186 00193 double urn(void); 00194 00202 int int_urn(int from, int to); 00203 00204 void filecopy(FILE *from, FILE *to); /* inefficient `cp' */ 00205 00214 /*@observer@*/ 00215 char *time_stamp(void); 00216 00224 /*@only@*/ /*@notnull@*/ 00225 char *random_string(int l, const char symbols[]); 00226 00235 int hamming(const char *s1, const char *s2); 00236 00246 int hamming_bound(const char *s1, const char *s2, int n); 00247 00258 /*@only@*/ /*@null@*/ 00259 char *get_line(FILE *fp); 00260 00261 int skip_comment_lines(char **line); 00262 00283 unsigned int get_input_line(char **string, 00284 unsigned int options); 00285 00286 unsigned int get_multi_input_line(char **string, 00287 unsigned int options); 00288 00341 unsigned int read_record( char **header, 00342 char **sequence, 00343 char ***rest, 00344 unsigned int options); 00345 00357 char *pack_structure(const char *struc); 00358 00368 char *unpack_structure(const char *packed); 00369 00379 short *make_pair_table(const char *structure); 00380 00387 short *copy_pair_table(const short *pt); 00388 00394 short *alimake_pair_table(const char *structure); 00395 00401 short *make_pair_table_snoop(const char *structure); 00402 00414 int bp_distance(const char *str1, 00415 const char *str2); 00416 00422 void print_tty_input_seq(void); 00423 00432 void print_tty_input_seq_str(const char *s); 00433 00439 void print_tty_constraint_full(void); 00440 00457 void print_tty_constraint(unsigned int option); 00458 00466 void str_DNA2RNA(char *sequence); 00467 00473 void str_uppercase(char *sequence); 00474 00488 int *get_iindx(unsigned int length); 00489 00504 int *get_indx(unsigned int length); 00505 00506 void getConstraint( char **cstruc, 00507 const char **lines, 00508 unsigned int option); 00509 00521 void constrain_ptypes(const char *constraint, 00522 unsigned int length, 00523 char *ptype, 00524 int *BP, 00525 int min_loop_size, 00526 unsigned int idx_type); 00527 00528 unsigned int *make_referenceBP_array(short *reference_pt, 00529 unsigned int turn); 00530 00531 unsigned int *compute_BPdifferences( short *pt1, 00532 short *pt2, 00533 unsigned int turn); 00534 00535 #endif