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
00028 #define VRNA_INPUT_FASTA_HEADER 8U
00029
00034 #define VRNA_INPUT_SEQUENCE 16U
00035
00040 #define VRNA_INPUT_CONSTRAINT 32U
00041
00046 #define VRNA_INPUT_NO_TRUNCATION 256U
00047
00051 #define VRNA_INPUT_NO_REST 512U
00052
00056 #define VRNA_INPUT_NO_SPAN 1024U
00057
00061 #define VRNA_INPUT_NOSKIP_BLANK_LINES 2048U
00062
00066 #define VRNA_INPUT_BLANK_LINE 4096U
00067
00071 #define VRNA_INPUT_NOSKIP_COMMENTS 128U
00072
00076 #define VRNA_INPUT_COMMENT 8192U
00077
00078
00079
00080
00084 #define VRNA_CONSTRAINT_PIPE 1U
00085
00088 #define VRNA_CONSTRAINT_DOT 2U
00089
00092 #define VRNA_CONSTRAINT_X 4U
00093
00096 #define VRNA_CONSTRAINT_ANG_BRACK 8U
00097
00100 #define VRNA_CONSTRAINT_RND_BRACK 16U
00101
00104 #define VRNA_CONSTRAINT_MULTILINE 32U
00105
00108 #define VRNA_CONSTRAINT_NO_HEADER 64U
00109
00112 #define VRNA_CONSTRAINT_ALL 128U
00113
00116 #define VRNA_CONSTRAINT_G 256U
00117
00118
00119
00128 #define VRNA_OPTION_MULTILINE 32U
00129
00130
00134 #define MIN2(A, B) ((A) < (B) ? (A) : (B))
00135
00138 #define MAX2(A, B) ((A) > (B) ? (A) : (B))
00139
00142 #define MIN3(A, B, C) (MIN2( (MIN2((A),(B))) ,(C)))
00143
00146 #define MAX3(A, B, C) (MAX2( (MAX2((A),(B))) ,(C)))
00147
00148
00152 #define XSTR(s) STR(s)
00153
00156 #define STR(s) #s
00157
00158 #ifndef FILENAME_MAX_LENGTH
00159
00165 #define FILENAME_MAX_LENGTH 80
00166
00172 #define FILENAME_ID_LENGTH 42
00173 #endif
00174
00175
00176 #ifdef HAVE_CONFIG_H
00177 #include <config.h>
00178 #ifndef HAVE_STRDUP
00179 char *strdup(const char *s);
00180 #endif
00181 #endif
00182 #ifdef WITH_DMALLOC
00183
00184 #include "dmalloc.h"
00185 #define space(S) calloc(1,(S))
00186 #else
00187
00194
00195 void *space(unsigned size) ;
00196
00204
00205 void *xrealloc( void *p,
00206 unsigned size) ;
00207 #endif
00208
00215
00216 void nrerror(const char message[]);
00217
00225 void warn_user(const char message[]);
00226
00230 void init_rand(void);
00231
00240 extern unsigned short xsubi[3];
00241
00248 double urn(void);
00249
00257 int int_urn(int from, int to);
00258
00259 void filecopy(FILE *from, FILE *to);
00260
00269
00270 char *time_stamp(void);
00271
00279
00280 char *random_string(int l, const char symbols[]);
00281
00290 int hamming(const char *s1, const char *s2);
00291
00301 int hamming_bound(const char *s1, const char *s2, int n);
00302
00313
00314 char *get_line(FILE *fp);
00315
00316 int skip_comment_lines(char **line);
00317
00338 unsigned int get_input_line(char **string,
00339 unsigned int options);
00340
00341 unsigned int get_multi_input_line(char **string,
00342 unsigned int options);
00343
00396 unsigned int read_record( char **header,
00397 char **sequence,
00398 char ***rest,
00399 unsigned int options);
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416 char *extract_record_rest_structure(const char **lines,
00417 unsigned int length,
00418 unsigned int option);
00419
00431 char *pack_structure(const char *struc);
00432
00442 char *unpack_structure(const char *packed);
00443
00453 short *make_pair_table(const char *structure);
00454
00455 short *make_pair_table_pk(const char *structure);
00456
00463 short *copy_pair_table(const short *pt);
00464
00470 short *alimake_pair_table(const char *structure);
00471
00477 short *make_pair_table_snoop(const char *structure);
00478
00491 int *make_loop_index_pt(short *pt);
00492
00493
00494 int bp_distance(const char *str1,
00495 const char *str2);
00496
00502 void print_tty_input_seq(void);
00503
00512 void print_tty_input_seq_str(const char *s);
00513
00519 void print_tty_constraint_full(void);
00520
00537 void print_tty_constraint(unsigned int option);
00538
00546 void str_DNA2RNA(char *sequence);
00547
00553 void str_uppercase(char *sequence);
00554
00568 int *get_iindx(unsigned int length);
00569
00584 int *get_indx(unsigned int length);
00585
00586 void getConstraint( char **cstruc,
00587 const char **lines,
00588 unsigned int option);
00589
00601 void constrain_ptypes(const char *constraint,
00602 unsigned int length,
00603 char *ptype,
00604 int *BP,
00605 int min_loop_size,
00606 unsigned int idx_type);
00607
00608 unsigned int *make_referenceBP_array(short *reference_pt,
00609 unsigned int turn);
00610
00611 unsigned int *compute_BPdifferences( short *pt1,
00612 short *pt2,
00613 unsigned int turn);
00614
00615 #endif