1 #ifndef VIENNA_RNA_PACKAGE_FOLD_COMPOUND_H
2 #define VIENNA_RNA_PACKAGE_FOLD_COMPOUND_H
3 
4 /**
5  *  @file     fold_compound.h
6  *  @ingroup  fold_compound
7  *  @brief    The Basic Fold Compound API
8  */
9 
10 /**
11  *  @addtogroup   fold_compound   The Fold Compound
12  *  @{
13  *
14  *  @brief  This module provides interfaces that deal with the most basic data structure used
15  *          in structure predicting and energy evaluating function of the RNAlib.
16  *
17  *          Throughout the entire RNAlib, the #vrna_fold_compound_t, is used to group
18  *          information and data that is required for structure prediction and energy evaluation.
19  *          Here, you'll find interface functions to create, modify, and delete #vrna_fold_compound_t
20  *          data structures.
21  */
22 
23 /**
24  *  @brief Typename for the fold_compound data structure #vrna_fc_s
25  */
26 typedef struct vrna_fc_s vrna_fold_compound_t;
27 
28 /**
29  *  @brief Callback to free memory allocated for auxiliary user-provided data
30  *
31  *  This type of user-implemented function usually deletes auxiliary data structures.
32  *  The user must take care to free all the memory occupied by the data structure passed.
33  *
34  *  @callback
35  *  @parblock
36  *  This callback is supposed to free memory occupied by an auxiliary data structure.
37  *  It will be called when the #vrna_fold_compound_t is erased from memory through a
38  *  call to vrna_fold_compound_free() and will be passed the address of memory previously
39  *  bound to the #vrna_fold_compound_t via vrna_fold_compound_add_auxdata().
40  *  @endparblock
41  *
42  *  @see vrna_fold_compound_add_auxdata(), vrna_fold_compound_free(), vrna_fold_compound_add_callback()
43  *
44  *  @param data    The data that needs to be free'd
45  */
46 typedef void (vrna_callback_free_auxdata)(void *data);
47 
48 /**
49  *  @brief Callback to perform specific user-defined actions before, or after recursive computations
50  *
51  *  @callback
52  *  @parblock
53  *  This function will be called to notify a third-party implementation about the status of
54  *  a currently ongoing recursion. The purpose of this callback mechanism is to provide users
55  *  with a simple way to ensure pre- and post conditions for auxiliary mechanisms attached to
56  *  our implementations.
57  *  @endparblock
58  *
59  *  @see vrna_fold_compound_add_auxdata(), vrna_fold_compound_add_callback(), vrna_mfe(),
60  *       vrna_pf(),
61  *       #VRNA_STATUS_MFE_PRE, #VRNA_STATUS_MFE_POST, #VRNA_STATUS_PF_PRE, #VRNA_STATUS_PF_POST
62  *
63  *  @param status   The status indicator
64  *  @param data     The data structure that was assigned with vrna_fold_compound_add_auxdata()
65  *  @param status   The status indicator
66  */
67 typedef void (vrna_callback_recursion_status)(unsigned char status,
68                                               void          *data);
69 
70 /**
71  *  @brief  Status message indicating that MFE computations are about to begin
72  *
73  *  @see  #vrna_fold_compound_t.stat_cb, vrna_callback_recursion_status(), vrna_mfe(), vrna_fold(), vrna_circfold(),
74  *        vrna_alifold(), vrna_circalifold(), vrna_cofold()
75  */
76 #define VRNA_STATUS_MFE_PRE     (unsigned char)1
77 
78 /**
79  *  @brief  Status message indicating that MFE computations are finished
80  *
81  *  @see  #vrna_fold_compound_t.stat_cb, vrna_callback_recursion_status(), vrna_mfe(), vrna_fold(), vrna_circfold(),
82  *        vrna_alifold(), vrna_circalifold(), vrna_cofold()
83  */
84 #define VRNA_STATUS_MFE_POST    (unsigned char)2
85 
86 /**
87  *  @brief  Status message indicating that Partition function computations are about to begin
88  *
89  *  @see  #vrna_fold_compound_t.stat_cb, vrna_callback_recursion_status(), vrna_pf()
90  */
91 #define VRNA_STATUS_PF_PRE      (unsigned char)3
92 
93 /**
94  *  @brief  Status message indicating that Partition function computations are finished
95  *
96  *  @see  #vrna_fold_compound_t.stat_cb, vrna_callback_recursion_status(), vrna_pf()
97  */
98 #define VRNA_STATUS_PF_POST     (unsigned char)4
99 
100 
101 #include <ViennaRNA/model.h>
102 #include <ViennaRNA/params/basic.h>
103 #include <ViennaRNA/sequence.h>
104 #include <ViennaRNA/dp_matrices.h>
105 #include <ViennaRNA/constraints/hard.h>
106 #include <ViennaRNA/constraints/soft.h>
107 #include <ViennaRNA/grammar.h>
108 #include <ViennaRNA/structured_domains.h>
109 #include <ViennaRNA/unstructured_domains.h>
110 
111 #ifdef VRNA_WITH_SVM
112 #include <ViennaRNA/zscore.h>
113 #endif
114 
115 
116 /**
117  *  @brief  An enumerator that is used to specify the type of a #vrna_fold_compound_t
118  */
119 typedef enum {
120   VRNA_FC_TYPE_SINGLE,      /**< Type is suitable for single, and hybridizing sequences */
121   VRNA_FC_TYPE_COMPARATIVE  /**< Type is suitable for sequence alignments (consensus structure prediction) */
122 } vrna_fc_type_e;
123 
124 
125 /**
126  *  @brief  The most basic data structure required by many functions throughout the RNAlib
127  *
128  *  @note   Please read the documentation of this data structure carefully! Some attributes are only available for
129  *  specific types this data structure can adopt.
130  *
131  *  @warning  Reading/Writing from/to attributes that are not within the scope of the current type usually result
132  *  in undefined behavior!
133  *
134  *  @see  #vrna_fold_compound_t.type, vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_fold_compound_free(),
135  *        #VRNA_FC_TYPE_SINGLE, #VRNA_FC_TYPE_COMPARATIVE
136  */
137 struct vrna_fc_s {
138   /**
139    *  @name Common data fields
140    *  @{
141    */
142   const vrna_fc_type_e type;        /**<  @brief  The type of the #vrna_fold_compound_t.
143                                      * @details Currently possible values are #VRNA_FC_TYPE_SINGLE, and #VRNA_FC_TYPE_COMPARATIVE
144                                      * @warning Do not edit this attribute, it will be automagically set by
145                                      *      the corresponding get() methods for the #vrna_fold_compound_t.
146                                      *      The value specified in this attribute dictates the set of other
147                                      *      attributes to use within this data structure.
148                                      */
149   unsigned int      length;         /**<  @brief  The length of the sequence (or sequence alignment) */
150   int               cutpoint;       /**<  @brief  The position of the (cofold) cutpoint within the provided sequence.
151                                      * If there is no cutpoint, this field will be set to -1
152                                      */
153 
154   unsigned int      *strand_number; /**<  @brief  The strand number a particular nucleotide is associated with */
155   unsigned int      *strand_order;  /**<  @brief  The strand order, i.e. permutation of current concatenated sequence */
156   unsigned int      *strand_start;  /**<  @brief  The start position of a particular strand within the current concatenated sequence */
157   unsigned int      *strand_end;    /**<  @brief  The end (last) position of a particular strand within the current concatenated sequence */
158 
159   unsigned int      strands;
160   vrna_seq_t        *nucleotides;
161   vrna_msa_t        *alignment;
162 
163   vrna_hc_t         *hc;            /**<  @brief  The hard constraints data structure used for structure prediction */
164 
165   vrna_mx_mfe_t     *matrices;      /**<  @brief  The MFE DP matrices */
166   vrna_mx_pf_t      *exp_matrices;  /**<  @brief  The PF DP matrices  */
167 
168   vrna_param_t      *params;        /**<  @brief  The precomputed free energy contributions for each type of loop */
169   vrna_exp_param_t  *exp_params;    /**<  @brief  The precomputed free energy contributions as Boltzmann factors  */
170 
171   int               *iindx;         /**<  @brief  DP matrix accessor  */
172   int               *jindx;         /**<  @brief  DP matrix accessor  */
173 
174   /**
175    *  @}
176    *
177    *  @name User-defined data fields
178    *  @{
179    */
180   vrna_callback_recursion_status  *stat_cb;       /**<  @brief  Recursion status callback (usually called just before, and
181                                                    *            after recursive computations in the library
182                                                    *    @see    vrna_callback_recursion_status(), vrna_fold_compound_add_callback()
183                                                    */
184 
185   void                            *auxdata;       /**<  @brief  A pointer to auxiliary, user-defined data
186                                                    *    @see vrna_fold_compound_add_auxdata(), #vrna_fold_compound_t.free_auxdata
187                                                    */
188 
189   vrna_callback_free_auxdata      *free_auxdata;  /**<  @brief A callback to free auxiliary user data whenever the fold_compound itself is free'd
190                                                    *    @see  #vrna_fold_compound_t.auxdata, vrna_callback_free_auxdata()
191                                                    */
192 
193   /**
194    *  @}
195    *
196    *  @name Secondary Structure Decomposition (grammar) related data fields
197    *  @{
198    */
199 
200   /* data structure to adjust additional structural domains, such as G-quadruplexes */
201   vrna_sd_t     *domains_struc;             /**<  @brief  Additional structured domains */
202 
203   /* data structure to adjust additional contributions to unpaired stretches, e.g. due to protein binding */
204   vrna_ud_t     *domains_up;                /**<  @brief  Additional unstructured domains */
205 
206   /* auxiliary (user-defined) extension to the folding grammar */
207   vrna_gr_aux_t *aux_grammar;
208 
209   /**
210    *  @}
211    */
212 
213 #ifndef VRNA_DISABLE_C11_FEATURES
214   /* C11 support for unnamed unions/structs */
215   union {
216     struct {
217 #endif
218 
219   /**
220    *  @name Data fields available for single/hybrid structure prediction
221    *  @{
222    */
223       char *sequence;                   /**<  @brief  The input sequence string
224                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
225                                          */
226       short *sequence_encoding;         /**<  @brief  Numerical encoding of the input sequence
227                                          *    @see    vrna_sequence_encode()
228                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
229                                          */
230   short *sequence_encoding2;
231       char *ptype;                      /**<  @brief  Pair type array
232                                          *
233                                          *    Contains the numerical encoding of the pair type for each pair (i,j) used
234                                          *    in MFE, Partition function and Evaluation computations.
235                                          *    @note This array is always indexed via jindx, in contrast to previously
236                                          *    different indexing between mfe and pf variants!
237                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
238                                          *    @see    vrna_idx_col_wise(), vrna_ptypes()
239                                          */
240       char *ptype_pf_compat;            /**<  @brief  ptype array indexed via iindx
241                                          *    @deprecated  This attribute will vanish in the future!
242                                          *    It's meant for backward compatibility only!
243                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
244                                          */
245       vrna_sc_t *sc;                    /**<  @brief  The soft constraints for usage in structure prediction and evaluation
246                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
247                                          */
248 
249   /**
250    *  @}
251    */
252 
253 #ifndef VRNA_DISABLE_C11_FEATURES
254   /* C11 support for unnamed unions/structs */
255 };
256 struct {
257 #endif
258 
259   /**
260    *  @name Data fields for consensus structure prediction
261    *  @{
262    */
263       char          **sequences;        /**<  @brief  The aligned sequences
264                                          *    @note   The end of the alignment is indicated by a NULL pointer in the second dimension
265                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
266                                          */
267       unsigned int  n_seq;              /**<  @brief  The number of sequences in the alignment
268                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
269                                          */
270       char          *cons_seq;          /**<  @brief  The consensus sequence of the aligned sequences
271                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
272                                          */
273       short         *S_cons;            /**<  @brief  Numerical encoding of the consensus sequence
274                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
275                                          */
276       short         **S;                /**<  @brief  Numerical encoding of the sequences in the alignment
277                                          *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
278                                          */
279       short         **S5;               /**<  @brief    S5[s][i] holds next base 5' of i in sequence s
280                                          *    @warning  Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
281                                          */
282       short         **S3;               /**<  @brief    Sl[s][i] holds next base 3' of i in sequence s
283                                          *    @warning  Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
284                                          */
285   char          **Ss;
286   unsigned int  **a2s;
287       int           *pscore;              /**<  @brief  Precomputed array of pair types expressed as pairing scores
288                                            *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
289                                            */
290       int           **pscore_local;       /**<  @brief  Precomputed array of pair types expressed as pairing scores
291                                            *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
292                                            */
293       short         *pscore_pf_compat;    /**<  @brief  Precomputed array of pair types expressed as pairing scores indexed via iindx
294                                            *    @deprecated  This attribute will vanish in the future!
295                                            *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
296                                            */
297       vrna_sc_t     **scs;                /**<  @brief  A set of soft constraints (for each sequence in the alignment)
298                                            *    @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
299                                            */
300   int           oldAliEn;
301 
302   /**
303    *  @}
304    */
305 #ifndef VRNA_DISABLE_C11_FEATURES
306 };
307 };
308 #endif
309 
310   /**
311    *  @name Additional data fields for Distance Class Partitioning
312    *
313    *  These data fields are typically populated with meaningful data only if used in the context of Distance Class Partitioning
314    *  @{
315    */
316   unsigned int  maxD1;            /**<  @brief  Maximum allowed base pair distance to first reference */
317   unsigned int  maxD2;            /**<  @brief  Maximum allowed base pair distance to second reference */
318   short         *reference_pt1;   /**<  @brief  A pairtable of the first reference structure */
319   short         *reference_pt2;   /**<  @brief  A pairtable of the second reference structure */
320 
321   unsigned int  *referenceBPs1;   /**<  @brief  Matrix containing number of basepairs of reference structure1 in interval [i,j] */
322   unsigned int  *referenceBPs2;   /**<  @brief  Matrix containing number of basepairs of reference structure2 in interval [i,j] */
323   unsigned int  *bpdist;          /**<  @brief  Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j] */
324 
325   unsigned int  *mm1;             /**<  @brief  Maximum matching matrix, reference struct 1 disallowed */
326   unsigned int  *mm2;             /**<  @brief  Maximum matching matrix, reference struct 2 disallowed */
327 
328   /**
329    *  @}
330    */
331 
332   /**
333    *  @name Additional data fields for local folding
334    *
335    *  These data fields are typically populated with meaningful data only if used in the context of local folding
336    *  @{
337    */
338   int   window_size;              /**<  @brief  window size for local folding sliding window approach */
339   char  **ptype_local;            /**<  @brief  Pair type array (for local folding) */
340 #ifdef VRNA_WITH_SVM
341   vrna_zsc_dat_t  zscore_data;
342 #endif
343 
344   /**
345    *  @}
346    */
347 };
348 
349 
350 /* the definitions below should be used for functions that return/receive/destroy fold compound data structures */
351 
352 /**
353  *  @brief  Option flag to specify default settings/requirements
354  */
355 #define VRNA_OPTION_DEFAULT         0U
356 
357 /**
358  *  @brief  Option flag to specify requirement of Minimum Free Energy (MFE) DP matrices
359  *          and corresponding set of energy parameters
360  *
361  *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), #VRNA_OPTION_EVAL_ONLY
362  */
363 #define VRNA_OPTION_MFE             1U
364 
365 /**
366  *  @brief  Option flag to specify requirement of Partition Function (PF) DP matrices
367  *          and corresponding set of Boltzmann factors
368  *
369  *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), #VRNA_OPTION_EVAL_ONLY
370  */
371 #define VRNA_OPTION_PF              2U
372 
373 /**
374  *  @brief  Option flag to specify requirement of dimer DP matrices
375  */
376 #define VRNA_OPTION_HYBRID          4U
377 
378 /**
379  *  @brief  Option flag to specify that neither MFE, nor PF DP matrices are required
380  *
381  *  Use this flag in conjuntion with #VRNA_OPTION_MFE, and #VRNA_OPTION_PF to save
382  *  memory for a #vrna_fold_compound_t obtained from vrna_fold_compound(), or vrna_fold_compound_comparative()
383  *  in cases where only energy evaluation but no structure prediction is required.
384  *
385  *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_eval_structure()
386  */
387 #define VRNA_OPTION_EVAL_ONLY       8U
388 
389 /**
390  *  @brief  Option flag to specify requirement of DP matrices for local folding approaches
391  */
392 #define VRNA_OPTION_WINDOW          16U
393 
394 /**
395  *  @brief  Retrieve a #vrna_fold_compound_t data structure for single sequences and hybridizing sequences
396  *
397  *  This function provides an easy interface to obtain a prefilled #vrna_fold_compound_t by passing a single
398  *  sequence, or two contatenated sequences as input. For the latter, sequences need to be seperated by
399  *  an '&' character like this: @verbatim char *sequence = "GGGG&CCCC"; @endverbatim
400  *
401  *  The optional parameter @p md_p can be used to specify the model details for successive computations
402  *  based on the content of the generated #vrna_fold_compound_t. Passing NULL will instruct the function
403  *  to use default model details.
404  *  The third parameter @p options may be used to specify dynamic programming (DP) matrix requirements.
405  *
406  *  #### Options ####
407  *  * #VRNA_OPTION_DEFAULT  - @copybrief #VRNA_OPTION_DEFAULT
408  *  * #VRNA_OPTION_MFE      - @copybrief #VRNA_OPTION_MFE
409  *  * #VRNA_OPTION_PF       - @copybrief #VRNA_OPTION_PF
410  *  * #VRNA_OPTION_WINDOW   - @copybrief #VRNA_OPTION_WINDOW
411  *
412  *  The above options may be OR-ed together.
413  *
414  *  If you just need the folding compound serving as a container for your data, you can simply pass
415  *  #VRNA_OPTION_DEFAULT to the @p option parameter. This creates a #vrna_fold_compound_t without DP
416  *  matrices, thus saving memory. Subsequent calls of any structure prediction function will then take
417  *  care of allocating the memory required for the DP matrices.
418  *  If you only intend to evaluate structures instead of actually predicting them, you may use the
419  *  #VRNA_OPTION_EVAL_ONLY macro. This will seriously speedup the creation of the #vrna_fold_compound_t.
420  *
421  *  @note The sequence string must be uppercase, and should contain only RNA (resp. DNA) alphabet depending
422  *        on what energy parameter set is used
423  *
424  *  @see  vrna_fold_compound_free(), vrna_fold_compound_comparative(), #vrna_md_t
425  *
426  *  @param    sequence    A single sequence, or two concatenated sequences seperated by an '&' character
427  *  @param    md_p        An optional set of model details
428  *  @param    options     The options for DP matrices memory allocation
429  *  @return               A prefilled vrna_fold_compound_t ready to be used for computations (may be @p NULL on error)
430  */
431 vrna_fold_compound_t *
432 vrna_fold_compound(const char       *sequence,
433                    const vrna_md_t  *md_p,
434                    unsigned int     options);
435 
436 
437 /**
438  *  @brief  Retrieve a #vrna_fold_compound_t data structure for sequence alignments
439  *
440  *  This function provides an easy interface to obtain a prefilled #vrna_fold_compound_t by passing an
441  *  alignment of sequences.
442  *
443  *  The optional parameter @p md_p can be used to specify the model details for successive computations
444  *  based on the content of the generated #vrna_fold_compound_t. Passing NULL will instruct the function
445  *  to use default model details.
446  *  The third parameter @p options may be used to specify dynamic programming (DP) matrix requirements.
447  *
448  *  #### Options ####
449  *  * #VRNA_OPTION_DEFAULT  - @copybrief #VRNA_OPTION_DEFAULT
450  *  * #VRNA_OPTION_MFE      - @copybrief #VRNA_OPTION_MFE
451  *  * #VRNA_OPTION_PF       - @copybrief #VRNA_OPTION_PF
452  *  * #VRNA_OPTION_WINDOW   - @copybrief #VRNA_OPTION_WINDOW
453  *
454  *  The above options may be OR-ed together.
455  *
456  *  If you just need the folding compound serving as a container for your data, you can simply pass
457  *  #VRNA_OPTION_DEFAULT to the @p option parameter. This creates a #vrna_fold_compound_t without DP
458  *  matrices, thus saving memory. Subsequent calls of any structure prediction function will then take
459  *  care of allocating the memory required for the DP matrices.
460  *  If you only intend to evaluate structures instead of actually predicting them, you may use the
461  *  #VRNA_OPTION_EVAL_ONLY macro. This will seriously speedup the creation of the #vrna_fold_compound_t.
462  *
463  *  @note The sequence strings must be uppercase, and should contain only RNA (resp. DNA) alphabet including
464  *        gap characters depending on what energy parameter set is used.
465  *
466  *  @see  vrna_fold_compound_free(), vrna_fold_compound(), #vrna_md_t, #VRNA_OPTION_MFE, #VRNA_OPTION_PF,
467  *        #VRNA_OPTION_EVAL_ONLY, read_clustal()
468  *
469  *  @param    sequences   A sequence alignment including 'gap' characters
470  *  @param    md_p        An optional set of model details
471  *  @param    options     The options for DP matrices memory allocation
472  *  @return               A prefilled vrna_fold_compound_t ready to be used for computations (may be @p NULL on error)
473  */
474 vrna_fold_compound_t *
475 vrna_fold_compound_comparative(const char   **sequences,
476                                vrna_md_t    *md_p,
477                                unsigned int options);
478 
479 
480 vrna_fold_compound_t *
481 vrna_fold_compound_comparative2(const char                **sequences,
482                                 const char                **names,
483                                 const unsigned char       *orientation,
484                                 const unsigned long long  *start,
485                                 const unsigned long long  *genome_size,
486                                 vrna_md_t                 *md_p,
487                                 unsigned int              options);
488 
489 
490 vrna_fold_compound_t *
491 vrna_fold_compound_TwoD(const char    *sequence,
492                         const char    *s1,
493                         const char    *s2,
494                         vrna_md_t     *md_p,
495                         unsigned int  options);
496 
497 
498 int
499 vrna_fold_compound_prepare(vrna_fold_compound_t *fc,
500                            unsigned int         options);
501 
502 
503 /**
504  *  @brief  Free memory occupied by a #vrna_fold_compound_t
505  *
506  *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_mx_mfe_free(), vrna_mx_pf_free()
507  *
508  *  @param  fc  The #vrna_fold_compound_t that is to be erased from memory
509  */
510 void
511 vrna_fold_compound_free(vrna_fold_compound_t *fc);
512 
513 
514 /**
515  *  @brief  Add auxiliary data to the #vrna_fold_compound_t
516  *
517  *  This function allows one to bind arbitrary data to a #vrna_fold_compound_t which may later on be used
518  *  by one of the callback functions, e.g. vrna_callback_recursion_status(). To allow for proper cleanup
519  *  of the memory occupied by this auxiliary data, the user may also provide a pointer to a cleanup function
520  *  that free's the corresponding memory. This function will be called automatically when the #vrna_fold_compound_t
521  *  is free'd with vrna_fold_compound_free().
522  *
523  *  @note Before attaching the arbitrary data pointer, this function will call the vrna_callback_free_auxdata()
524  *        on any pre-existing data that is already attached.
525  *
526  *  @see vrna_callback_free_auxdata()
527  *  @param  fc    The fold_compound the arbitrary data pointer should be associated with
528  *  @param  data  A pointer to an arbitrary data structure
529  *  @param  f     A pointer to function that free's memory occupied by the arbitrary data (May be NULL)
530  */
531 void
532 vrna_fold_compound_add_auxdata(vrna_fold_compound_t       *fc,
533                                void                       *data,
534                                vrna_callback_free_auxdata *f);
535 
536 
537 /**
538  *  @brief  Add a recursion status callback to the #vrna_fold_compound_t
539  *
540  *  Binding a recursion status callback function to a #vrna_fold_compound_t allows one to perform
541  *  arbitrary operations just before, or after an actual recursive computations, e.g. MFE prediction,
542  *  is performed by the RNAlib. The callback function will be provided with a pointer to its
543  *  #vrna_fold_compound_t, and a status message. Hence, it has complete access to all variables that
544  *  incluence the recursive computations.
545  *
546  *  @see  vrna_callback_recursion_status(), #vrna_fold_compound_t,
547  *        #VRNA_STATUS_MFE_PRE, #VRNA_STATUS_MFE_POST, #VRNA_STATUS_PF_PRE, #VRNA_STATUS_PF_POST
548  *
549  *  @param  fc    The fold_compound the callback function should be attached to
550  *  @param  f     The pointer to the recursion status callback function
551  */
552 void
553 vrna_fold_compound_add_callback(vrna_fold_compound_t            *fc,
554                                 vrna_callback_recursion_status  *f);
555 
556 
557 /**
558  *  @}
559  */
560 
561 #endif
562