336 { 0, 2, 2, 2, 2, 1, 1},
337 { 2, 0, 2, 2, 2,
INF,
INF},
338 { 2, 2, 0, 1, 2,
INF,
INF},
339 { 2, 2, 1, 0, 2,
INF,
INF},
340 { 2, 2, 2, 2, 0,
INF,
INF},
346 { 0, 100, 5, 5, 75, 5, 5},
347 { 100, 0, 8, 8, 8,
INF,
INF},
348 { 5, 8, 0, 3, 8,
INF,
INF},
349 { 5, 8, 3, 0, 8,
INF,
INF},
350 { 75, 8, 8, 8, 0,
INF,
INF},
355 The lower matrix uses the costs given in \cite shapiro:1990.
356 All distance functions use the following global variables:
361 \copybrief cost_matrix
366 \copybrief edit_backtrack
371 \copybrief aligned_line
373 \see utils.h, dist_vars.h and stringdist.h
for more details
375 <h3>Functions
for Tree Edit Distances</h3>
393 \see dist_vars.h and treedist.h
for prototypes and more detailed descriptions
395 <h3>Functions
for String Alignment</h3>
408 \see dist_vars.h and stringdist.h
for prototypes and more detailed descriptions
410 <h3>Functions
for Comparison of Base Pair Probabilities</h3>
412 For comparison of base pair probability matrices, the matrices are first
413 condensed into probability profiles which are the compared by alignment.
427 \see ProfileDist.h
for prototypes and more details of the above functions
429 \ref mp_utils
"Next Page: Utilities"
431 \page mp_utils Utilities - Odds and Ends
435 <h3>Table of Contents</h3>
447 \section utils_ss Producing secondary structure graphs
500 Two low-level functions provide direct access to the graph lauyouting
511 int naview_xy_coordinates (
short *pair_table,
515 \copybrief naview_xy_coordinates()
517 \see PS_dot.h and naview.h
for more detailed descriptions.
521 <a href=
"#toc">Table of Contents</a>
525 \section utils_dot Producing (colored) dot plots for base pair probabilities
528 int PS_color_dot_plot (
char *
string,
532 \copybrief PS_color_dot_plot()
535 int PS_color_dot_plot_turn (
char *seq,
540 \copybrief PS_color_dot_plot_turn()
552 int PS_dot_plot_turn (
char *seq,
557 \copybrief PS_dot_plot_turn()
559 \see PS_dot.h for more detailed descriptions.
561 \section utils_aln Producing (colored) alignments
565 const
char *structure,
566 const
char *filename,
570 \copybrief PS_color_aln()
574 <a href="
#toc">Table of Contents</a>
578 \section utils_seq RNA sequence related utilities
580 Several functions provide useful applications to RNA sequences
584 const char symbols[])
606 <a href=
"#toc">Table of Contents</a>
610 \section utils_struc RNA secondary structure related utilities
634 <a href=
"#toc">Table of Contents</a>
638 \section utils_misc Miscellaneous Utilities
667 const char *constraint,
672 unsigned int idx_type)
686 unsigned int options);
701 void nrerror (
const char message[])
711 unsigned short xsubi[3];
726 void *
space (
unsigned size)
736 \see utils.h
for a complete overview and detailed description of the utility functions
740 <a href=
"#toc">Table of Contents</a>
744 \ref mp_example
"Next Page: Examples"
746 \page mp_example Example - A Small Example Program
748 The following program exercises most commonly used functions of the library.
749 The program folds two sequences
using both the mfe and partition
function
750 algorithms and calculates the tree edit and profile distance of the
751 resulting structures and base pairing probabilities.
770 char *seq1=
"CGCAGGGAUACCCGCG", *seq2=
"GCGCCCAUAGGGACGC",
771 *struct1,* struct2,* xstruc;
772 float e1, e2, tree_dist, string_dist, profile_dist, kT;
781 struct1 = (
char* )
space(
sizeof(
char)*(strlen(seq1)+1));
782 e1 =
fold(seq1, struct1);
784 struct2 = (
char* )
space(
sizeof(
char)*(strlen(seq2)+1));
785 e2 =
fold(seq2, struct2);
810 printf(
"%s mfe=%5.2f\n%s mfe=%5.2f dist=%3.2f\n",
816 pf_scale = exp(-e1/kT/strlen(seq1));
832 printf(
"%s free energy=%5.2f\n%s free energy=%5.2f dist=%3.2f\n",
839 In a typical Unix environment you would compile
this program
using:
841 cc ${OPENMP_CFLAGS} -c example.c -I${hpath}
845 cc ${OPENMP_CFLAGS} -o example -L${lpath} -lRNA -lm
847 where \e ${hpath} and \e ${lpath} point to the location of the header
848 files and library, respectively.
849 \note As
default, the RNAlib is compiled with build-in \e OpenMP multithreading
850 support. Thus, when linking your own
object files to the library you have to pass
851 the compiler specific \e ${OPENMP_CFLAGS} (e.g.
'-fopenmp' for \b gcc) even
if your code does not
852 use openmp specific code. However, in that
case the \e OpenMP flags may be ommited when compiling
Tree * make_tree(char *struc)
Constructs a Tree ( essentially the postorder list ) of the structure 'struc', for use in tree_edit_d...
Functions for String Alignment.
float string_edit_distance(swString *T1, swString *T2)
Calculate the string edit distance of T1 and T2.
int svg_rna_plot(char *string, char *structure, char *ssfile)
Produce a secondary structure plot in SVG format and write it to a file.
void * space(unsigned size)
Allocate space safely.
void print_tty_constraint_full(void)
Print structure constraint characters to stdout (full constraint support)
swString * Make_swString(char *string)
Convert a structure into a format suitable for string_edit_distance().
char * expand_Full(const char *structure)
Convert the full structure from bracket notation to the expanded notation including root...
void warn_user(const char message[])
Print a warning message.
MFE calculations for single RNA sequences.
char * time_stamp(void)
Get a timestamp.
void free_tree(Tree *t)
Free the memory allocated for Tree t.
int edit_backtrack
Produce an alignment of the two structures being compared by tracing the editing path giving the mini...
float profile_edit_distance(const float *T1, const float *T2)
Align the 2 probability profiles T1, T2 .
int gmlRNA(char *string, char *structure, char *ssfile, char option)
Produce a secondary structure graph in Graph Meta Language (gml) and write it to a file...
void free_profile(float *T)
free space allocated in Make_bp_profile
int ssv_rna_plot(char *string, char *structure, char *ssfile)
Produce a secondary structure graph in SStructView format.
char * get_line(FILE *fp)
Read a line of arbitrary length from a stream.
float fold(const char *sequence, char *structure)
Compute minimum free energy and an appropriate secondary structure of an RNA sequence.
int int_urn(int from, int to)
Generates a pseudo random integer in a specified range.
Definition: dist_vars.h:46
void unexpand_aligned_F(char *align[2])
Converts two aligned structures in expanded notation.
short * make_pair_table(const char *structure)
Create a pair table of a secondary structure.
Functions for Tree Edit Distances.
int cost_matrix
Specify the cost matrix to be used for distance calculations.
void print_tty_input_seq(void)
Print a line to stdout that asks for an input sequence.
Various utility- and helper-functions used throughout the Vienna RNA package.
Parsing and Coarse Graining of Structures.
int rna_plot_type
Switch for changing the secondary structure layout algorithm.
int simple_xy_coordinates(short *pair_table, float *X, float *Y)
Calculate nucleotide coordinates for secondary structure plot the Simple way
void print_tty_constraint(unsigned int option)
Print structure constraint characters to stdout. (constraint support is specified by option parameter...
float tree_edit_distance(Tree *T1, Tree *T2)
Calculates the edit distance of the two trees.
char * pack_structure(const char *struc)
Pack secondary secondary structure, 5:1 compression using base 3 encoding.
char * random_string(int l, const char symbols[])
Create a random string using characters from a specified symbol set.
void str_DNA2RNA(char *sequence)
Convert a DNA input sequence to RNA alphabet.
int * get_indx(unsigned int length)
Get an index mapper array (indx) for accessing the energy matrices, e.g. in MFE related functions...
float pf_fold(const char *sequence, char *structure)
Compute the partition function of an RNA sequence.
FLT_OR_DBL * export_bppm(void)
Get a pointer to the base pair probability arrayAccessing the base pair probabilities for a pair (i...
this datastructure is used as input parameter in functions of PS_dot.h and others ...
Definition: data_structures.h:94
double pf_scale
A scaling factor used by pf_fold() to avoid overflows.
void constrain_ptypes(const char *constraint, unsigned int length, char *ptype, int *BP, int min_loop_size, unsigned int idx_type)
Insert constraining pair types according to constraint structure string.
#define INF
Definition: energy_const.h:16
char * aligned_line[4]
Contains the two aligned structures after a call to one of the distance functions with edit_backtrack...
void free_pf_arrays(void)
Free arrays for the partition function recursions.
int PS_rna_plot(char *string, char *structure, char *file)
Produce a secondary structure graph in PostScript and write it to 'filename'.
void nrerror(const char message[])
Die with an error message.
char * unpack_structure(const char *packed)
Unpack secondary structure previously packed with pack_structure()
int xrna_plot(char *string, char *structure, char *ssfile)
Produce a secondary structure plot for further editing in XRNA.
int * get_iindx(unsigned int length)
Get an index mapper array (iindx) for accessing the energy matrices, e.g. in partition function relat...
void * xrealloc(void *p, unsigned size)
Reallocate space safely.
Definition: dist_vars.h:41
Partition function of single RNA sequences.
short * copy_pair_table(const short *pt)
Get an exact copy of a pair table.
int PS_rna_plot_a(char *string, char *structure, char *file, char *pre, char *post)
Produce a secondary structure graph in PostScript including additional annotation macros and write it...
Inverse folding routines.
float * Make_bp_profile_bppm(FLT_OR_DBL *bppm, int length)
condense pair probability matrix into a vector containing probabilities for unpaired, upstream paired and downstream paired.
this datastructure is used as input parameter in functions of PS_dot.c
Definition: data_structures.h:104
Here all all declarations of the global variables used throughout RNAlib.
double temperature
Rescale energy parameters to a temperature in degC.
double urn(void)
get a random number from [0..1]
void init_rand(void)
Make random number seeds.
unsigned short xsubi[3]
Current 48 bit random number.
void free_arrays(void)
Free arrays for mfe folding.
void str_uppercase(char *sequence)
Convert an input sequence to uppercase.
int PS_dot_plot_list(char *seq, char *filename, plist *pl, plist *mf, char *comment)
Produce a postscript dot-plot from two pair lists.
int hamming(const char *s1, const char *s2)
Calculate hamming distance between two sequences.