1 #ifndef VIENNA_RNA_PACKAGE_PART_FUNC_H
2 #define VIENNA_RNA_PACKAGE_PART_FUNC_H
3 
4 /**
5  *  @brief Typename for the data structure that stores the dimer partition functions, #vrna_dimer_pf_s, as returned by vrna_pf_dimer()
6  *  @ingroup  pf_cofold
7  */
8 typedef struct vrna_dimer_pf_s vrna_dimer_pf_t;
9 
10 
11 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
12 
13 /**
14  *  @brief Backward compatibility typedef for #vrna_dimer_pf_s
15  *  @ingroup  pf_cofold
16  */
17 typedef struct vrna_dimer_pf_s cofoldF;
18 
19 #endif
20 
21 
22 #include <ViennaRNA/datastructures/basic.h>
23 #include <ViennaRNA/fold_compound.h>
24 #include <ViennaRNA/utils/structures.h>
25 #include <ViennaRNA/params/basic.h>
26 #include <ViennaRNA/centroid.h>
27 #include <ViennaRNA/equilibrium_probs.h>
28 #include <ViennaRNA/boltzmann_sampling.h>
29 
30 #ifdef VRNA_WARN_DEPRECATED
31 # if defined(__clang__)
32 #  define DEPRECATED(func, msg) func __attribute__ ((deprecated("", msg)))
33 # elif defined(__GNUC__)
34 #  define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
35 # else
36 #  define DEPRECATED(func, msg) func
37 # endif
38 #else
39 # define DEPRECATED(func, msg) func
40 #endif
41 
42 /**
43  *  @file     part_func.h
44  *  @ingroup  pf_fold, part_func_global
45  *  @brief    Partition function implementations
46  *
47  *  This file includes (almost) all function declarations within the <b>RNAlib</b> that are related to
48  *  Partion function computations
49  */
50 
51 /*
52  #################################################
53  # PARTITION FUNCTION COMPUTATION                #
54  #################################################
55  */
56 
57 /**
58  *  @addtogroup pf_fold
59  *  @{
60  *  @brief Compute the partition function to assess various equilibrium properties
61  *
62  *  Similar to our @ref mfe, we provide two different flavors for partition
63  *  function computations:
64  *  * @ref part_func_global - to compute the partition function for a full length sequence
65  *  * @ref part_func_window - to compute the partition function of each window using a sliding window approach
66  *
67  *  While the global partition function approach supports predictions using single sequences as
68  *  well as consensus partition functions for multiple sequence alignments (MSA), we currently
69  *  do not support MSA input for the local variant.
70  *
71  *  Comparative prediction computes an average of the free energy contributions plus an additional
72  *  covariance pseudo-energy term, exactly as we do for the @ref mfe implementation.
73  *
74  *  Boltzmann weights for the free energy contributions of individual loops can be
75  *  found in @ref eval_loops.
76  *
77  *  Our implementations also provide a stochastic backtracking procedure to draw
78  *  @ref subopt_stochbt according to their equilibrium probabilty.
79  *  @}
80  */
81 
82 
83 /**
84  *  @addtogroup part_func_global
85  *  @{
86  *  @brief  Variations of the global partition function algorithm
87  *
88  *  We provide implementations of the global partition function algorithm for
89  *  * Single sequences,
90  *  * Multiple sequence alignments (MSA), and
91  *  * RNA-RNA hybrids
92  */
93 
94 /**
95  *  @brief  Data structure returned by vrna_pf_dimer()
96  */
97 struct vrna_dimer_pf_s {
98   /* free energies for: */
99   double  F0AB; /**< @brief Null model without DuplexInit */
100   double  FAB;  /**< @brief all states with DuplexInit correction */
101   double  FcAB; /**< @brief true hybrid states only */
102   double  FA;   /**< @brief monomer A */
103   double  FB;   /**< @brief monomer B */
104 };
105 
106 /**
107  *  @name Basic global partition function interface
108  *  @{
109  */
110 
111 /**
112  *  @brief Compute the partition function @f$Q@f$ for a given RNA sequence, or sequence alignment
113  *
114  *  If @a structure is not a NULL pointer on input, it contains on
115  *  return a string consisting of the letters " . , | { } ( ) " denoting
116  *  bases that are essentially unpaired, weakly paired, strongly paired without
117  *  preference, weakly upstream (downstream) paired, or strongly up-
118  *  (down-)stream paired bases, respectively.
119  *  If the model's compute_bpp is set to 0 base pairing probabilities will not
120  *  be computed (saving CPU time), otherwise after calculations took place #pr will
121  *  contain the probability that bases @a i and @a j pair.
122  *
123  *  @note This function is polymorphic. It accepts #vrna_fold_compound_t of type
124  *        #VRNA_FC_TYPE_SINGLE, and #VRNA_FC_TYPE_COMPARATIVE.
125  *
126  *  @note This function may return #INF / 100. in case of contradicting constraints
127  *        or numerical over-/underflow. In the latter case, a corresponding warning
128  *        will be issued to @p stdout.
129  *
130  *  @see #vrna_fold_compound_t, vrna_fold_compound(), vrna_pf_fold(), vrna_pf_circfold(),
131  *        vrna_fold_compound_comparative(), vrna_pf_alifold(), vrna_pf_circalifold(),
132  *        vrna_db_from_probs(), vrna_exp_params(), vrna_aln_pinfo()
133  *
134  *  @param[in,out]  vc              The fold compound data structure
135  *  @param[in,out]  structure       A pointer to the character array where position-wise pairing propensity
136  *                                  will be stored. (Maybe NULL)
137  *  @return         The ensemble free energy @f$G = -RT \cdot \log(Q) @f$ in kcal/mol
138  */
139 float
140 vrna_pf(vrna_fold_compound_t  *vc,
141         char                  *structure);
142 
143 
144 /**
145  *  @brief  Calculate partition function and base pair probabilities of
146  *          nucleic acid/nucleic acid dimers
147  *
148  *  This is the cofold partition function folding.
149  *
150  *  @note This function may return #INF / 100. for the @p FA, @p FB, @p FAB, @p F0AB
151  *        members of the output data structure in case of contradicting constraints
152  *        or numerical over-/underflow. In the latter case, a corresponding warning
153  *        will be issued to @p stdout.
154  *
155  *  @see    vrna_fold_compound() for how to retrieve the necessary data structure
156  *
157  *  @param  vc        the fold compound data structure
158  *  @param  structure Will hold the structure or constraints
159  *  @return           vrna_dimer_pf_t structure containing a set of energies needed for
160  *                    concentration computations.
161  */
162 vrna_dimer_pf_t
163 vrna_pf_dimer(vrna_fold_compound_t  *vc,
164               char                  *structure);
165 
166 
167 /* End basic global interface */
168 /**@}*/
169 
170 /**
171  *  @name Simplified global partition function computation using sequence(s) or multiple sequence alignment(s)
172  *  @{
173  */
174 
175 /**
176  *  @brief  Compute Partition function @f$Q@f$ (and base pair probabilities) for an RNA
177  *          sequence using a comparative method
178  *
179  *  This simplified interface to vrna_pf() computes the partition function and, if required,
180  *  base pair probabilities for an RNA sequence using default options. Memory required for
181  *  dynamic programming (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of
182  *  this function, the recursively filled matrices are not available any more for any post-processing.
183  *
184  *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
185  *  you require other conditions than specified by the default model details, use vrna_pf(),
186  *  and the data structure #vrna_fold_compound_t instead.
187  *
188  *  @see vrna_pf_circfold(), vrna_pf(), vrna_fold_compound(), #vrna_fold_compound_t
189  *
190  *  @param sequence   RNA sequence
191  *  @param structure  A pointer to the character array where position-wise pairing propensity
192  *                    will be stored. (Maybe NULL)
193  *  @param pl         A pointer to a list of #vrna_ep_t to store pairing probabilities (Maybe NULL)
194  *  @return           The ensemble free energy @f$G = -RT \cdot \log(Q) @f$ in kcal/mol
195  */
196 float
197 vrna_pf_fold(const char *sequence,
198              char       *structure,
199              vrna_ep_t  **pl);
200 
201 
202 /**
203  *  @brief  Compute Partition function @f$Q@f$ (and base pair probabilities) for a circular
204  *          RNA sequences using a comparative method
205  *
206  *  This simplified interface to vrna_pf() computes the partition function and, if required,
207  *  base pair probabilities for a circular RNA sequence using default options. Memory required for
208  *  dynamic programming (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of
209  *  this function, the recursively filled matrices are not available any more for any post-processing.
210  *
211  *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
212  *  you require other conditions than specified by the default model details, use vrna_pf(),
213  *  and the data structure #vrna_fold_compound_t instead.
214  *
215  *  Folding of circular RNA sequences is handled as a post-processing step of the forward
216  *  recursions. See @cite hofacker:2006 for further details.
217  *
218  *  @see vrna_pf_fold(), vrna_pf(), vrna_fold_compound(), #vrna_fold_compound_t
219  *
220  *  @param sequence  A circular RNA sequence
221  *  @param structure  A pointer to the character array where position-wise pairing propensity
222  *                    will be stored. (Maybe NULL)
223  *  @param pl         A pointer to a list of #vrna_ep_t to store pairing probabilities (Maybe NULL)
224  *  @return           The ensemble free energy @f$G = -RT \cdot \log(Q) @f$ in kcal/mol
225  */
226 float
227 vrna_pf_circfold(const char *sequence,
228                  char       *structure,
229                  vrna_ep_t  **pl);
230 
231 
232 /**
233  *  @brief  Compute Partition function @f$Q@f$ (and base pair probabilities) for an RNA
234  *          sequence alignment using a comparative method
235  *
236  *  This simplified interface to vrna_pf() computes the partition function and, if required,
237  *  base pair probabilities for an RNA sequence alignment using default options. Memory required for
238  *  dynamic programming (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of
239  *  this function, the recursively filled matrices are not available any more for any post-processing.
240  *
241  *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
242  *  you require other conditions than specified by the default model details, use vrna_pf(),
243  *  and the data structure #vrna_fold_compound_t instead.
244  *
245  *  @see vrna_pf_circalifold(), vrna_pf(), vrna_fold_compound_comparative(), #vrna_fold_compound_t
246  *
247  *  @param sequences  RNA sequence alignment
248  *  @param structure  A pointer to the character array where position-wise pairing propensity
249  *                    will be stored. (Maybe NULL)
250  *  @param pl         A pointer to a list of #vrna_ep_t to store pairing probabilities (Maybe NULL)
251  *  @return           The ensemble free energy @f$G = -RT \cdot \log(Q) @f$ in kcal/mol
252  */
253 float
254 vrna_pf_alifold(const char  **sequences,
255                 char        *structure,
256                 vrna_ep_t   **pl);
257 
258 
259 /**
260  *  @brief  Compute Partition function @f$Q@f$ (and base pair probabilities) for an alignment
261  *          of circular RNA sequences using a comparative method
262  *
263  *  This simplified interface to vrna_pf() computes the partition function and, if required,
264  *  base pair probabilities for an RNA sequence alignment using default options. Memory required for
265  *  dynamic programming (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of
266  *  this function, the recursively filled matrices are not available any more for any post-processing.
267  *
268  *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
269  *  you require other conditions than specified by the default model details, use vrna_pf(),
270  *  and the data structure #vrna_fold_compound_t instead.
271  *
272  *  Folding of circular RNA sequences is handled as a post-processing step of the forward
273  *  recursions. See @cite hofacker:2006 for further details.
274  *
275  *  @see vrna_pf_alifold(), vrna_pf(), vrna_fold_compound_comparative(), #vrna_fold_compound_t
276  *
277  *  @param sequences  Sequence alignment of circular RNAs
278  *  @param structure  A pointer to the character array where position-wise pairing propensity
279  *                    will be stored. (Maybe NULL)
280  *  @param pl         A pointer to a list of #vrna_ep_t to store pairing probabilities (Maybe NULL)
281  *  @return           The ensemble free energy @f$G = -RT \cdot \log(Q) @f$ in kcal/mol
282  */
283 float
284 vrna_pf_circalifold(const char  **sequences,
285                     char        *structure,
286                     vrna_ep_t   **pl);
287 
288 
289 /**
290  *  @brief  Calculate partition function and base pair probabilities of
291  *          nucleic acid/nucleic acid dimers
292  *
293  *  This simplified interface to vrna_pf_dimer() computes the partition
294  *  function and, if required, base pair probabilities for an RNA-RNA
295  *  interaction using default options. Memory required for dynamic
296  *  programming (DP) matrices will be allocated and free'd on-the-fly.
297  *  Hence, after return of this function, the recursively filled matrices
298  *  are not available any more for any post-processing.
299  *
300  *  @note In case you want to use the filled DP matrices for any subsequent
301  *        post-processing step, or you require other conditions than
302  *        specified by the default model details, use vrna_pf_dimer(),
303  *        and the data structure #vrna_fold_compound_t instead.
304  *
305  *  @see  vrna_pf_dimer()
306  *
307  *  @ingroup  pf_cofold
308  *  @param seq        Two concatenated RNA sequences with a delimiting '&' in between
309  *  @param structure  A pointer to the character array where position-wise pairing propensity
310  *                    will be stored. (Maybe NULL)
311  *  @param pl         A pointer to a list of #vrna_ep_t to store pairing probabilities (Maybe NULL)
312  *  @return           vrna_dimer_pf_t structure containing a set of energies needed for
313  *                    concentration computations.
314  */
315 vrna_dimer_pf_t
316 vrna_pf_co_fold(const char  *seq,
317                 char        *structure,
318                 vrna_ep_t   **pl);
319 
320 
321 /* End simplified global interface */
322 /**@}*/
323 
324 /**@}*/
325 
326 /*
327  #################################################
328  # OTHER PARTITION FUNCTION RELATED DECLARATIONS #
329  #################################################
330  */
331 
332 /**
333  *  @brief  Find out whether partition function computations are using
334  *          single precision floating points
335  *
336  *  @ingroup  pf_fold
337  *
338  *  @see #FLT_OR_DBL
339  *  @return  1 if single precision is used, 0 otherwise
340  */
341 int
342 vrna_pf_float_precision(void);
343 
344 
345 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
346 
347 /*
348  #################################################
349  # DEPRECATED FUNCTIONS                          #
350  #################################################
351  */
352 
353 /**
354  *  @brief Flag indicating that auxilary arrays are needed throughout the computations. This is essential for stochastic backtracking
355  *
356  *  Set this variable to 1 prior to a call of pf_fold() to ensure that all matrices needed for stochastic backtracking
357  *  are filled in the forward recursions
358  *
359  *  @deprecated   set the @e uniq_ML flag in #vrna_md_t before passing it to vrna_fold_compound().
360  *
361  *  @ingroup subopt_stochbt_deprecated
362  *
363  *  @see pbacktrack(), pbacktrack_circ
364  */
365 extern int st_back;
366 
367 /**
368  *  @brief Compute the partition function @f$Q@f$ for a given RNA sequence
369  *
370  *  If @a structure is not a NULL pointer on input, it contains on
371  *  return a string consisting of the letters " . , | { } ( ) " denoting
372  *  bases that are essentially unpaired, weakly paired, strongly paired without
373  *  preference, weakly upstream (downstream) paired, or strongly up-
374  *  (down-)stream paired bases, respectively.
375  *  If #fold_constrained is not 0, the @a structure string is
376  *  interpreted on input as a list of constraints for the folding. The
377  *  character "x" marks bases that must be unpaired, matching brackets " ( ) "
378  *  denote base pairs, all other characters are ignored. Any pairs
379  *  conflicting with the constraint will be forbidden. This is usually sufficient
380  *  to ensure the constraints are honored.
381  *  If the parameter calculate_bppm is set to 0 base pairing probabilities will not
382  *  be computed (saving CPU time), otherwise after calculations took place #pr will
383  *  contain the probability that bases @a i and @a j pair.
384  *
385  *  @ingroup part_func_global_deprecated
386  *
387  *  @deprecated Use vrna_pf() instead
388  *
389  *  @note           The global array #pr is deprecated and the user who wants the calculated
390  *                  base pair probabilities for further computations is advised to use the function
391  *                  export_bppm()
392  *  @post           After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
393  *                  Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
394  *                  computed and may be accessed for further usage via the export_bppm() function.
395  *                  A call of free_pf_arrays() will free all memory allocated by this function.
396  *                  Successive calls will first free previously allocated memory before starting the computation.
397  *  @see            vrna_pf(), bppm_to_structure(), export_bppm(), vrna_exp_params(), free_pf_arrays()
398  *  @param[in]      sequence        The RNA sequence input
399  *  @param[in,out]  structure       A pointer to a char array where a base pair probability information can be stored in a
400  *                                  pseudo-dot-bracket notation (may be NULL, too)
401  *  @param[in]      parameters      Data structure containing the precalculated Boltzmann factors
402  *  @param[in]      calculate_bppm  Switch to Base pair probability calculations on/off (0==off)
403  *  @param[in]      is_constrained  Switch to indicate that a structure contraint is passed via the structure argument (0==off)
404  *  @param[in]      is_circular     Switch to (de-)activate postprocessing steps in case RNA sequence is circular (0==off)
405  *  @return         The ensemble free energy @f$G = -RT \cdot \log(Q) @f$ in kcal/mol
406  */
407 DEPRECATED(float   pf_fold_par(const char       *sequence,
408                                char             *structure,
409                                vrna_exp_param_t *parameters,
410                                int              calculate_bppm,
411                                int              is_constrained,
412                                int              is_circular),
413            "Use the new API and vrna_pf() instead");
414 
415 /**
416  *  @brief Compute the partition function @f$Q@f$ of an RNA sequence
417  *
418  *  If @a structure is not a NULL pointer on input, it contains on
419  *  return a string consisting of the letters " . , | { } ( ) " denoting
420  *  bases that are essentially unpaired, weakly paired, strongly paired without
421  *  preference, weakly upstream (downstream) paired, or strongly up-
422  *  (down-)stream paired bases, respectively.
423  *  If #fold_constrained is not 0, the @a structure string is
424  *  interpreted on input as a list of constraints for the folding. The
425  *  character "x" marks bases that must be unpaired, matching brackets " ( ) "
426  *  denote base pairs, all other characters are ignored. Any pairs
427  *  conflicting with the constraint will be forbidden. This is usually sufficient
428  *  to ensure the constraints are honored.
429  *  If #do_backtrack has been set to 0 base pairing probabilities will not
430  *  be computed (saving CPU time), otherwise #pr will contain the probability
431  *  that bases @a i and @a j pair.
432  *
433  *  @ingroup part_func_global_deprecated
434  *
435  *  @note   The global array #pr is deprecated and the user who wants the calculated
436  *          base pair probabilities for further computations is advised to use the function
437  *          export_bppm().
438  *  @note   @b OpenMP:
439  *          This function is not entirely threadsafe. While the recursions are working on their
440  *          own copies of data the model details for the recursions are determined from the global
441  *          settings just before entering the recursions. Consider using pf_fold_par() for a
442  *          really threadsafe implementation.
443  *  @pre    This function takes its model details from the global variables provided in @e RNAlib
444  *  @post   After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
445  *          Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
446  *          computed and may be accessed for further usage via the export_bppm() function.
447  *          A call of free_pf_arrays() will free all memory allocated by this function.
448  *          Successive calls will first free previously allocated memory before starting the computation.
449  *  @see    pf_fold_par(), pf_circ_fold(), bppm_to_structure(), export_bppm()
450  *  @param sequence   The RNA sequence input
451  *  @param structure  A pointer to a char array where a base pair probability information can be stored in a pseudo-dot-bracket notation (may be NULL, too)
452  *  @return           The ensemble free energy @f$G = -RT \cdot \log(Q) @f$ in kcal/mol
453  */
454 DEPRECATED(float   pf_fold(const char *sequence,
455                            char       *structure),
456            "Use vrna_pf_fold() or vrna_pf() instead");
457 
458 /**
459  *  @brief Compute the partition function of a circular RNA sequence
460  *
461  *  @ingroup part_func_global_deprecated
462  *
463  *  @note           The global array #pr is deprecated and the user who wants the calculated
464  *                  base pair probabilities for further computations is advised to use the function
465  *                  export_bppm().
466  *  @note           @b OpenMP:
467  *                  This function is not entirely threadsafe. While the recursions are working on their
468  *                  own copies of data the model details for the recursions are determined from the global
469  *                  settings just before entering the recursions. Consider using pf_fold_par() for a
470  *                  really threadsafe implementation.
471  *  @pre            This function takes its model details from the global variables provided in @e RNAlib
472  *  @post           After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
473  *                  Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
474  *                  computed and may be accessed for further usage via the export_bppm() function.
475  *                  A call of free_pf_arrays() will free all memory allocated by this function.
476  *                  Successive calls will first free previously allocated memory before starting the computation.
477  *  @see            vrna_pf()
478  *  @deprecated     Use vrna_pf() instead!
479  *  @param[in]      sequence   The RNA sequence input
480  *  @param[in,out]  structure  A pointer to a char array where a base pair probability information can be
481  *                  stored in a pseudo-dot-bracket notation (may be NULL, too)
482  *  @return         The ensemble free energy @f$G = -RT \cdot \log(Q) @f$ in kcal/mol
483  */
484 DEPRECATED(float   pf_circ_fold(const char  *sequence,
485                                 char        *structure),
486            "Use vrna_pf_circfold() or vrna_pf() instead");
487 
488 /**
489  *  @brief Sample a secondary structure from the Boltzmann ensemble according its probability
490  *
491  *  @pre    #st_back has to be set to 1 before calling pf_fold() or pf_fold_par()
492  *  @pre    pf_fold_par() or pf_fold() have to be called first to fill the partition function matrices
493  *
494  *  @ingroup subopt_stochbt_deprecated
495  *
496  *  @param  sequence  The RNA sequence
497  *  @return           A sampled secondary structure in dot-bracket notation
498  */
499 DEPRECATED(char *pbacktrack(char *sequence), "Use vrna_pbacktrack() instead");
500 
501 /**
502  *  @brief Sample a sub-structure from the Boltzmann ensemble according its probability
503  *
504  *  @ingroup subopt_stochbt_deprecated
505  */
506 DEPRECATED(char *pbacktrack5(char *sequence,
507                              int  length), "Use vrna_pbacktrack5() instead");
508 
509 /**
510  *  @brief Sample a secondary structure of a circular RNA from the Boltzmann ensemble according its probability
511  *
512  *  This function does the same as @ref pbacktrack() but assumes the RNA molecule to be circular
513  *
514  *  @pre    #st_back has to be set to 1 before calling pf_fold() or pf_fold_par()
515  *  @pre    pf_fold_par() or pf_circ_fold() have to be called first to fill the partition function matrices
516  *
517  *  @deprecated Use vrna_pbacktrack() instead.
518  *
519  *  @ingroup subopt_stochbt_deprecated
520  *
521  *  @param  sequence  The RNA sequence
522  *  @return           A sampled secondary structure in dot-bracket notation
523  */
524 DEPRECATED(char *pbacktrack_circ(char *sequence), "Use vrna_pbacktrack() instead");
525 
526 /**
527  *  @brief Free arrays for the partition function recursions
528  *
529  *  Call this function if you want to free all allocated memory associated with
530  *  the partition function forward recursion.
531  *  @note Successive calls of pf_fold(), pf_circ_fold() already check if they should free
532  *  any memory from a previous run.
533  *  @note <b>OpenMP notice:</b><br>
534  *  This function should be called before leaving a thread in order to avoid leaking memory
535  *
536  *  @deprecated See vrna_fold_compound_t and its related functions for how to free memory
537  *  occupied by the dynamic programming matrices
538  *
539  *  @ingroup part_func_global_deprecated
540  *
541  *  @post   All memory allocated by pf_fold_par(), pf_fold() or pf_circ_fold() will be free'd
542  *  @see    pf_fold_par(), pf_fold(), pf_circ_fold()
543  */
544 DEPRECATED(void  free_pf_arrays(void), "This function is obsolete");
545 
546 /**
547  *  @brief Recalculate energy parameters
548  *
549  *  Call this function to recalculate the pair matrix and energy parameters
550  *  after a change in folding parameters like #temperature
551  *
552  *  @deprecated Use vrna_exp_params_subst() instead
553  *
554  *  @ingroup part_func_global_deprecated
555  *
556  */
557 DEPRECATED(void  update_pf_params(int length), "This function is obsolete");
558 
559 /**
560  *  @brief Recalculate energy parameters
561  *
562  *  @deprecated Use vrna_exp_params_subst() instead
563  *
564  *  @ingroup part_func_global_deprecated
565  *
566  */
567 DEPRECATED(void update_pf_params_par(int              length,
568                                      vrna_exp_param_t *parameters),
569            "Use the new API with vrna_fold_compound_t instead");
570 
571 /**
572  *  @brief Get a pointer to the base pair probability array
573  *
574  *  @ingroup part_func_global_deprecated
575  *
576  *  Accessing the base pair probabilities for a pair (i,j) is achieved by
577  *  @code
578  *  FLT_OR_DBL *pr  = export_bppm();
579  *  pr_ij           = pr[iindx[i]-j];
580  *  @endcode
581  *
582  *  @pre      Call pf_fold_par(), pf_fold() or pf_circ_fold() first to fill the base pair probability array
583  *
584  *  @see pf_fold(), pf_circ_fold(), vrna_idx_row_wise()
585  *
586  *  @return A pointer to the base pair probability array
587  */
588 DEPRECATED(FLT_OR_DBL *export_bppm(void),
589            "Use the new API with vrna_fold_compound_t instead");
590 
591 
592 /**
593  *  @brief Get the pointers to (almost) all relavant computation arrays used in partition function computation
594  *
595  *  @ingroup part_func_global_deprecated
596  *
597  *  @pre        In order to assign meaningful pointers, you have to call pf_fold_par() or pf_fold() first!
598  *  @see        pf_fold_par(), pf_fold(), pf_circ_fold()
599  *  @param[out] S_p       A pointer to the 'S' array (integer representation of nucleotides)
600  *  @param[out] S1_p      A pointer to the 'S1' array (2nd integer representation of nucleotides)
601  *  @param[out] ptype_p   A pointer to the pair type matrix
602  *  @param[out] qb_p      A pointer to the Q<sup>B</sup> matrix
603  *  @param[out] qm_p      A pointer to the Q<sup>M</sup> matrix
604  *  @param[out] q1k_p     A pointer to the 5' slice of the Q matrix (@f$q1k(k) = Q(1, k)@f$)
605  *  @param[out] qln_p     A pointer to the 3' slice of the Q matrix (@f$qln(l) = Q(l, n)@f$)
606  *  @return     Non Zero if everything went fine, 0 otherwise
607  */
608 DEPRECATED(int get_pf_arrays(short      **S_p,
609                              short      **S1_p,
610                              char       **ptype_p,
611                              FLT_OR_DBL **qb_p,
612                              FLT_OR_DBL **qm_p,
613                              FLT_OR_DBL **q1k_p,
614                              FLT_OR_DBL **qln_p),
615            "Use the new API with vrna_fold_compound_t instead");
616 
617 /**
618  *  @brief Get the free energy of a subsequence from the q[] array
619  *
620  *  @ingroup part_func_global_deprecated
621  */
622 DEPRECATED(double get_subseq_F(int  i,
623                                int  j),
624            "Use the new API with vrna_fold_compound_t instead");
625 
626 
627 /**
628  *  @brief Get the mean base pair distance of the last partition function computation
629  *
630  *  @ingroup part_func_global_deprecated
631  *
632  *  @deprecated Use vrna_mean_bp_distance() or vrna_mean_bp_distance_pr() instead!
633  *  @see vrna_mean_bp_distance(), vrna_mean_bp_distance_pr()
634  *
635  *  @param    length
636  *  @return  mean base pair distance in thermodynamic ensemble
637  */
638 DEPRECATED(double  mean_bp_distance(int length),
639            "Use vrna_mean_bp_distance() or vrna_mean_bp_distance_pr() instead");
640 
641 /**
642  *  @brief Get the mean base pair distance in the thermodynamic ensemble
643  *
644  *  This is a threadsafe implementation of @ref mean_bp_dist() !
645  *
646  *  @f$<d> = \sum_{a,b} p_a p_b d(S_a,S_b)@f$\n
647  *  this can be computed from the pair probs @f$p_ij@f$ as\n
648  *  @f$<d> = \sum_{ij} p_{ij}(1-p_{ij})@f$
649  *
650  *  @deprecated Use vrna_mean_bp_distance() or vrna_mean_bp_distance_pr() instead!
651  *
652  *  @ingroup part_func_global_deprecated
653  *
654  *  @param length The length of the sequence
655  *  @param pr     The matrix containing the base pair probabilities
656  *  @return       The mean pair distance of the structure ensemble
657  */
658 DEPRECATED(double mean_bp_distance_pr(int         length,
659                                       FLT_OR_DBL  *pr),
660            "Use vrna_mean_bp_distance() or vrna_mean_bp_distance_pr() instead");
661 
662 /**
663  *  @brief  Get the probability of stacks
664  *
665  *  @deprecated   Use vrna_stack_prob() instead!
666  *
667  *  @ingroup part_func_global_deprecated
668  */
669 DEPRECATED(vrna_ep_t *stackProb(double cutoff), "Use vrna_stack_prob() instead");
670 
671 
672 /**
673  *  @brief Allocate space for pf_fold()
674  *
675  *  @deprecated This function is obsolete and will be removed soon!
676  *
677  *  @ingroup part_func_global_deprecated
678  */
679 DEPRECATED(void init_pf_fold(int length), "This function is obsolete");
680 
681 /**
682  *  @deprecated This function is deprecated and should not be used anymore as it is not threadsafe!
683  *  @see get_centroid_struct_pl(), get_centroid_struct_pr()
684  */
685 DEPRECATED(char *centroid(int     length,
686                           double  *dist),
687            "Use vrna_centroid() instead");
688 
689 /**
690  *  @deprecated This function is deprecated and should not be used anymore as it is not threadsafe!
691  *  @see vrna_centroid(), vrna_centroid_from_probs(), vrna_centroid_from_plist()
692  */
693 DEPRECATED(char *get_centroid_struct_gquad_pr(int     length,
694                                               double  *dist),
695            "Use vrna_centroid() instead");
696 
697 /**
698  *  get the mean pair distance of ensemble
699  *
700  *  @deprecated This function is not threadsafe and should not be used anymore. Use @ref mean_bp_distance() instead!
701  */
702 DEPRECATED(double mean_bp_dist(int length),
703            "Use vrna_mean_bp_distance() or vrna_mean_bp_distance_pr() instead");
704 
705 /**
706  *  @deprecated Use @ref exp_E_IntLoop() from loop_energies.h instead
707  */
708 DEPRECATED(double expLoopEnergy(int   u1,
709                                 int   u2,
710                                 int   type,
711                                 int   type2,
712                                 short si1,
713                                 short sj1,
714                                 short sp1,
715                                 short sq1),
716            "");
717 
718 /**
719  *  @deprecated Use exp_E_Hairpin() from loop_energies.h instead
720  */
721 DEPRECATED(double expHairpinEnergy(int        u,
722                                    int        type,
723                                    short      si1,
724                                    short      sj1,
725                                    const char *string),
726            "");
727 
728 /* this doesn't work if free_pf_arrays() is called before */
729 DEPRECATED(void assign_plist_gquad_from_pr(vrna_ep_t  **pl,
730                                            int        length,
731                                            double     cut_off),
732            "Use vrna_plist_from_probs() instead");
733 
734 #endif
735 
736 #endif
737