Replace Progs/RNAalifold with x64 binary and add all other programs
[jabaws.git] / binaries / src / ViennaRNA / H / cofold.h
1 #ifndef __VIENNA_RNA_PACKAGE_COFOLD_H__
2 #define __VIENNA_RNA_PACKAGE_COFOLD_H__
3
4 #include "data_structures.h"
5
6 #ifdef __GNUC__
7 #define DEPRECATED(func) func __attribute__ ((deprecated))
8 #else
9 #define DEPRECATED(func) func
10 #endif
11
12 /**
13  *  \addtogroup cofold
14  *  \brief Predict structures formed by two molecules upon hybridization.
15  *
16  *  The function of an RNA molecule often depends on its interaction with
17  *  other RNAs. The following routines therefore allow to predict structures
18  *  formed by two RNA molecules upon hybridization.\n
19  *  One approach to co-folding two RNAs consists of concatenating the two
20  *  sequences and keeping track of the concatenation point in all energy
21  *  evaluations. Correspondingly, many of the cofold() and
22  *  co_pf_fold() routines below take one sequence string as argument
23  *  and use the the global variable #cut_point to mark the concatenation
24  *  point. Note that while the <i>RNAcofold</i> program uses the '&' character
25  *  to mark the chain break in its input, you should not use an '&' when using
26  *  the library routines (set #cut_point instead).\n
27  *  In a second approach to co-folding two RNAs, cofolding is seen as a
28  *  stepwise process. In the first step the probability of an unpaired region
29  *  is calculated and in a second step this probability of an unpaired region
30  *  is  multiplied with the probability of an interaction between the two RNAs.
31  *  This approach is implemented for the interaction between a long
32  *  target sequence and a short ligand RNA. Function pf_unstru() calculates
33  *  the partition function over all unpaired regions in the input
34  *  sequence. Function pf_interact(), which calculates the
35  *  partition function over all possible interactions between two
36  *  sequences, needs both sequence as separate strings as input.
37  *
38  */
39
40 /**
41  *  \addtogroup mfe_cofold
42  *  @{
43  *  \file cofold.h
44  * 
45  *  \brief MFE version of cofolding routines
46  * 
47  *  This file includes (almost) all function declarations within the <b>RNAlib</b> that are related to
48  *  MFE Cofolding...
49  *  This also includes the Zuker suboptimals calculations, since they are implemented using the cofold
50  *  routines.
51  */
52
53 /**
54  *  \brief Compute the minimum free energy of two interacting RNA molecules
55  * 
56  *  The code is analog to the fold() function. If #cut_point ==-1 results
57  *  should be the same as with fold().
58  * 
59  *  \ingroup mfe_cofold
60  *
61  *  \param    sequence  The two sequences concatenated
62  *  \param    structure Will hold the barcket dot structure of the dimer molecule
63  *  \return   minimum free energy of the structure
64  */
65 float cofold( const char *sequence,
66               char *structure);
67
68 /**
69  *  \brief Compute the minimum free energy of two interacting RNA molecules
70  * 
71  */
72 float cofold_par( const char *string,
73                   char *structure,
74                   paramT *parameters,
75                   int is_constrained);
76
77 /**
78  *  \brief Free memory occupied by cofold()
79  */
80 void      free_co_arrays(void);
81
82 /**
83  *  \brief Recalculate parameters
84  */
85 void      update_cofold_params(void);
86
87 void      update_cofold_params_par(paramT *parameters);
88
89
90 /**
91  *  \brief Export the arrays of partition function cofold (with gquadruplex support)
92  * 
93  *  Export the cofold arrays for use e.g. in the concentration
94  *  Computations or suboptimal secondary structure backtracking
95  *
96  *  \param  f5_p    A pointer to the 'f5' array, i.e. array conatining best free energy in interval [1,j]
97  *  \param  c_p     A pointer to the 'c' array, i.e. array containing best free energy in interval [i,j] given that i pairs with j
98  *  \param  fML_p   A pointer to the 'M' array, i.e. array containing best free energy in interval [i,j] for any multiloop segment with at least one stem
99  *  \param  fM1_p   A pointer to the 'M1' array, i.e. array containing best free energy in interval [i,j] for multiloop segment with exactly one stem
100  *  \param  fc_p    A pointer to the 'fc' array, i.e. array ...
101  *  \param  ggg_p   A pointer to the 'ggg' array, i.e. array containing best free energy of a gquadruplex delimited by [i,j]
102  *  \param  indx_p  A pointer to the indexing array used for accessing the energy matrices
103  *  \param  ptype_p A pointer to the ptype array containing the base pair types for each possibility (i,j)
104  */
105 void export_cofold_arrays_gq( int **f5_p,
106                               int **c_p,
107                               int **fML_p,
108                               int **fM1_p,
109                               int **fc_p,
110                               int **ggg_p,
111                               int **indx_p,
112                               char **ptype_p);
113
114 /**
115  *  \brief Export the arrays of partition function cofold
116  * 
117  *  Export the cofold arrays for use e.g. in the concentration
118  *  Computations or suboptimal secondary structure backtracking
119  *
120  *  \param  f5_p    A pointer to the 'f5' array, i.e. array conatining best free energy in interval [1,j]
121  *  \param  c_p     A pointer to the 'c' array, i.e. array containing best free energy in interval [i,j] given that i pairs with j
122  *  \param  fML_p   A pointer to the 'M' array, i.e. array containing best free energy in interval [i,j] for any multiloop segment with at least one stem
123  *  \param  fM1_p   A pointer to the 'M1' array, i.e. array containing best free energy in interval [i,j] for multiloop segment with exactly one stem
124  *  \param  fc_p    A pointer to the 'fc' array, i.e. array ...
125  *  \param  indx_p  A pointer to the indexing array used for accessing the energy matrices
126  *  \param  ptype_p A pointer to the ptype array containing the base pair types for each possibility (i,j)
127  */
128 void export_cofold_arrays(int **f5_p,
129                           int **c_p,
130                           int **fML_p,
131                           int **fM1_p,
132                           int **fc_p,
133                           int **indx_p,
134                           char **ptype_p);
135
136
137 /**
138  *  @}
139  */
140
141 /**
142  *  \brief Compute Zuker type suboptimal structures
143  *
144  *  Compute Suboptimal structures according to M. Zuker, i.e. for every 
145  *  possible base pair the minimum energy structure containing the resp. base pair. 
146  *  Returns a list of these structures and their energies.
147  *
148  *  \ingroup subopt_zuker
149  *
150  *  \param  string  RNA sequence
151  *  \return         List of zuker suboptimal structures
152  */
153 SOLUTION  *zukersubopt(const char *string);
154
155 /**
156  *  \brief Compute Zuker type suboptimal structures
157  *
158  *  \ingroup subopt_zuker
159  *
160  */
161 SOLUTION  *zukersubopt_par( const char *string,
162                             paramT *parameters);
163
164 /**
165  *  \brief get_monomer_free_energies
166  *
167  *  Export monomer free energies out of cofold arrays
168  * 
169  *  \param e1 A pointer to a variable where the energy of molecule A will be written to
170  *  \param e2 A pointer to a variable where the energy of molecule B will be written to
171  */
172 void get_monomere_mfes( float *e1,
173                         float *e2);
174
175
176 /**
177  *  allocate arrays for folding
178  *  \deprecated{This function is obsolete and will be removed soon!}
179  */
180 DEPRECATED(void initialize_cofold(int length));
181
182 #endif