utils.h
Go to the documentation of this file.
#ifndef __VIENNA_RNA_PACKAGE_UTILS_H__
#define __VIENNA_RNA_PACKAGE_UTILS_H__
#define VRNA_INPUT_ERROR 1U
#define VRNA_INPUT_QUIT 2U
#define VRNA_INPUT_MISC 4U
#define VRNA_INPUT_FASTA_HEADER 8U
#define VRNA_INPUT_SEQUENCE 16U
#define VRNA_INPUT_CONSTRAINT 32U
#define VRNA_INPUT_NO_TRUNCATION 256U
#define VRNA_INPUT_NO_REST 512U
#define VRNA_INPUT_NO_SPAN 1024U
#define VRNA_INPUT_NOSKIP_BLANK_LINES 2048U
#define VRNA_INPUT_BLANK_LINE 4096U
#define VRNA_INPUT_NOSKIP_COMMENTS 128U
#define VRNA_INPUT_COMMENT 8192U
#define VRNA_CONSTRAINT_PIPE 1U
#define VRNA_CONSTRAINT_DOT 2U
#define VRNA_CONSTRAINT_X 4U
#define VRNA_CONSTRAINT_ANG_BRACK 8U
#define VRNA_CONSTRAINT_RND_BRACK 16U
#define VRNA_CONSTRAINT_MULTILINE 32U
#define VRNA_CONSTRAINT_NO_HEADER 64U
#define VRNA_CONSTRAINT_ALL 128U
#define VRNA_CONSTRAINT_G 256U
#define VRNA_OPTION_MULTILINE 32U
#define MIN2(A, B) ((A) < (B) ? (A) : (B))
#define MAX2(A, B) ((A) > (B) ? (A) : (B))
#define MIN3(A, B, C) (MIN2( (MIN2((A),(B))) ,(C)))
#define MAX3(A, B, C) (MAX2( (MAX2((A),(B))) ,(C)))
#define XSTR(s) STR(s)
#define STR(s) #s
#ifndef FILENAME_MAX_LENGTH
#define FILENAME_MAX_LENGTH 80
#define FILENAME_ID_LENGTH 42
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#ifndef HAVE_STRDUP
char *strdup(const char *s);
#endif
#endif
#ifdef WITH_DMALLOC
/* use dmalloc library to check for memory management bugs */
#include "dmalloc.h"
#define space(S) calloc(1,(S))
#else
/*@only@*/ /*@notnull@*/
void *space(unsigned size) /*@ensures MaxSet(result) == (size-1);@*/;
/*@only@*/ /*@notnull@*/
void *xrealloc(/*@null@*/ /*@only@*/ /*@out@*/ /*@returned@*/ void *p,
unsigned size) /*@modifies *p @*/ /*@ensures MaxSet(result) == (size-1) @*/;
#endif
/*@exits@*/
void nrerror(const char message[]);
void warn_user(const char message[]);
void init_rand(void);
extern unsigned short xsubi[3];
double urn(void);
int int_urn(int from, int to);
void filecopy(FILE *from, FILE *to); /* inefficient `cp' */
/*@observer@*/
char *time_stamp(void);
/*@only@*/ /*@notnull@*/
char *random_string(int l, const char symbols[]);
int hamming(const char *s1, const char *s2);
int hamming_bound(const char *s1, const char *s2, int n);
/*@only@*/ /*@null@*/
char *get_line(FILE *fp);
int skip_comment_lines(char **line);
unsigned int get_input_line(char **string,
unsigned int options);
unsigned int get_multi_input_line(char **string,
unsigned int options);
unsigned int read_record( char **header,
char **sequence,
char ***rest,
unsigned int options);
/* \brief Extract a dot-bracket structure string from (multiline)character array
*
* This function extracts a dot-bracket structure string from the 'rest' array as
* returned by read_record() and returns it. All occurences of comments within the
* 'lines' array will be skipped as long as they do not break the structure string.
* If no structure could be read, this function returns NULL.
*
* \see read_record()
*
* \param lines The (multiline) character array to be parsed
* \param length The assumed length of the dot-bracket string (passing a value < 1 results in no length limit)
* \param option Some options which may be passed to alter the behavior of the function, use 0 for no options
* \return The dot-bracket string read from lines or NULL
*/
char *extract_record_rest_structure(const char **lines,
unsigned int length,
unsigned int option);
char *pack_structure(const char *struc);
char *unpack_structure(const char *packed);
short *make_pair_table(const char *structure);
short *make_pair_table_pk(const char *structure);
short *copy_pair_table(const short *pt);
short *alimake_pair_table(const char *structure);
short *make_pair_table_snoop(const char *structure);
int *make_loop_index_pt(short *pt);
int bp_distance(const char *str1,
const char *str2);
void print_tty_input_seq(void);
void print_tty_input_seq_str(const char *s);
void print_tty_constraint_full(void);
void print_tty_constraint(unsigned int option);
void str_DNA2RNA(char *sequence);
void str_uppercase(char *sequence);
int *get_iindx(unsigned int length);
int *get_indx(unsigned int length);
void getConstraint( char **cstruc,
const char **lines,
unsigned int option);
void constrain_ptypes(const char *constraint,
unsigned int length,
char *ptype,
int *BP,
int min_loop_size,
unsigned int idx_type);
unsigned int *make_referenceBP_array(short *reference_pt,
unsigned int turn);
unsigned int *compute_BPdifferences( short *pt1,
short *pt2,
unsigned int turn);
#endif