Replace Progs/RNAalifold with x64 binary and add all other programs
[jabaws.git] / binaries / src / ViennaRNA / H / part_func_up.h
1 #ifndef __VIENNA_RNA_PACKAGE_PART_FUNC_UP_H__
2 #define __VIENNA_RNA_PACKAGE_PART_FUNC_UP_H__
3
4 #include "data_structures.h"
5
6 #define   RNA_UP_MODE_1   1U
7 #define   RNA_UP_MODE_2   2U
8 #define   RNA_UP_MODE_3   4U
9
10 /**
11  *  \addtogroup up_cofold
12  *  \brief  Partition Function Cofolding as a stepwise process
13  *
14  *  @{
15  *  \file part_func_up.h
16  *  \brief Partition Function Cofolding as stepwise process
17  * 
18  *  In this approach to cofolding the interaction between two RNA molecules is
19  *  seen as a stepwise process. In a first step, the target molecule has to
20  *  adopt a structure in which a binding site is accessible. In a second step,
21  *  the ligand molecule will hybridize with a region accessible to an
22  *  interaction. Consequently the algorithm is designed as a two step process:
23  *  The first step is the calculation of the probability
24  *  that a region within the target is unpaired, or equivalently, the
25  *  calculation of the free energy needed to expose a region. In the second step
26  *  we compute the free energy of an interaction for every possible binding site.
27  */
28
29 /**
30  *  \brief Calculate the partition function over all unpaired regions
31  *  of a maximal length.
32  * 
33  *  You have to call function pf_fold() providing the same sequence before calling
34  *  pf_unstru(). If you want to calculate unpaired regions for a constrained structure, set
35  *  variable 'structure' in function 'pf_fold()' to the constrain string.
36  *  It returns a #pu_contrib struct containing four arrays of dimension
37  *  [i = 1 to length(sequence)][j = 0 to u-1] containing all possible contributions
38  *  to the probabilities of unpaired regions of maximum length u.
39  *  Each array in #pu_contrib contains one of the contributions to the
40  *  total probability of being unpaired: The probability of being unpaired
41  *  within an exterior loop is in array #pu_contrib->E, the probability
42  *  of being unpaired within a hairpin loop is in array #pu_contrib->H,
43  *  the probability of being unpaired within an interior loop is in array
44  *  #pu_contrib->I and probability of being unpaired within a multi-loop
45  *  is in array #pu_contrib->M. The total probability of being unpaired
46  *  is the sum of the four arrays of #pu_contrib.
47  * 
48  *  This function frees everything allocated automatically. To
49  *  free the output structure call free_pu_contrib().
50  * 
51  *  \param sequence
52  *  \param max_w
53  *  \return
54  */
55 pu_contrib *pf_unstru(char *sequence,
56                       int max_w);
57
58 /**
59  *  \brief Calculates the probability of a local interaction between two sequences.
60  * 
61  *  The function considers the probability that the
62  *  region of interaction is unpaired within 's1' and 's2'. The
63  *  longer sequence has to be given as 's1'. The shorter sequence has to
64  *  be given as 's2'. Function pf_unstru() has to be called
65  *  for 's1' and 's2', where the probabilities of  being unpaired
66  *  have to be given in 'p_c' and 'p_c2', respectively. If you do
67  *  not want to include the probabilities of  being unpaired for 's2' set
68  *  'p_c2' to NULL. If variable 'cstruc' is not NULL,
69  *  constrained folding is done: The available constrains for intermolecular
70  *  interaction are: '.' (no constrain), 'x' (the base has no intermolecular
71  *  interaction) and '|' (the corresponding base has to be paired
72  *  intermolecularily).\n
73  *  The parameter 'w' determines the maximal length of the interaction. The
74  *  parameters 'incr5' and 'incr3' allows inclusion of
75  *  unpaired residues left ('incr5') and right ('incr3') of the region
76  *  of interaction in 's1'. If the 'incr' options are used, function
77  *  pf_unstru() has to be called with
78  *  w=w+incr5+incr3 for the longer sequence 's1'.
79  * 
80  *  It returns a structure of type #interact which
81  *  contains the probability of the best local interaction including residue i
82  *  in Pi and the minimum free energy in Gi, where i is the position in sequence
83  *  's1'. The member Gikjl of structure #interact is
84  *  the best interaction between region [k,i] k<i in longer sequence
85  *  's1' and region [j,l] j<l in 's2'. Gikjl_wo is Gikjl without the
86  *  probability of beeing unpaired.\n
87  *  Use free_interact() to free the returned structure, all
88  *  other stuff is freed inside pf_interact().
89  * 
90  *  \param  s1
91  *  \param  s2
92  *  \param  p_c
93  *  \param  p_c2
94  *  \param  max_w
95  *  \param  cstruc
96  *  \param  incr3
97  *  \param  incr5
98  *  \return
99  */
100 interact *pf_interact(const char *s1,
101                       const char *s2,
102                       pu_contrib *p_c,
103                       pu_contrib *p_c2,
104                       int max_w,
105                       char *cstruc,
106                       int incr3,
107                       int incr5);
108
109 /**
110  *  \brief Frees the output of function pf_interact().
111  */
112 void free_interact(interact *pin);
113
114 /**
115  *  \brief
116  */
117 int Up_plot(pu_contrib *p_c,
118             pu_contrib *p_c_sh,
119             interact *pint,
120             char *ofile,
121             int **unpaired_values,
122             char *select_contrib,
123             char *head,
124             unsigned int mode);
125
126 /**
127  *  \brief
128  */
129 pu_contrib  *get_pu_contrib_struct( unsigned int n,
130                                     unsigned int w);
131
132 /**
133  *  \brief Frees the output of function pf_unstru().
134  */
135 void        free_pu_contrib_struct(pu_contrib *pu);
136
137 /**
138  * @}
139  */
140
141 #endif