Utilities
Defines
-
PUBLIC
- #include <ViennaRNA/utils/basic.h>
-
PRIVATE
- #include <ViennaRNA/utils/basic.h>
-
VRNA_INPUT_ERROR
- #include <ViennaRNA/utils/basic.h>
Output flag of get_input_line(): “An ERROR has occured, maybe EOF”.
-
VRNA_INPUT_QUIT
- #include <ViennaRNA/utils/basic.h>
Output flag of get_input_line(): “the user requested quitting the program”.
-
VRNA_INPUT_MISC
- #include <ViennaRNA/utils/basic.h>
Output flag of get_input_line(): “something was read”.
-
VRNA_INPUT_FASTA_HEADER
- #include <ViennaRNA/utils/basic.h>
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.the function will return this flag if a fasta header was read
-
VRNA_INPUT_SEQUENCE
- #include <ViennaRNA/utils/basic.h>
-
VRNA_INPUT_CONSTRAINT
- #include <ViennaRNA/utils/basic.h>
Input flag for get_input_line()
:
Tell
get_input_line() that we assume to read a structure constraint.
-
VRNA_INPUT_NO_TRUNCATION
- #include <ViennaRNA/utils/basic.h>
Input switch for get_input_line(): “do not trunkate the line by eliminating white spaces at end of line”.
-
VRNA_INPUT_NO_REST
- #include <ViennaRNA/utils/basic.h>
Input switch for vrna_file_fasta_read_record(): “do fill rest array”.
-
VRNA_INPUT_NO_SPAN
- #include <ViennaRNA/utils/basic.h>
Input switch for vrna_file_fasta_read_record(): “never allow data to span more than one line”.
-
VRNA_INPUT_NOSKIP_BLANK_LINES
- #include <ViennaRNA/utils/basic.h>
Input switch for vrna_file_fasta_read_record(): “do not skip empty lines”.
-
VRNA_INPUT_BLANK_LINE
- #include <ViennaRNA/utils/basic.h>
Output flag for vrna_file_fasta_read_record(): “read an empty line”.
-
VRNA_INPUT_NOSKIP_COMMENTS
- #include <ViennaRNA/utils/basic.h>
Input switch for get_input_line(): “do not skip comment lines”.
-
VRNA_INPUT_COMMENT
- #include <ViennaRNA/utils/basic.h>
Output flag for vrna_file_fasta_read_record(): “read a comment”.
-
MIN2(A, B)
- #include <ViennaRNA/utils/basic.h>
Get the minimum of two comparable values.
-
MAX2(A, B)
- #include <ViennaRNA/utils/basic.h>
Get the maximum of two comparable values.
-
MIN3(A, B, C)
- #include <ViennaRNA/utils/basic.h>
Get the minimum of three comparable values.
-
MAX3(A, B, C)
- #include <ViennaRNA/utils/basic.h>
Get the maximum of three comparable values.
Functions
-
void *vrna_alloc(unsigned size)
- #include <ViennaRNA/utils/basic.h>
Allocate space safely.
- Parameters
size – The size of the memory to be allocated in bytes
- Returns
A pointer to the allocated memory
-
void *vrna_realloc(void *p, unsigned size)
- #include <ViennaRNA/utils/basic.h>
Reallocate space safely.
- Parameters
p – A pointer to the memory region to be reallocated
size – The size of the memory to be allocated in bytes
- Returns
A pointer to the newly allocated memory
-
void vrna_init_rand(void)
- #include <ViennaRNA/utils/basic.h>
Initialize seed for random number generator.
See also
-
void vrna_init_rand_seed(unsigned int seed)
- #include <ViennaRNA/utils/basic.h>
Initialize the random number generator with a pre-defined seed.
- SWIG Wrapper Notes:
This function is available as an overloaded function init_rand() where the argument
seed
is optional. See, e.g.RNA.init_rand()
in the Python API.
See also
- Parameters
seed – The seed for the random number generator
-
double vrna_urn(void)
- #include <ViennaRNA/utils/basic.h>
get a random number from [0..1]
See also
Note
Usually implemented by calling erand48().
- Returns
A random number in range [0..1]
-
int vrna_int_urn(int from, int to)
- #include <ViennaRNA/utils/basic.h>
Generates a pseudo random integer in a specified range.
See also
- Parameters
from – The first number in range
to – The last number in range
- Returns
A pseudo random number in range [from, to]
-
char *vrna_time_stamp(void)
- #include <ViennaRNA/utils/basic.h>
Get a timestamp.
Returns a string containing the current date in the format
Fri Mar 19 21:10:57 1993
- Returns
A string containing the timestamp
-
unsigned int get_input_line(char **string, unsigned int options)
- #include <ViennaRNA/utils/basic.h>
Retrieve a line from ‘stdin’ savely while skipping comment characters and other features This function returns the type of input it has read if recognized. An option argument allows one to switch between different reading modes.
Currently available options are:
VRNA_INPUT_COMMENT, VRNA_INPUT_NOSKIP_COMMENTS, VRNA_INPUT_NO_TRUNCATIONpass a collection of options as one value like this:
get_input_line(string, option_1 | option_2 | option_n)
If the function recognizes the type of input, it will report it in the return value. It also reports if a user defined ‘quit’ command (-sign on ‘stdin’) was given. Possible return values are:VRNA_INPUT_FASTA_HEADER, VRNA_INPUT_ERROR, VRNA_INPUT_MISC, VRNA_INPUT_QUIT
- Parameters
string – A pointer to the character array that contains the line read
options – A collection of options for switching the functions behavior
- Returns
A flag with information about what has been read
-
int *vrna_idx_row_wise(unsigned int length)
- #include <ViennaRNA/utils/basic.h>
Get an index mapper array (iindx) for accessing the energy matrices, e.g. in partition function related functions.
Access of a position “(i,j)” is then accomplished by using
This function is necessary as most of the two-dimensional energy matrices are actually one-dimensional arrays throughout the ViennaRNA Package(i,j) ~ iindx[i]-j
Consult the implemented code to find out about the mapping formula ;)
See also
- Parameters
length – The length of the RNA sequence
- Returns
The mapper array
-
int *vrna_idx_col_wise(unsigned int length)
- #include <ViennaRNA/utils/basic.h>
Get an index mapper array (indx) for accessing the energy matrices, e.g. in MFE related functions.
Access of a position “(i,j)” is then accomplished by using
This function is necessary as most of the two-dimensional energy matrices are actually one-dimensional arrays throughout the ViennaRNAPackage(i,j) ~ indx[j]+i
Consult the implemented code to find out about the mapping formula ;)
See also
- Parameters
length – The length of the RNA sequence
- Returns
The mapper array
Variables
-
unsigned short xsubi[3]
Current 48 bit random number.
This variable is used by vrna_urn(). These should be set to some random number seeds before the first call to vrna_urn().
See also
-
PUBLIC