The following program exercises most commonly used functions of the library. The program folds two sequences using both the mfe and partition function algorithms and calculates the tree edit and profile distance of the resulting structures and base pairing probabilities.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void main()
{
char *seq1="CGCAGGGAUACCCGCG", *seq2="GCGCCCAUAGGGACGC",
*struct1,* struct2,* xstruc;
float e1, e2, tree_dist, string_dist, profile_dist, kT;
float *pf1, *pf2;
FLT_OR_DBL *bppm;
struct1 = (
char* )
space(
sizeof(
char)*(strlen(seq1)+1));
e1 =
fold(seq1, struct1);
struct2 = (
char* )
space(
sizeof(
char)*(strlen(seq2)+1));
e2 =
fold(seq2, struct2);
free(xstruc);
free(xstruc);
free(S1); free(S2);
printf("%s mfe=%5.2f\n%s mfe=%5.2f dist=%3.2f\n",
printf("%s free energy=%5.2f\n%s free energy=%5.2f dist=%3.2f\n",
}
Parsing and Coarse Graining of Structures.
void unexpand_aligned_F(char *align[2])
Converts two aligned structures in expanded notation.
char * expand_Full(const char *structure)
Convert the full structure from bracket notation to the expanded notation including root.
int edit_backtrack
Produce an alignment of the two structures being compared by tracing the editing path giving the mini...
char * aligned_line[4]
Contains the two aligned structures after a call to one of the distance functions with edit_backtrack...
MFE calculations and energy evaluations for single RNA sequences.
Here all all declarations of the global variables used throughout RNAlib.
double temperature
Rescale energy parameters to a temperature in degC.
double pf_scale
A scaling factor used by pf_fold() to avoid overflows.
void free_arrays(void)
Free arrays for mfe folding.
float fold(const char *sequence, char *structure)
Compute minimum free energy and an appropriate secondary structure of an RNA sequence.
double * export_bppm(void)
Get a pointer to the base pair probability array.
float pf_fold(const char *sequence, char *structure)
Compute the partition function of an RNA sequence.
void free_pf_arrays(void)
Free arrays for the partition function recursions.
Inverse folding routines.
Partition function of single RNA sequences.
float * Make_bp_profile_bppm(double *bppm, int length)
condense pair probability matrix into a vector containing probabilities for unpaired,...
void free_profile(float *T)
free space allocated in Make_bp_profile
float profile_edit_distance(const float *T1, const float *T2)
Align the 2 probability profiles T1, T2 .
Functions for String Alignment.
swString * Make_swString(char *string)
Convert a structure into a format suitable for string_edit_distance().
float string_edit_distance(swString *T1, swString *T2)
Calculate the string edit distance of T1 and T2.
Definition dist_vars.h:41
Definition dist_vars.h:46
Functions for Tree Edit Distances.
Tree * make_tree(char *struc)
Constructs a Tree ( essentially the postorder list ) of the structure 'struc', for use in tree_edit_d...
float tree_edit_distance(Tree *T1, Tree *T2)
Calculates the edit distance of the two trees.
void free_tree(Tree *t)
Free the memory allocated for Tree t.
Various utility- and helper-functions used throughout the Vienna RNA package.
void * space(unsigned size)
Allocate space safely.