25c5ab01476cebc5ca33bbd4cfa1ed3da109476a
[jabaws.git] / binaries / src / ViennaRNA / doc / latex / group__pf__fold.tex
1 \hypertarget{group__pf__fold}{
2 \section{Calculating Partition Functions and Pair Probabilities}
3 \label{group__pf__fold}\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
4 }
5
6
7 This section provides information about all functions and variables related to the calculation of the partition function and base pair probabilities.  
8
9
10 Collaboration diagram for Calculating Partition Functions and Pair Probabilities:\nopagebreak
11 \begin{figure}[H]
12 \begin{center}
13 \leavevmode
14 \includegraphics[width=420pt]{group__pf__fold}
15 \end{center}
16 \end{figure}
17 \subsection*{Modules}
18 \begin{DoxyCompactItemize}
19 \item 
20 \hyperlink{group__mea__fold}{Compute the structure with maximum expected accuracy (MEA)}
21 \item 
22 \hyperlink{group__centroid__fold}{Compute the centroid structure}
23 \item 
24 \hyperlink{group__pf__cofold}{Partition Function for two hybridized Sequences}
25
26
27 \begin{DoxyCompactList}\small\item\em Partition Function Cofolding. \item\end{DoxyCompactList}\item 
28 \hyperlink{group__up__cofold}{Partition Function for two hybridized Sequences as a stepwise Process}
29
30
31 \begin{DoxyCompactList}\small\item\em Partition Function Cofolding as a stepwise process. \item\end{DoxyCompactList}\item 
32 \hyperlink{group__consensus__pf__fold}{Partition Function and Base Pair Probabilities for Sequence Alignment(s)}
33 \item 
34 \hyperlink{group__local__pf__fold}{Partition functions for locally stable secondary structures}
35 \item 
36 \hyperlink{group__kl__neighborhood__pf}{Calculate Partition Functions of a Distance Based Partitioning}
37
38
39 \begin{DoxyCompactList}\small\item\em Compute the partition function and stochastically sample secondary structures for a partitioning of the secondary structure space according to the base pair distance to two fixed reference structures. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
40 \subsection*{Functions}
41 \begin{DoxyCompactItemize}
42 \item 
43 float \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par} (const char $\ast$sequence, char $\ast$structure, \hyperlink{structpf__paramT}{pf\_\-paramT} $\ast$parameters, int calculate\_\-bppm, int is\_\-constrained, int is\_\-circular)
44 \begin{DoxyCompactList}\small\item\em Compute the partition function $Q$ for a given RNA sequence. \item\end{DoxyCompactList}\item 
45 float \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold} (const char $\ast$sequence, char $\ast$structure)
46 \begin{DoxyCompactList}\small\item\em Compute the partition function $Q$ of an RNA sequence. \item\end{DoxyCompactList}\item 
47 float \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold} (const char $\ast$sequence, char $\ast$structure)
48 \begin{DoxyCompactList}\small\item\em Compute the partition function of a circular RNA sequence. \item\end{DoxyCompactList}\item 
49 void \hyperlink{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{free\_\-pf\_\-arrays} (void)
50 \begin{DoxyCompactList}\small\item\em Free arrays for the partition function recursions. \item\end{DoxyCompactList}\item 
51 void \hyperlink{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}{update\_\-pf\_\-params} (int length)
52 \begin{DoxyCompactList}\small\item\em Recalculate energy parameters. \item\end{DoxyCompactList}\item 
53 \hypertarget{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}{
54 void \hyperlink{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}{update\_\-pf\_\-params\_\-par} (int length, \hyperlink{structpf__paramT}{pf\_\-paramT} $\ast$parameters)}
55 \label{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}
56
57 \begin{DoxyCompactList}\small\item\em Recalculate energy parameters. \item\end{DoxyCompactList}\item 
58 double $\ast$ \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm} (void)
59 \begin{DoxyCompactList}\small\item\em Get a pointer to the base pair probability array
60
61 Accessing the base pair probabilities for a pair (i,j) is achieved by. \item\end{DoxyCompactList}\item 
62 void \hyperlink{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}{assign\_\-plist\_\-from\_\-pr} (\hyperlink{structplist}{plist} $\ast$$\ast$pl, double $\ast$probs, int length, double cutoff)
63 \begin{DoxyCompactList}\small\item\em Create a \hyperlink{structplist}{plist} from a probability matrix. \item\end{DoxyCompactList}\item 
64 int \hyperlink{group__pf__fold_ga18607e79e106cad827f482eedd2f632e}{get\_\-pf\_\-arrays} (short $\ast$$\ast$S\_\-p, short $\ast$$\ast$S1\_\-p, char $\ast$$\ast$ptype\_\-p, double $\ast$$\ast$qb\_\-p, double $\ast$$\ast$qm\_\-p, double $\ast$$\ast$q1k\_\-p, double $\ast$$\ast$qln\_\-p)
65 \begin{DoxyCompactList}\small\item\em Get the pointers to (almost) all relavant computation arrays used in partition function computation. \item\end{DoxyCompactList}\item 
66 double \hyperlink{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}{mean\_\-bp\_\-distance} (int length)
67 \begin{DoxyCompactList}\small\item\em Get the mean base pair distance of the last partition function computation. \item\end{DoxyCompactList}\item 
68 double \hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\_\-bp\_\-distance\_\-pr} (int length, double $\ast$\hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr})
69 \begin{DoxyCompactList}\small\item\em Get the mean base pair distance in the thermodynamic ensemble. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
70
71
72 \subsection{Detailed Description}
73 This section provides information about all functions and variables related to the calculation of the partition function and base pair probabilities. Instead of the minimum free energy structure the partition function of all possible structures and from that the pairing probability for every possible pair can be calculated, using a dynamic programming algorithm as described in  mccaskill:1990. 
74
75 \subsection{Function Documentation}
76 \hypertarget{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{
77 \index{pf\_\-fold@{pf\_\-fold}!pf\_\-fold\_\-par@{pf\_\-fold\_\-par}}
78 \index{pf\_\-fold\_\-par@{pf\_\-fold\_\-par}!pf_fold@{pf\_\-fold}}
79 \subsubsection[{pf\_\-fold\_\-par}]{\setlength{\rightskip}{0pt plus 5cm}float pf\_\-fold\_\-par (const char $\ast$ {\em sequence}, \/  char $\ast$ {\em structure}, \/  {\bf pf\_\-paramT} $\ast$ {\em parameters}, \/  int {\em calculate\_\-bppm}, \/  int {\em is\_\-constrained}, \/  int {\em is\_\-circular})}}
80 \label{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}
81
82
83 Compute the partition function $Q$ for a given RNA sequence. If {\itshape structure\/} is not a NULL pointer on input, it contains on return a string consisting of the letters \char`\"{} . , $|$ \{ \} ( ) \char`\"{} denoting bases that are essentially unpaired, weakly paired, strongly paired without preference, weakly upstream (downstream) paired, or strongly up-\/ (down-\/)stream paired bases, respectively. If \hyperlink{fold__vars_8h_a0afc287c2464866d94858c39175154af}{fold\_\-constrained} is not 0, the {\itshape structure\/} string is interpreted on input as a list of constraints for the folding. The character \char`\"{}x\char`\"{} marks bases that must be unpaired, matching brackets \char`\"{} ( ) \char`\"{} denote base pairs, all other characters are ignored. Any pairs conflicting with the constraint will be forbidden. This is usually sufficient to ensure the constraints are honored. If tha parameter calculate\_\-bppm is set to 0 base pairing probabilities will not be computed (saving CPU time), otherwise after calculations took place \hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr} will contain the probability that bases {\itshape i\/} and {\itshape j\/} pair.
84
85 \begin{DoxyNote}{Note}
86 The global array \hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr} is deprecated and the user who wants the calculated base pair probabilities for further computations is advised to use the function \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm()} 
87 \end{DoxyNote}
88 \begin{DoxyPostcond}{Postcondition}
89 After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors. Depending on whether the global variable \hyperlink{fold__vars_8h_ad512b5dd4dbec60faccfe137bb474489}{do\_\-backtrack} was set the base pair probabilities are already computed and may be accessed for further usage via the \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm()} function. A call of \hyperlink{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{free\_\-pf\_\-arrays()} will free all memory allocated by this function. Successive calls will first free previously allocated memory before starting the computation. 
90 \end{DoxyPostcond}
91 \begin{DoxySeeAlso}{See also}
92 \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()}, \hyperlink{part__func_8h_a1f562d463c14d4703d9656056200eb38}{bppm\_\-to\_\-structure()}, \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm()}, \hyperlink{group__energy__parameters_ga6fc2f3eef5a3024d44963ac59a42e39d}{get\_\-boltzmann\_\-factors()}, \hyperlink{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{free\_\-pf\_\-arrays()} 
93 \end{DoxySeeAlso}
94
95 \begin{DoxyParams}{Parameters}
96 \item[\mbox{$\leftarrow$} {\em sequence}]The RNA sequence input \item[\mbox{$\leftrightarrow$} {\em 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) \item[\mbox{$\leftarrow$} {\em parameters}]Data structure containing the precalculated Boltzmann factors \item[\mbox{$\leftarrow$} {\em calculate\_\-bppm}]Switch to Base pair probability calculations on/off (0==off) \item[\mbox{$\leftarrow$} {\em is\_\-constrained}]Switch to indicate that a structure contraint is passed via the structure argument (0==off) \item[\mbox{$\leftarrow$} {\em is\_\-circular}]Switch to (de-\/)activate postprocessing steps in case RNA sequence is circular (0==off) \end{DoxyParams}
97 \begin{DoxyReturn}{Returns}
98 The Gibbs free energy of the ensemble ($G = -RT \cdot \log(Q) $) in kcal/mol 
99 \end{DoxyReturn}
100 \hypertarget{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{
101 \index{pf\_\-fold@{pf\_\-fold}!pf\_\-fold@{pf\_\-fold}}
102 \index{pf\_\-fold@{pf\_\-fold}!pf_fold@{pf\_\-fold}}
103 \subsubsection[{pf\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}float pf\_\-fold (const char $\ast$ {\em sequence}, \/  char $\ast$ {\em structure})}}
104 \label{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}
105
106
107 Compute the partition function $Q$ of an RNA sequence. If {\itshape structure\/} is not a NULL pointer on input, it contains on return a string consisting of the letters \char`\"{} . , $|$ \{ \} ( ) \char`\"{} denoting bases that are essentially unpaired, weakly paired, strongly paired without preference, weakly upstream (downstream) paired, or strongly up-\/ (down-\/)stream paired bases, respectively. If \hyperlink{fold__vars_8h_a0afc287c2464866d94858c39175154af}{fold\_\-constrained} is not 0, the {\itshape structure\/} string is interpreted on input as a list of constraints for the folding. The character \char`\"{}x\char`\"{} marks bases that must be unpaired, matching brackets \char`\"{} ( ) \char`\"{} denote base pairs, all other characters are ignored. Any pairs conflicting with the constraint will be forbidden. This is usually sufficient to ensure the constraints are honored. If \hyperlink{fold__vars_8h_ad512b5dd4dbec60faccfe137bb474489}{do\_\-backtrack} has been set to 0 base pairing probabilities will not be computed (saving CPU time), otherwise \hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr} will contain the probability that bases {\itshape i\/} and {\itshape j\/} pair.
108
109 \begin{DoxyNote}{Note}
110 The global array \hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr} is deprecated and the user who wants the calculated base pair probabilities for further computations is advised to use the function \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm()}. 
111
112 {\bfseries OpenMP:} This function is not entirely threadsafe. While the recursions are working on their own copies of data the model details for the recursions are determined from the global settings just before entering the recursions. Consider using \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()} for a really threadsafe implementation. 
113 \end{DoxyNote}
114 \begin{DoxyPrecond}{Precondition}
115 This function takes its model details from the global variables provided in {\itshape RNAlib\/} 
116 \end{DoxyPrecond}
117 \begin{DoxyPostcond}{Postcondition}
118 After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors. Depending on whether the global variable \hyperlink{fold__vars_8h_ad512b5dd4dbec60faccfe137bb474489}{do\_\-backtrack} was set the base pair probabilities are already computed and may be accessed for further usage via the \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm()} function. A call of \hyperlink{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{free\_\-pf\_\-arrays()} will free all memory allocated by this function. Successive calls will first free previously allocated memory before starting the computation. 
119 \end{DoxyPostcond}
120 \begin{DoxySeeAlso}{See also}
121 \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()}, \hyperlink{part__func_8h_a1f562d463c14d4703d9656056200eb38}{bppm\_\-to\_\-structure()}, \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm()} 
122 \end{DoxySeeAlso}
123
124 \begin{DoxyParams}{Parameters}
125 \item[{\em sequence}]The RNA sequence input \item[{\em 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) \end{DoxyParams}
126 \begin{DoxyReturn}{Returns}
127 The Gibbs free energy of the ensemble ($G = -RT \cdot \log(Q) $) in kcal/mol 
128 \end{DoxyReturn}
129 \hypertarget{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{
130 \index{pf\_\-fold@{pf\_\-fold}!pf\_\-circ\_\-fold@{pf\_\-circ\_\-fold}}
131 \index{pf\_\-circ\_\-fold@{pf\_\-circ\_\-fold}!pf_fold@{pf\_\-fold}}
132 \subsubsection[{pf\_\-circ\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}float pf\_\-circ\_\-fold (const char $\ast$ {\em sequence}, \/  char $\ast$ {\em structure})}}
133 \label{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}
134
135
136 Compute the partition function of a circular RNA sequence. \begin{DoxyNote}{Note}
137 The global array \hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr} is deprecated and the user who wants the calculated base pair probabilities for further computations is advised to use the function \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm()}. 
138
139 {\bfseries OpenMP:} This function is not entirely threadsafe. While the recursions are working on their own copies of data the model details for the recursions are determined from the global settings just before entering the recursions. Consider using \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()} for a really threadsafe implementation. 
140 \end{DoxyNote}
141 \begin{DoxyPrecond}{Precondition}
142 This function takes its model details from the global variables provided in {\itshape RNAlib\/} 
143 \end{DoxyPrecond}
144 \begin{DoxyPostcond}{Postcondition}
145 After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors. Depending on whether the global variable \hyperlink{fold__vars_8h_ad512b5dd4dbec60faccfe137bb474489}{do\_\-backtrack} was set the base pair probabilities are already computed and may be accessed for further usage via the \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm()} function. A call of \hyperlink{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{free\_\-pf\_\-arrays()} will free all memory allocated by this function. Successive calls will first free previously allocated memory before starting the computation. 
146 \end{DoxyPostcond}
147 \begin{DoxySeeAlso}{See also}
148 \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()} 
149 \end{DoxySeeAlso}
150
151 \begin{DoxyParams}{Parameters}
152 \item[\mbox{$\leftarrow$} {\em sequence}]The RNA sequence input \item[\mbox{$\leftrightarrow$} {\em 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) \end{DoxyParams}
153 \begin{DoxyReturn}{Returns}
154 The Gibbs free energy of the ensemble ($G = -RT \cdot \log(Q) $) in kcal/mol 
155 \end{DoxyReturn}
156 \hypertarget{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{
157 \index{pf\_\-fold@{pf\_\-fold}!free\_\-pf\_\-arrays@{free\_\-pf\_\-arrays}}
158 \index{free\_\-pf\_\-arrays@{free\_\-pf\_\-arrays}!pf_fold@{pf\_\-fold}}
159 \subsubsection[{free\_\-pf\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}void free\_\-pf\_\-arrays (void)}}
160 \label{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}
161
162
163 Free arrays for the partition function recursions. Call this function if you want to free all allocated memory associated with the partition function forward recursion. \begin{DoxyNote}{Note}
164 Successive calls of \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()} already check if they should free any memory from a previous run. 
165
166 {\bfseries OpenMP notice:}\par
167  This function should be called before leaving a thread in order to avoid leaking memory
168 \end{DoxyNote}
169 \begin{DoxyPostcond}{Postcondition}
170 All memory allocated by \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()} or \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()} will be free'd 
171 \end{DoxyPostcond}
172 \begin{DoxySeeAlso}{See also}
173 \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()} 
174 \end{DoxySeeAlso}
175 \hypertarget{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}{
176 \index{pf\_\-fold@{pf\_\-fold}!update\_\-pf\_\-params@{update\_\-pf\_\-params}}
177 \index{update\_\-pf\_\-params@{update\_\-pf\_\-params}!pf_fold@{pf\_\-fold}}
178 \subsubsection[{update\_\-pf\_\-params}]{\setlength{\rightskip}{0pt plus 5cm}void update\_\-pf\_\-params (int {\em length})}}
179 \label{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}
180
181
182 Recalculate energy parameters. Call this function to recalculate the pair matrix and energy parameters after a change in folding parameters like \hyperlink{fold__vars_8h_ab4b11c8d9c758430960896bc3fe82ead}{temperature} \hypertarget{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{
183 \index{pf\_\-fold@{pf\_\-fold}!export\_\-bppm@{export\_\-bppm}}
184 \index{export\_\-bppm@{export\_\-bppm}!pf_fold@{pf\_\-fold}}
185 \subsubsection[{export\_\-bppm}]{\setlength{\rightskip}{0pt plus 5cm}double$\ast$ export\_\-bppm (void)}}
186 \label{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}
187
188
189 Get a pointer to the base pair probability array
190
191 Accessing the base pair probabilities for a pair (i,j) is achieved by. 
192
193 \begin{footnotesize}\begin{alltt}
194   FLT\_OR\_DBL *pr  = \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export_bppm}();
195   pr\_ij           = pr[iindx[i]-j];
196 \end{alltt}\end{footnotesize}
197
198
199 \begin{DoxyPrecond}{Precondition}
200 Call \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()} or \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()} first to fill the base pair probability array
201 \end{DoxyPrecond}
202 \begin{DoxySeeAlso}{See also}
203 \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()}, \hyperlink{utils_8h_a55c0f6b3b07b6adf2ee235ba901fe397}{get\_\-iindx()}
204 \end{DoxySeeAlso}
205 \begin{DoxyReturn}{Returns}
206 A pointer to the base pair probability array 
207 \end{DoxyReturn}
208 \hypertarget{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}{
209 \index{pf\_\-fold@{pf\_\-fold}!assign\_\-plist\_\-from\_\-pr@{assign\_\-plist\_\-from\_\-pr}}
210 \index{assign\_\-plist\_\-from\_\-pr@{assign\_\-plist\_\-from\_\-pr}!pf_fold@{pf\_\-fold}}
211 \subsubsection[{assign\_\-plist\_\-from\_\-pr}]{\setlength{\rightskip}{0pt plus 5cm}void assign\_\-plist\_\-from\_\-pr ({\bf plist} $\ast$$\ast$ {\em pl}, \/  double $\ast$ {\em probs}, \/  int {\em length}, \/  double {\em cutoff})}}
212 \label{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}
213
214
215 Create a \hyperlink{structplist}{plist} from a probability matrix. The probability matrix given is parsed and all pair probabilities above the given threshold are used to create an entry in the \hyperlink{structplist}{plist}
216
217 The end of the \hyperlink{structplist}{plist} is marked by sequence positions i as well as j equal to 0. This condition should be used to stop looping over its entries
218
219 \begin{DoxyNote}{Note}
220 This function is threadsafe
221 \end{DoxyNote}
222
223 \begin{DoxyParams}{Parameters}
224 \item[\mbox{$\rightarrow$} {\em pl}]A pointer to the \hyperlink{structplist}{plist} that is to be created \item[\mbox{$\leftarrow$} {\em probs}]The probability matrix used for creting the \hyperlink{structplist}{plist} \item[\mbox{$\leftarrow$} {\em length}]The length of the RNA sequence \item[\mbox{$\leftarrow$} {\em cutoff}]The cutoff value \end{DoxyParams}
225 \hypertarget{group__pf__fold_ga18607e79e106cad827f482eedd2f632e}{
226 \index{pf\_\-fold@{pf\_\-fold}!get\_\-pf\_\-arrays@{get\_\-pf\_\-arrays}}
227 \index{get\_\-pf\_\-arrays@{get\_\-pf\_\-arrays}!pf_fold@{pf\_\-fold}}
228 \subsubsection[{get\_\-pf\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}int get\_\-pf\_\-arrays (short $\ast$$\ast$ {\em S\_\-p}, \/  short $\ast$$\ast$ {\em S1\_\-p}, \/  char $\ast$$\ast$ {\em ptype\_\-p}, \/  double $\ast$$\ast$ {\em qb\_\-p}, \/  double $\ast$$\ast$ {\em qm\_\-p}, \/  double $\ast$$\ast$ {\em q1k\_\-p}, \/  double $\ast$$\ast$ {\em qln\_\-p})}}
229 \label{group__pf__fold_ga18607e79e106cad827f482eedd2f632e}
230
231
232 Get the pointers to (almost) all relavant computation arrays used in partition function computation. \begin{DoxyPrecond}{Precondition}
233 In order to assign meaningful pointers, you have to call \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()} or \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()} first! 
234 \end{DoxyPrecond}
235 \begin{DoxySeeAlso}{See also}
236 \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()} 
237 \end{DoxySeeAlso}
238
239 \begin{DoxyParams}{Parameters}
240 \item[\mbox{$\rightarrow$} {\em S\_\-p}]A pointer to the 'S' array (integer representation of nucleotides) \item[\mbox{$\rightarrow$} {\em S1\_\-p}]A pointer to the 'S1' array (2nd integer representation of nucleotides) \item[\mbox{$\rightarrow$} {\em ptype\_\-p}]A pointer to the pair type matrix \item[\mbox{$\rightarrow$} {\em qb\_\-p}]A pointer to the Q$^{\mbox{B}}$  matrix \item[\mbox{$\rightarrow$} {\em qm\_\-p}]A pointer to the Q$^{\mbox{M}}$  matrix \item[\mbox{$\rightarrow$} {\em q1k\_\-p}]A pointer to the 5' slice of the Q matrix ($q1k(k) = Q(1, k)$) \item[\mbox{$\rightarrow$} {\em qln\_\-p}]A pointer to the 3' slice of the Q matrix ($qln(l) = Q(l, n)$) \end{DoxyParams}
241 \begin{DoxyReturn}{Returns}
242 Non Zero if everything went fine, 0 otherwise 
243 \end{DoxyReturn}
244 \hypertarget{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}{
245 \index{pf\_\-fold@{pf\_\-fold}!mean\_\-bp\_\-distance@{mean\_\-bp\_\-distance}}
246 \index{mean\_\-bp\_\-distance@{mean\_\-bp\_\-distance}!pf_fold@{pf\_\-fold}}
247 \subsubsection[{mean\_\-bp\_\-distance}]{\setlength{\rightskip}{0pt plus 5cm}double mean\_\-bp\_\-distance (int {\em length})}}
248 \label{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}
249
250
251 Get the mean base pair distance of the last partition function computation. \begin{DoxyNote}{Note}
252 To ensure thread-\/safety, use the function \hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\_\-bp\_\-distance\_\-pr()} instead!
253 \end{DoxyNote}
254 \begin{DoxySeeAlso}{See also}
255 \hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\_\-bp\_\-distance\_\-pr()}
256 \end{DoxySeeAlso}
257
258 \begin{DoxyParams}{Parameters}
259 \item[{\em length}]\end{DoxyParams}
260 \begin{DoxyReturn}{Returns}
261 mean base pair distance in thermodynamic ensemble 
262 \end{DoxyReturn}
263 \hypertarget{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{
264 \index{pf\_\-fold@{pf\_\-fold}!mean\_\-bp\_\-distance\_\-pr@{mean\_\-bp\_\-distance\_\-pr}}
265 \index{mean\_\-bp\_\-distance\_\-pr@{mean\_\-bp\_\-distance\_\-pr}!pf_fold@{pf\_\-fold}}
266 \subsubsection[{mean\_\-bp\_\-distance\_\-pr}]{\setlength{\rightskip}{0pt plus 5cm}double mean\_\-bp\_\-distance\_\-pr (int {\em length}, \/  double $\ast$ {\em pr})}}
267 \label{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}
268
269
270 Get the mean base pair distance in the thermodynamic ensemble. This is a threadsafe implementation of \hyperlink{part__func_8h_ae9556ba7ded44fe2321b6f67c3fc02a3}{mean\_\-bp\_\-dist()} !
271
272 $<d> = \sum_{a,b} p_a p_b d(S_a,S_b)$\par
273  this can be computed from the pair probs $p_ij$ as\par
274  $<d> = \sum_{ij} p_{ij}(1-p_{ij})$
275
276 \begin{DoxyNote}{Note}
277 This function is threadsafe
278 \end{DoxyNote}
279
280 \begin{DoxyParams}{Parameters}
281 \item[{\em length}]The length of the sequence \item[{\em pr}]The matrix containing the base pair probabilities \end{DoxyParams}
282 \begin{DoxyReturn}{Returns}
283 The mean pair distance of the structure ensemble 
284 \end{DoxyReturn}