RNAlib-2.4.14
basic.h File Reference

General utility- and helper-functions used throughout the ViennaRNA Package. More...

+ Include dependency graph for basic.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define VRNA_INPUT_ERROR   1U
 Output flag of get_input_line(): "An ERROR has occured, maybe EOF".
 
#define VRNA_INPUT_QUIT   2U
 Output flag of get_input_line(): "the user requested quitting the program".
 
#define VRNA_INPUT_MISC   4U
 Output flag of get_input_line(): "something was read".
 
#define VRNA_INPUT_FASTA_HEADER   8U
 Input/Output flag of get_input_line():
if used as input option this tells get_input_line() that the data to be read should comply with the FASTA format. More...
 
#define VRNA_INPUT_CONSTRAINT   32U
 Input flag for get_input_line():
Tell get_input_line() that we assume to read a structure constraint. More...
 
#define VRNA_INPUT_NO_TRUNCATION   256U
 Input switch for get_input_line(): "do not trunkate the line by eliminating white spaces at end of line".
 
#define VRNA_INPUT_NO_REST   512U
 Input switch for vrna_file_fasta_read_record(): "do fill rest array".
 
#define VRNA_INPUT_NO_SPAN   1024U
 Input switch for vrna_file_fasta_read_record(): "never allow data to span more than one line".
 
#define VRNA_INPUT_NOSKIP_BLANK_LINES   2048U
 Input switch for vrna_file_fasta_read_record(): "do not skip empty lines".
 
#define VRNA_INPUT_BLANK_LINE   4096U
 Output flag for vrna_file_fasta_read_record(): "read an empty line".
 
#define VRNA_INPUT_NOSKIP_COMMENTS   128U
 Input switch for get_input_line(): "do not skip comment lines".
 
#define VRNA_INPUT_COMMENT   8192U
 Output flag for vrna_file_fasta_read_record(): "read a comment".
 
#define MIN2(A, B)   ((A) < (B) ? (A) : (B))
 Get the minimum of two comparable values.
 
#define MAX2(A, B)   ((A) > (B) ? (A) : (B))
 Get the maximum of two comparable values.
 
#define MIN3(A, B, C)   (MIN2((MIN2((A), (B))), (C)))
 Get the minimum of three comparable values.
 
#define MAX3(A, B, C)   (MAX2((MAX2((A), (B))), (C)))
 Get the maximum of three comparable values.
 

Functions

void * vrna_alloc (unsigned size)
 Allocate space safely. More...
 
void * vrna_realloc (void *p, unsigned size)
 Reallocate space safely. More...
 
void vrna_init_rand (void)
 Initialize seed for random number generator.
 
double vrna_urn (void)
 get a random number from [0..1] More...
 
int vrna_int_urn (int from, int to)
 Generates a pseudo random integer in a specified range. More...
 
char * vrna_time_stamp (void)
 Get a timestamp. More...
 
unsigned int get_input_line (char **string, unsigned int options)
 
int * vrna_idx_row_wise (unsigned int length)
 Get an index mapper array (iindx) for accessing the energy matrices, e.g. in partition function related functions. More...
 
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. More...
 
void vrna_message_error (const char *format,...)
 Print an error message and die. More...
 
void vrna_message_verror (const char *format, va_list args)
 Print an error message and die. More...
 
void vrna_message_warning (const char *format,...)
 Print a warning message. More...
 
void vrna_message_vwarning (const char *format, va_list args)
 Print a warning message. More...
 
void vrna_message_info (FILE *fp, const char *format,...)
 Print an info message. More...
 
void vrna_message_vinfo (FILE *fp, const char *format, va_list args)
 Print an info message. More...
 
void vrna_message_input_seq_simple (void)
 Print a line to stdout that asks for an input sequence. More...
 
void vrna_message_input_seq (const char *s)
 Print a line with a user defined string and a ruler to stdout. More...
 
char * get_line (FILE *fp)
 Read a line of arbitrary length from a stream. More...
 
void print_tty_input_seq (void)
 Print a line to stdout that asks for an input sequence. More...
 
void print_tty_input_seq_str (const char *s)
 Print a line with a user defined string and a ruler to stdout. More...
 
void warn_user (const char message[])
 Print a warning message. More...
 
void nrerror (const char message[])
 Die with an error message. More...
 
void * space (unsigned size)
 Allocate space safely. More...
 
void * xrealloc (void *p, unsigned size)
 Reallocate space safely. More...
 
void init_rand (void)
 Make random number seeds. More...
 
double urn (void)
 get a random number from [0..1] More...
 
int int_urn (int from, int to)
 Generates a pseudo random integer in a specified range. More...
 
void filecopy (FILE *from, FILE *to)
 Inefficient cp More...
 
char * time_stamp (void)
 Get a timestamp. More...
 

Variables

unsigned short xsubi [3]
 Current 48 bit random number. More...
 

Detailed Description

General utility- and helper-functions used throughout the ViennaRNA Package.

Function Documentation

char* get_line ( FILE *  fp)

Read a line of arbitrary length from a stream.

Returns a pointer to the resulting string. The necessary memory is allocated and should be released using free() when the string is no longer needed.

Deprecated:
Use vrna_read_line() as a substitute!
Parameters
fpA file pointer to the stream where the function should read from
Returns
A pointer to the resulting string
void print_tty_input_seq ( void  )

Print a line to stdout that asks for an input sequence.

There will also be a ruler (scale line) printed that helps orientation of the sequence positions

Deprecated:
Use vrna_message_input_seq_simple() instead!
void print_tty_input_seq_str ( const char *  s)

Print a line with a user defined string and a ruler to stdout.

(usually this is used to ask for user input) There will also be a ruler (scale line) printed that helps orientation of the sequence positions

Deprecated:
Use vrna_message_input_seq() instead!
void warn_user ( const char  message[])

Print a warning message.

Print a warning message to stderr

Deprecated:
Use vrna_message_warning() instead!
void nrerror ( const char  message[])

Die with an error message.

Deprecated:
Use vrna_message_error() instead!
void* space ( unsigned  size)

Allocate space safely.

Deprecated:
Use vrna_alloc() instead!
void* xrealloc ( void *  p,
unsigned  size 
)

Reallocate space safely.

Deprecated:
Use vrna_realloc() instead!
void init_rand ( void  )

Make random number seeds.

Deprecated:
Use vrna_init_rand() instead!
double urn ( void  )

get a random number from [0..1]

Deprecated:
Use vrna_urn() instead!
int int_urn ( int  from,
int  to 
)

Generates a pseudo random integer in a specified range.

Deprecated:
Use vrna_int_urn() instead!
void filecopy ( FILE *  from,
FILE *  to 
)

Inefficient cp

Deprecated:
Use vrna_file_copy() instead!
char* time_stamp ( void  )

Get a timestamp.

Deprecated:
Use vrna_time_stamp() instead!