RNAlib-2.2.9

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

utils.h
Go to the documentation of this file.
1 #ifndef VIENNA_RNA_PACKAGE_UTILS_H
2 #define VIENNA_RNA_PACKAGE_UTILS_H
3
4 /* make this interface backward compatible with RNAlib < 2.2.0 */
5 #define VRNA_BACKWARD_COMPAT
6
7 #ifdef DEPRECATION_WARNINGS
8 # ifdef __GNUC__
9 # define DEPRECATED(func) func __attribute__ ((deprecated))
10 # else
11 # define DEPRECATED(func) func
12 # endif
13 #else
14 # define DEPRECATED(func) func
15 #endif
16
26 #include <stdio.h>
27
28 #include <ViennaRNA/data_structures.h>
29 #include <ViennaRNA/string_utils.h>
30 #include <ViennaRNA/structure_utils.h>
31 #include <ViennaRNA/alphabet.h>
32
33 /* two helper macros to indicate whether a function should be exported in
34 the library or stays hidden */
35 #define PUBLIC
36 #define PRIVATE static
37
41 #define VRNA_INPUT_ERROR 1U
42
45 #define VRNA_INPUT_QUIT 2U
46
49 #define VRNA_INPUT_MISC 4U
50
58 #define VRNA_INPUT_FASTA_HEADER 8U
59
60 /*
61 * @brief Input flag for get_input_line():\n
62 * Tell get_input_line() that we assume to read a nucleotide sequence
63 *
64 */
65 #define VRNA_INPUT_SEQUENCE 16U
66
71 #define VRNA_INPUT_CONSTRAINT 32U
72
77 #define VRNA_INPUT_NO_TRUNCATION 256U
78
82 #define VRNA_INPUT_NO_REST 512U
83
87 #define VRNA_INPUT_NO_SPAN 1024U
88
92 #define VRNA_INPUT_NOSKIP_BLANK_LINES 2048U
93
97 #define VRNA_INPUT_BLANK_LINE 4096U
98
102 #define VRNA_INPUT_NOSKIP_COMMENTS 128U
103
107 #define VRNA_INPUT_COMMENT 8192U
108
112 #define MIN2(A, B) ((A) < (B) ? (A) : (B))
113
117 #define MAX2(A, B) ((A) > (B) ? (A) : (B))
118
122 #define MIN3(A, B, C) (MIN2( (MIN2((A),(B))) ,(C)))
123
127 #define MAX3(A, B, C) (MAX2( (MAX2((A),(B))) ,(C)))
128
129
130 #ifdef WITH_DMALLOC
131 /* use dmalloc library to check for memory management bugs */
132 #include "dmalloc.h"
133 #define vrna_alloc(S) calloc(1,(S))
134 #define vrna_realloc(p, S) xrealloc(p, S)
135 #else
136
143 void *vrna_alloc(unsigned size);
144
152 void *vrna_realloc(void *p, unsigned size);
153
154 #endif
155
162 void vrna_message_error(const char message[]);
163
171 void vrna_message_warning(const char message[]);
172
173 void vrna_message_info(FILE *fp, const char message[]);
174
178 void vrna_init_rand(void);
179
188 extern unsigned short xsubi[3];
189
197 double vrna_urn(void);
198
207 int vrna_int_urn(int from, int to);
208
212 void vrna_file_copy(FILE *from, FILE *to);
213
222 char *vrna_time_stamp(void);
223
234 /*@only@*/ /*@null@*/
235 char *get_line(FILE *fp);
236
257 unsigned int get_input_line(char **string,
258 unsigned int options);
259
260
266 void vrna_message_input_seq_simple(void);
267
268
277 void vrna_message_input_seq(const char *s);
278
292 int *vrna_idx_row_wise(unsigned int length);
293
308 int *vrna_idx_col_wise(unsigned int length);
309
314 #ifdef VRNA_BACKWARD_COMPAT
315
316 DEPRECATED(int *get_indx(unsigned int length));
317
318 DEPRECATED(int *get_iindx(unsigned int length));
319
326 DEPRECATED(void print_tty_input_seq(void));
327
336 DEPRECATED(void print_tty_input_seq_str(const char *s));
337
345 DEPRECATED(void warn_user(const char message[]));
346
352 DEPRECATED(void nrerror(const char message[]));
353
359 DEPRECATED(void *space(unsigned size));
360
366 DEPRECATED(void *xrealloc(void *p, unsigned size));
367
372 DEPRECATED(void init_rand(void));
373
379 DEPRECATED(double urn(void));
380
386 DEPRECATED(int int_urn(int from, int to));
387
393 DEPRECATED(void filecopy(FILE *from, FILE *to));
394
400 DEPRECATED(char *time_stamp(void));
401
402 #endif
403
404 #endif
vrna_alloc
void * vrna_alloc(unsigned size)
Allocate space safely.
vrna_message_input_seq
void vrna_message_input_seq(const char *s)
Print a line with a user defined string and a ruler to stdout.
get_input_line
unsigned int get_input_line(char **string, unsigned int options)
space
void * space(unsigned size)
Allocate space safely.
get_line
char * get_line(FILE *fp)
Read a line of arbitrary length from a stream.
warn_user
void warn_user(const char message[])
Print a warning message.
vrna_message_input_seq_simple
void vrna_message_input_seq_simple(void)
Print a line to stdout that asks for an input sequence.
vrna_message_warning
void vrna_message_warning(const char message[])
Print a warning message.
time_stamp
char * time_stamp(void)
Get a timestamp.
alphabet.h
Functions to process, convert, and generally handle different nucleotide and/or base pair alphabets...
vrna_idx_col_wise
int * vrna_idx_col_wise(unsigned int length)
Get an index mapper array (indx) for accessing the energy matrices, e.g. in MFE related functions...
int_urn
int int_urn(int from, int to)
Generates a pseudo random integer in a specified range.
vrna_file_copy
void vrna_file_copy(FILE *from, FILE *to)
Inefficient `cp&#39;.
filecopy
void filecopy(FILE *from, FILE *to)
Inefficient cp
vrna_init_rand
void vrna_init_rand(void)
Initialize seed for random number generator.
print_tty_input_seq
void print_tty_input_seq(void)
Print a line to stdout that asks for an input sequence.
string_utils.h
General utility- and helper-functions for RNA sequence and structure strings used throughout the Vien...
vrna_idx_row_wise
int * vrna_idx_row_wise(unsigned int length)
Get an index mapper array (iindx) for accessing the energy matrices, e.g. in partition function relat...
vrna_time_stamp
char * vrna_time_stamp(void)
Get a timestamp.
data_structures.h
structure_utils.h
Various utility- and helper-functions for secondary structure parsing, converting, etc.
nrerror
void nrerror(const char message[])
Die with an error message.
xrealloc
void * xrealloc(void *p, unsigned size)
Reallocate space safely.
vrna_realloc
void * vrna_realloc(void *p, unsigned size)
Reallocate space safely.
vrna_int_urn
int vrna_int_urn(int from, int to)
Generates a pseudo random integer in a specified range.
print_tty_input_seq_str
void print_tty_input_seq_str(const char *s)
Print a line with a user defined string and a ruler to stdout.
vrna_message_error
void vrna_message_error(const char message[])
Die with an error message.
urn
double urn(void)
get a random number from [0..1]
xsubi
unsigned short xsubi[3]
Current 48 bit random number.
init_rand
void init_rand(void)
Make random number seeds.
vrna_urn
double vrna_urn(void)
get a random number from [0..1]