1 #ifndef VIENNA_RNA_PACKAGE_LPFOLD_H
2 #define VIENNA_RNA_PACKAGE_LPFOLD_H
3 
4 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
5 
6 /**
7  *  @file     LPfold.h
8  *  @ingroup  part_func_window_deprecated
9  *  @brief    Partition function and equilibrium probability implementation for the sliding window algorithm
10  *
11  *  This file contains the implementation for sliding window partition function and equilibrium
12  *  probabilities. It also provides the unpaired probability implementation from Bernhart et al.
13  *  2011 @cite bernhart:2011
14  */
15 
16 #include <stdio.h>
17 
18 #include <ViennaRNA/datastructures/basic.h>
19 #include <ViennaRNA/params/basic.h>
20 #include <ViennaRNA/part_func_window.h>
21 
22 #ifdef VRNA_WARN_DEPRECATED
23 # if defined(__clang__)
24 #  define DEPRECATED(func, msg) func __attribute__ ((deprecated("", msg)))
25 # elif defined(__GNUC__)
26 #  define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
27 # else
28 #  define DEPRECATED(func, msg) func
29 # endif
30 #else
31 # define DEPRECATED(func, msg) func
32 #endif
33 
34 /**
35  *  \brief
36  *
37  *  \ingroup part_func_window_deprecated
38  *
39  *  \param  length
40  */
41 DEPRECATED(void update_pf_paramsLP(int length),
42 "This function is obsolete");
43 
44 
45 /**
46  *  \brief
47  *
48  *  \ingroup part_func_window_deprecated
49  *
50  */
51 DEPRECATED(void update_pf_paramsLP_par(int              length,
52                                        vrna_exp_param_t *parameters),
53 "Use the new API with vrna_folc_compound_t instead");
54 
55 
56 /**
57  *  \brief Compute partition functions for locally stable secondary structures
58  *
59  *  pfl_fold computes partition functions for every window of size
60  *  'winSize' possible in a RNA molecule, allowing only pairs with a span
61  *  smaller than 'pairSize'. It returns the mean pair probabilities averaged
62  *  over all windows containing the pair in 'pl'. 'winSize' should
63  *  always be >= 'pairSize'. Note that in contrast to Lfold(),
64  *  bases outside of the window do not influence the structure at all. Only
65  *  probabilities higher than 'cutoffb' are kept.
66  *
67  *  If 'pU' is supplied (i.e is not the NULL pointer), pfl_fold()
68  *  will also compute the mean probability that regions of length 'u' and smaller are
69  *  unpaired. The parameter 'u' is supplied in 'pup[0][0]'. On return
70  *  the 'pup' array will contain these probabilities, with the entry on
71  *  'pup[x][y]' containing the mean probability that x and the y-1
72  *  preceding bases are unpaired. The 'pU' array needs to be large
73  *  enough to hold n+1 float* entries, where n is the sequence length.
74  *
75  *  If an array dpp2 is supplied, the probability of base pair (i,j)
76  *  given that there already exists a base pair (i+1,j-1) is also
77  *  computed and saved in this array. If pUfp is given (i.e. not NULL), pU
78  *  is not saved but put out imediately. If spup is given (i.e. is not NULL),
79  *  the pair probabilities in pl are not saved but put out imediately.
80  *
81  *  \ingroup part_func_window_deprecated
82  *
83  *  \param  sequence  RNA sequence
84  *  \param  winSize   size of the window
85  *  \param  pairSize  maximum size of base pair
86  *  \param  cutoffb   cutoffb for base pairs
87  *  \param  pU        array holding all unpaired probabilities
88  *  \param  dpp2  array of dependent pair probabilities
89  *  \param  pUfp     file pointer for pU
90  *  \param  spup     file pointer for pair probabilities
91  *  \return list of pair probabilities
92  */
93 DEPRECATED(vrna_ep_t *pfl_fold(char          *sequence,
94                                int           winSize,
95                                int           pairSize,
96                                float         cutoffb,
97                                double        **pU,
98                                vrna_ep_t     **dpp2,
99                                FILE          *pUfp,
100                                FILE          *spup),
101 "Use vrna_pfl_fold(), vrna_pfl_fold_cb(), vrna_pfl_fold_up(), or vrna_pfl_fold_up_cb() instead");
102 
103 
104 /**
105  *  \brief Compute partition functions for locally stable secondary structures
106  *
107  *  \ingroup part_func_window_deprecated
108  *
109  */
110 DEPRECATED(vrna_ep_t *pfl_fold_par(char              *sequence,
111                                       int               winSize,
112                                       int               pairSize,
113                                       float             cutoffb,
114                                       double            **pU,
115                                       vrna_ep_t         **dpp2,
116                                       FILE              *pUfp,
117                                       FILE              *spup,
118                                       vrna_exp_param_t  *parameters),
119 "Use the new API and vrna_probs_window() instead");
120 
121 
122 DEPRECATED(void putoutpU_prob_par(double            **pU,
123                                   int               length,
124                                   int               ulength,
125                                   FILE              *fp,
126                                   int               energies,
127                                   vrna_exp_param_t  *parameters),
128 "");
129 
130 
131 /**
132  *  \brief Writes the unpaired probabilities (pU) or opening energies into a file
133  *
134  *  Can write either the unpaired probabilities (accessibilities) pU or
135  *  the opening energies -log(pU)kT into a file
136  *
137  *  \ingroup part_func_window_deprecated
138  *
139  *  \param  pU       pair probabilities
140  *  \param  length   length of RNA sequence
141  *  \param  ulength  maximum length of unpaired stretch
142  *  \param  fp file pointer of destination file
143  *  \param  energies  switch to put out as  opening energies
144  */
145 DEPRECATED(void    putoutpU_prob(double **pU,
146                                  int    length,
147                                  int    ulength,
148                                  FILE   *fp,
149                                  int    energies),
150 "");
151 
152 
153 DEPRECATED(void putoutpU_prob_bin_par(double            **pU,
154                                       int               length,
155                                       int               ulength,
156                                       FILE              *fp,
157                                       int               energies,
158                                       vrna_exp_param_t  *parameters),
159 "");
160 
161 
162 /**
163  *  \brief Writes the unpaired probabilities (pU) or opening energies into a binary file
164  *
165  *  Can write either the unpaired probabilities (accessibilities) pU or
166  *  the opening energies -log(pU)kT into a file
167  *
168  *  \ingroup part_func_window_deprecated
169  *
170  *  \param  pU       pair probabilities
171  *  \param  length   length of RNA sequence
172  *  \param  ulength  maximum length of unpaired stretch
173  *  \param  fp file pointer of destination file
174  *  \param  energies  switch to put out as  opening energies
175  */
176 DEPRECATED(void    putoutpU_prob_bin(double **pU,
177                                      int    length,
178                                      int    ulength,
179                                      FILE   *fp,
180                                      int    energies),
181 "");
182 
183 
184 /**
185  *  Dunno if this function was ever used by external programs linking to RNAlib, but it
186  *  was declared PUBLIC before.
187  *  Anyway, never use this function as it will be removed soon and does nothing at all
188  */
189 DEPRECATED(void init_pf_foldLP(int length),
190 "This function is obsolete");
191 
192 #endif
193 
194 #endif
195