1 #ifndef VIENNA_RNA_PACKAGE_PART_FUNC_CO_H 2 #define VIENNA_RNA_PACKAGE_PART_FUNC_CO_H 3 4 #ifdef VRNA_WARN_DEPRECATED 5 # if defined(__clang__) 6 # define DEPRECATED(func, msg) func __attribute__ ((deprecated("", msg))) 7 # elif defined(__GNUC__) 8 # define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg))) 9 # else 10 # define DEPRECATED(func, msg) func 11 # endif 12 #else 13 # define DEPRECATED(func, msg) func 14 #endif 15 16 /** 17 * @file part_func_co.h 18 * @ingroup part_func_global_deprecated 19 * @brief Partition function for two RNA sequences 20 */ 21 22 /** 23 * @addtogroup pf_cofold 24 * @{ 25 * 26 * @brief Partition Function Cofolding 27 * 28 * To simplify the implementation the partition function computation is done 29 * internally in a null model that does not include the duplex initiation 30 * energy, i.e. the entropic penalty for producing a dimer from two 31 * monomers). The resulting free energies and pair probabilities are initially 32 * relative to that null model. In a second step the free energies can be 33 * corrected to include the dimerization penalty, and the pair probabilities 34 * can be divided into the conditional pair probabilities given that a re 35 * dimer is formed or not formed. See @cite bernhart:2006 for further details. 36 * 37 * As for folding one RNA molecule, this computes the partition function 38 * of all possible structures and the base pair probabilities. Uses the 39 * same global #pf_scale variable to avoid overflows. 40 * 41 * After computing the partition functions of all possible dimeres one 42 * can compute the probabilities of base pairs, the concentrations out of 43 * start concentrations and sofar and soaway. 44 * 45 * Dimer formation is inherently concentration dependent. Given the free 46 * energies of the monomers A and B and dimers AB, AA, and BB one can compute 47 * the equilibrium concentrations, given input concentrations of A and B, see 48 * e.g. Dimitrov & Zuker (2004) 49 * 50 */ 51 52 #include <ViennaRNA/datastructures/basic.h> 53 #include <ViennaRNA/params/basic.h> 54 #include <ViennaRNA/part_func.h> 55 #include <ViennaRNA/equilibrium_probs.h> 56 #include <ViennaRNA/concentrations.h> 57 #include <ViennaRNA/utils/structures.h> 58 59 /** 60 * @brief Toggles no intrabp in 2nd mol 61 */ 62 extern int mirnatog; 63 64 /** 65 * @brief Free energies of the two monomers 66 */ 67 extern double F_monomer[2]; 68 69 /** 70 * @} 71 */ 72 73 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY 74 75 /* 76 ################################################# 77 # DEPRECATED FUNCTIONS # 78 ################################################# 79 */ 80 81 /** 82 * @brief Calculate partition function and base pair probabilities 83 * 84 * This is the cofold partition function folding. The second molecule starts 85 * at the #cut_point nucleotide. 86 * 87 * @note OpenMP: Since this function relies on the global parameters 88 * #do_backtrack, #dangles, #temperature and #pf_scale it is not 89 * threadsafe according to concurrent changes in these variables! 90 * Use co_pf_fold_par() instead to circumvent this issue. 91 * 92 * @deprecated{Use vrna_pf_dimer() instead!} 93 * 94 * @ingroup part_func_global_deprecated 95 * 96 * @param sequence Concatenated RNA sequences 97 * @param structure Will hold the structure or constraints 98 * @return vrna_dimer_pf_t structure containing a set of energies needed for 99 * concentration computations. 100 */ 101 DEPRECATED(vrna_dimer_pf_t co_pf_fold(char *sequence, 102 char *structure), 103 "Use vrna_pf_co_fold() or vrna_pf_dimer() instead"); 104 105 /** 106 * @brief Calculate partition function and base pair probabilities 107 * 108 * This is the cofold partition function folding. The second molecule starts 109 * at the #cut_point nucleotide. 110 * 111 * @deprecated Use vrna_pf_dimer() instead! 112 * 113 * @see get_boltzmann_factors(), co_pf_fold() 114 * 115 * @ingroup part_func_global_deprecated 116 * 117 * @param sequence Concatenated RNA sequences 118 * @param structure Pointer to the structure constraint 119 * @param parameters Data structure containing the precalculated Boltzmann factors 120 * @param calculate_bppm Switch to turn Base pair probability calculations on/off (0==off) 121 * @param is_constrained Switch to indicate that a structure contraint is passed via the 122 * structure argument (0==off) 123 * @return vrna_dimer_pf_t structure containing a set of energies needed for 124 * concentration computations. 125 */ 126 DEPRECATED(vrna_dimer_pf_t co_pf_fold_par(char *sequence, 127 char *structure, 128 vrna_exp_param_t *parameters, 129 int calculate_bppm, 130 int is_constrained), 131 "Use the new API and vrna_pf_dimer() instead"); 132 133 /** 134 * DO NOT USE THIS FUNCTION ANYMORE 135 * @deprecated{ This function is deprecated and will be removed soon!} 136 * use assign_plist_from_pr() instead! 137 */ 138 DEPRECATED(vrna_ep_t *get_plist(vrna_ep_t *pl, 139 int length, 140 double cut_off), 141 "Use vrna_plist() and vrna_plist_from_probs() instead"); 142 143 /** 144 * @brief Compute Boltzmann probabilities of dimerization without homodimers 145 * 146 * Given the pair probabilities and free energies (in the null model) for a 147 * dimer AB and the two constituent monomers A and B, compute the conditional pair 148 * probabilities given that a dimer AB actually forms. 149 * Null model pair probabilities are given as a list as produced by 150 * assign_plist_from_pr(), the dimer probabilities 'prAB' are modified in place. 151 * 152 * @deprecated{ Use vrna_pf_dimer_probs() instead!} 153 * 154 * @ingroup part_func_global_deprecated 155 * 156 * @param FAB free energy of dimer AB 157 * @param FEA free energy of monomer A 158 * @param FEB free energy of monomer B 159 * @param prAB pair probabilities for dimer 160 * @param prA pair probabilities monomer 161 * @param prB pair probabilities monomer 162 * @param Alength Length of molecule A 163 */ 164 DEPRECATED(void compute_probabilities(double FAB, 165 double FEA, 166 double FEB, 167 vrna_ep_t *prAB, 168 vrna_ep_t *prA, 169 vrna_ep_t *prB, 170 int Alength), 171 "Use vrna_pf_dimer_probs() instead"); 172 173 /** 174 * DO NOT USE THIS FUNCTION ANYMORE 175 * @deprecated{ This function is deprecated and will be removed soon!} 176 * @ingroup part_func_global_deprecated 177 */ 178 DEPRECATED(void init_co_pf_fold(int length), 179 "This function is obsolete"); 180 181 /** 182 * @brief Get a pointer to the base pair probability array 183 * 184 * Accessing the base pair probabilities for a pair (i,j) is achieved by 185 * @verbatim FLT_OR_DBL *pr = export_bppm(); pr_ij = pr[iindx[i]-j]; @endverbatim 186 * 187 * @deprecated This function is deprecated and will be removed soon! The base pair 188 * probability array is available through the #vrna_fold_compound_t data 189 * structure, and its associated #vrna_mx_pf_t member. 190 * 191 * @ingroup part_func_global_deprecated 192 * 193 * @see vrna_idx_row_wise() 194 * @return A pointer to the base pair probability array 195 */ 196 DEPRECATED(FLT_OR_DBL *export_co_bppm(void), 197 "Use the new API with vrna_fold_compound_t instead"); 198 199 /** 200 * @brief Free the memory occupied by co_pf_fold() 201 * 202 * @deprecated This function will be removed for the new API soon! 203 * See vrna_pf_dimer(), vrna_fold_compound(), and 204 * vrna_fold_compound_free() for an alternative 205 * @ingroup part_func_global_deprecated 206 */ 207 DEPRECATED(void free_co_pf_arrays(void), 208 "This function is obsolete"); 209 210 /** 211 * @brief Recalculate energy parameters 212 * 213 * This function recalculates all energy parameters given 214 * the current model settings. 215 * 216 * @deprecated Use vrna_exp_params_subst() instead! 217 * 218 * @ingroup part_func_global_deprecated 219 * 220 * @param length Length of the current RNA sequence 221 */ 222 DEPRECATED(void update_co_pf_params(int length), 223 "This function is obsolete"); 224 225 /** 226 * @brief Recalculate energy parameters 227 * 228 * This function recalculates all energy parameters given 229 * the current model settings. 230 * It's second argument can either be NULL or a data structure 231 * containing the precomputed Boltzmann factors. In the first 232 * scenario, the necessary data structure will be created automatically 233 * according to the current global model settings, i.e. this 234 * mode might not be threadsafe. 235 * However, if the provided data structure is not NULL, threadsafety 236 * for the model parameters #dangles, #pf_scale and #temperature is regained, since their 237 * values are taken from this data structure during subsequent calculations. 238 * 239 * @deprecated Use vrna_exp_params_subst() instead! 240 * 241 * @ingroup part_func_global_deprecated 242 * 243 * @param length Length of the current RNA sequence 244 * @param parameters data structure containing the precomputed Boltzmann factors 245 */ 246 DEPRECATED(void update_co_pf_params_par(int length, 247 vrna_exp_param_t *parameters), 248 "Use the new API with vrna_fold_compound_t instead"); 249 250 #endif 251 252 #endif 253