8c2a2f6caca13b148e7312643d67b526624a2aaa
[jabaws.git] / binaries / src / ViennaRNA / doc / latex / group__pf__fold.tex
1 \hypertarget{group__pf__fold}{\section{Calculating Partition Functions and Pair Probabilities}
2 \label{group__pf__fold}\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
3 }
4
5
6 This section provides information about all functions and variables related to the calculation of the partition function and base pair probabilities.  
7
8
9 Collaboration diagram for Calculating Partition Functions and Pair Probabilities\-:
10 \nopagebreak
11 \begin{figure}[H]
12 \begin{center}
13 \leavevmode
14 \includegraphics[width=350pt]{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 (\-M\-E\-A)}
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 \begin{DoxyCompactList}\small\item\em Partition Function Cofolding. \end{DoxyCompactList}\item 
26 \hyperlink{group__up__cofold}{Partition Function for two hybridized Sequences as a stepwise Process}
27 \begin{DoxyCompactList}\small\item\em Partition Function Cofolding as a stepwise process. \end{DoxyCompactList}\item 
28 \hyperlink{group__consensus__pf__fold}{Partition Function and Base Pair Probabilities for Sequence Alignment(s)}
29 \item 
30 \hyperlink{group__local__pf__fold}{Partition functions for locally stable secondary structures}
31 \item 
32 \hyperlink{group__kl__neighborhood__pf}{Calculate Partition Functions of a Distance Based Partitioning}
33 \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. \end{DoxyCompactList}\end{DoxyCompactItemize}
34 \subsection*{Files}
35 \begin{DoxyCompactItemize}
36 \item 
37 file \hyperlink{part__func_8h}{part\-\_\-func.\-h}
38 \begin{DoxyCompactList}\small\item\em Partition function of single R\-N\-A sequences. \end{DoxyCompactList}\end{DoxyCompactItemize}
39 \subsection*{Functions}
40 \begin{DoxyCompactItemize}
41 \item 
42 float \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\-\_\-fold\-\_\-par} (const char $\ast$sequence, char $\ast$structure, \hyperlink{structpf__paramT}{pf\-\_\-param\-T} $\ast$parameters, int calculate\-\_\-bppm, int is\-\_\-constrained, int is\-\_\-circular)
43 \begin{DoxyCompactList}\small\item\em Compute the partition function $Q$ for a given R\-N\-A sequence. \end{DoxyCompactList}\item 
44 float \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\-\_\-fold} (const char $\ast$sequence, char $\ast$structure)
45 \begin{DoxyCompactList}\small\item\em Compute the partition function $Q$ of an R\-N\-A sequence. \end{DoxyCompactList}\item 
46 float \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\-\_\-circ\-\_\-fold} (const char $\ast$sequence, char $\ast$structure)
47 \begin{DoxyCompactList}\small\item\em Compute the partition function of a circular R\-N\-A sequence. \end{DoxyCompactList}\item 
48 void \hyperlink{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{free\-\_\-pf\-\_\-arrays} (void)
49 \begin{DoxyCompactList}\small\item\em Free arrays for the partition function recursions. \end{DoxyCompactList}\item 
50 void \hyperlink{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}{update\-\_\-pf\-\_\-params} (int length)
51 \begin{DoxyCompactList}\small\item\em Recalculate energy parameters. \end{DoxyCompactList}\item 
52 \hypertarget{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}{void \hyperlink{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}{update\-\_\-pf\-\_\-params\-\_\-par} (int length, \hyperlink{structpf__paramT}{pf\-\_\-param\-T} $\ast$parameters)}\label{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}
53
54 \begin{DoxyCompactList}\small\item\em Recalculate energy parameters. \end{DoxyCompactList}\item 
55 double $\ast$ \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\-\_\-bppm} (void)
56 \begin{DoxyCompactList}\small\item\em Get a pointer to the base pair probability array
57
58 Accessing the base pair probabilities for a pair (i,j) is achieved by. \end{DoxyCompactList}\item 
59 void \hyperlink{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}{assign\-\_\-plist\-\_\-from\-\_\-pr} (\hyperlink{structplist}{plist} $\ast$$\ast$pl, double $\ast$probs, int length, double cutoff)
60 \begin{DoxyCompactList}\small\item\em Create a plist from a probability matrix. \end{DoxyCompactList}\item 
61 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)
62 \begin{DoxyCompactList}\small\item\em Get the pointers to (almost) all relavant computation arrays used in partition function computation. \end{DoxyCompactList}\item 
63 double \hyperlink{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}{mean\-\_\-bp\-\_\-distance} (int length)
64 \begin{DoxyCompactList}\small\item\em Get the mean base pair distance of the last partition function computation. \end{DoxyCompactList}\item 
65 double \hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\-\_\-bp\-\_\-distance\-\_\-pr} (int length, double $\ast$\hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr})
66 \begin{DoxyCompactList}\small\item\em Get the mean base pair distance in the thermodynamic ensemble. \end{DoxyCompactList}\end{DoxyCompactItemize}
67
68
69 \subsection{Detailed Description}
70 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\cite{mccaskill:1990}. 
71
72 \subsection{Function Documentation}
73 \hypertarget{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!pf\-\_\-fold\-\_\-par@{pf\-\_\-fold\-\_\-par}}
74 \index{pf\-\_\-fold\-\_\-par@{pf\-\_\-fold\-\_\-par}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
75 \subsubsection[{pf\-\_\-fold\-\_\-par}]{\setlength{\rightskip}{0pt plus 5cm}float pf\-\_\-fold\-\_\-par (
76 \begin{DoxyParamCaption}
77 \item[{const char $\ast$}]{sequence, }
78 \item[{char $\ast$}]{structure, }
79 \item[{{\bf pf\-\_\-param\-T} $\ast$}]{parameters, }
80 \item[{int}]{calculate\-\_\-bppm, }
81 \item[{int}]{is\-\_\-constrained, }
82 \item[{int}]{is\-\_\-circular}
83 \end{DoxyParamCaption}
84 )}}\label{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}
85
86
87 Compute the partition function $Q$ for a given R\-N\-A sequence. 
88
89 If {\itshape structure} is not a N\-U\-L\-L 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 C\-P\-U time), otherwise after calculations took place \hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr} will contain the probability that bases {\itshape i} and {\itshape j} pair.
90
91 \begin{DoxyNote}{Note}
92 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()} 
93 \end{DoxyNote}
94 \begin{DoxyPostcond}{Postcondition}
95 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. 
96 \end{DoxyPostcond}
97 \begin{DoxySeeAlso}{See Also}
98 \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()} 
99 \end{DoxySeeAlso}
100
101 \begin{DoxyParams}[1]{Parameters}
102 \mbox{\tt in}  & {\em sequence} & The R\-N\-A sequence input \\
103 \hline
104 \mbox{\tt in,out}  & {\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 N\-U\-L\-L, too) \\
105 \hline
106 \mbox{\tt in}  & {\em parameters} & Data structure containing the precalculated Boltzmann factors \\
107 \hline
108 \mbox{\tt in}  & {\em calculate\-\_\-bppm} & Switch to Base pair probability calculations on/off (0==off) \\
109 \hline
110 \mbox{\tt in}  & {\em is\-\_\-constrained} & Switch to indicate that a structure contraint is passed via the structure argument (0==off) \\
111 \hline
112 \mbox{\tt in}  & {\em is\-\_\-circular} & Switch to (de-\/)activate postprocessing steps in case R\-N\-A sequence is circular (0==off) \\
113 \hline
114 \end{DoxyParams}
115 \begin{DoxyReturn}{Returns}
116 The Gibbs free energy of the ensemble ( $G = -RT \cdot \log(Q) $) in kcal/mol 
117 \end{DoxyReturn}
118 \hypertarget{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!pf\-\_\-fold@{pf\-\_\-fold}}
119 \index{pf\-\_\-fold@{pf\-\_\-fold}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
120 \subsubsection[{pf\-\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}float pf\-\_\-fold (
121 \begin{DoxyParamCaption}
122 \item[{const char $\ast$}]{sequence, }
123 \item[{char $\ast$}]{structure}
124 \end{DoxyParamCaption}
125 )}}\label{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}
126
127
128 Compute the partition function $Q$ of an R\-N\-A sequence. 
129
130 If {\itshape structure} is not a N\-U\-L\-L 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 C\-P\-U time), otherwise \hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr} will contain the probability that bases {\itshape i} and {\itshape j} pair.
131
132 \begin{DoxyNote}{Note}
133 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()}. 
134
135 {\bfseries Open\-M\-P\-:} 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. 
136 \end{DoxyNote}
137 \begin{DoxyPrecond}{Precondition}
138 This function takes its model details from the global variables provided in {\itshape R\-N\-Alib} 
139 \end{DoxyPrecond}
140 \begin{DoxyPostcond}{Postcondition}
141 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. 
142 \end{DoxyPostcond}
143 \begin{DoxySeeAlso}{See Also}
144 \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()} 
145 \end{DoxySeeAlso}
146
147 \begin{DoxyParams}{Parameters}
148 {\em sequence} & The R\-N\-A sequence input \\
149 \hline
150 {\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 N\-U\-L\-L, too) \\
151 \hline
152 \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_ga819ce5fca8984004ac81c4a3b04cb735}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!pf\-\_\-circ\-\_\-fold@{pf\-\_\-circ\-\_\-fold}}
157 \index{pf\-\_\-circ\-\_\-fold@{pf\-\_\-circ\-\_\-fold}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
158 \subsubsection[{pf\-\_\-circ\-\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}float pf\-\_\-circ\-\_\-fold (
159 \begin{DoxyParamCaption}
160 \item[{const char $\ast$}]{sequence, }
161 \item[{char $\ast$}]{structure}
162 \end{DoxyParamCaption}
163 )}}\label{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}
164
165
166 Compute the partition function of a circular R\-N\-A sequence. 
167
168 \begin{DoxyNote}{Note}
169 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()}. 
170
171 {\bfseries Open\-M\-P\-:} 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. 
172 \end{DoxyNote}
173 \begin{DoxyPrecond}{Precondition}
174 This function takes its model details from the global variables provided in {\itshape R\-N\-Alib} 
175 \end{DoxyPrecond}
176 \begin{DoxyPostcond}{Postcondition}
177 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. 
178 \end{DoxyPostcond}
179 \begin{DoxySeeAlso}{See Also}
180 \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\-\_\-fold\-\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\-\_\-fold()} 
181 \end{DoxySeeAlso}
182
183 \begin{DoxyParams}[1]{Parameters}
184 \mbox{\tt in}  & {\em sequence} & The R\-N\-A sequence input \\
185 \hline
186 \mbox{\tt in,out}  & {\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 N\-U\-L\-L, too) \\
187 \hline
188 \end{DoxyParams}
189 \begin{DoxyReturn}{Returns}
190 The Gibbs free energy of the ensemble ( $G = -RT \cdot \log(Q) $) in kcal/mol 
191 \end{DoxyReturn}
192 \hypertarget{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!free\-\_\-pf\-\_\-arrays@{free\-\_\-pf\-\_\-arrays}}
193 \index{free\-\_\-pf\-\_\-arrays@{free\-\_\-pf\-\_\-arrays}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
194 \subsubsection[{free\-\_\-pf\-\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}void free\-\_\-pf\-\_\-arrays (
195 \begin{DoxyParamCaption}
196 \item[{void}]{}
197 \end{DoxyParamCaption}
198 )}}\label{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}
199
200
201 Free arrays for the partition function recursions. 
202
203 Call this function if you want to free all allocated memory associated with the partition function forward recursion. \begin{DoxyNote}{Note}
204 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. 
205
206 {\bfseries Open\-M\-P notice\-:}\par
207  This function should be called before leaving a thread in order to avoid leaking memory
208 \end{DoxyNote}
209 \begin{DoxyPostcond}{Postcondition}
210 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 
211 \end{DoxyPostcond}
212 \begin{DoxySeeAlso}{See Also}
213 \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\-\_\-fold\-\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\-\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\-\_\-circ\-\_\-fold()} 
214 \end{DoxySeeAlso}
215 \hypertarget{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!update\-\_\-pf\-\_\-params@{update\-\_\-pf\-\_\-params}}
216 \index{update\-\_\-pf\-\_\-params@{update\-\_\-pf\-\_\-params}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
217 \subsubsection[{update\-\_\-pf\-\_\-params}]{\setlength{\rightskip}{0pt plus 5cm}void update\-\_\-pf\-\_\-params (
218 \begin{DoxyParamCaption}
219 \item[{int}]{length}
220 \end{DoxyParamCaption}
221 )}}\label{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}
222
223
224 Recalculate energy parameters. 
225
226 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}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!export\-\_\-bppm@{export\-\_\-bppm}}
227 \index{export\-\_\-bppm@{export\-\_\-bppm}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
228 \subsubsection[{export\-\_\-bppm}]{\setlength{\rightskip}{0pt plus 5cm}double$\ast$ export\-\_\-bppm (
229 \begin{DoxyParamCaption}
230 \item[{void}]{}
231 \end{DoxyParamCaption}
232 )}}\label{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}
233
234
235 Get a pointer to the base pair probability array
236
237 Accessing the base pair probabilities for a pair (i,j) is achieved by. 
238
239
240 \begin{DoxyCode}
241 FLT\_OR\_DBL *pr  = \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_bppm}();
242 pr\_ij           = pr[iindx[i]-j];
243 \end{DoxyCode}
244
245
246 \begin{DoxyPrecond}{Precondition}
247 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
248 \end{DoxyPrecond}
249 \begin{DoxySeeAlso}{See Also}
250 \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\-\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\-\_\-circ\-\_\-fold()}, \hyperlink{utils_8h_a55c0f6b3b07b6adf2ee235ba901fe397}{get\-\_\-iindx()}
251 \end{DoxySeeAlso}
252 \begin{DoxyReturn}{Returns}
253 A pointer to the base pair probability array 
254 \end{DoxyReturn}
255 \hypertarget{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!assign\-\_\-plist\-\_\-from\-\_\-pr@{assign\-\_\-plist\-\_\-from\-\_\-pr}}
256 \index{assign\-\_\-plist\-\_\-from\-\_\-pr@{assign\-\_\-plist\-\_\-from\-\_\-pr}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
257 \subsubsection[{assign\-\_\-plist\-\_\-from\-\_\-pr}]{\setlength{\rightskip}{0pt plus 5cm}void assign\-\_\-plist\-\_\-from\-\_\-pr (
258 \begin{DoxyParamCaption}
259 \item[{{\bf plist} $\ast$$\ast$}]{pl, }
260 \item[{double $\ast$}]{probs, }
261 \item[{int}]{length, }
262 \item[{double}]{cutoff}
263 \end{DoxyParamCaption}
264 )}}\label{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}
265
266
267 Create a plist from a probability matrix. 
268
269 The probability matrix given is parsed and all pair probabilities above the given threshold are used to create an entry in the plist
270
271 The end of the 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
272
273 \begin{DoxyNote}{Note}
274 This function is threadsafe
275 \end{DoxyNote}
276
277 \begin{DoxyParams}[1]{Parameters}
278 \mbox{\tt out}  & {\em pl} & A pointer to the plist that is to be created \\
279 \hline
280 \mbox{\tt in}  & {\em probs} & The probability matrix used for creting the plist \\
281 \hline
282 \mbox{\tt in}  & {\em length} & The length of the R\-N\-A sequence \\
283 \hline
284 \mbox{\tt in}  & {\em cutoff} & The cutoff value \\
285 \hline
286 \end{DoxyParams}
287 \hypertarget{group__pf__fold_ga18607e79e106cad827f482eedd2f632e}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!get\-\_\-pf\-\_\-arrays@{get\-\_\-pf\-\_\-arrays}}
288 \index{get\-\_\-pf\-\_\-arrays@{get\-\_\-pf\-\_\-arrays}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
289 \subsubsection[{get\-\_\-pf\-\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}int get\-\_\-pf\-\_\-arrays (
290 \begin{DoxyParamCaption}
291 \item[{short $\ast$$\ast$}]{S\-\_\-p, }
292 \item[{short $\ast$$\ast$}]{S1\-\_\-p, }
293 \item[{char $\ast$$\ast$}]{ptype\-\_\-p, }
294 \item[{double $\ast$$\ast$}]{qb\-\_\-p, }
295 \item[{double $\ast$$\ast$}]{qm\-\_\-p, }
296 \item[{double $\ast$$\ast$}]{q1k\-\_\-p, }
297 \item[{double $\ast$$\ast$}]{qln\-\_\-p}
298 \end{DoxyParamCaption}
299 )}}\label{group__pf__fold_ga18607e79e106cad827f482eedd2f632e}
300
301
302 Get the pointers to (almost) all relavant computation arrays used in partition function computation. 
303
304 \begin{DoxyPrecond}{Precondition}
305 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! 
306 \end{DoxyPrecond}
307 \begin{DoxySeeAlso}{See Also}
308 \hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\-\_\-fold\-\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\-\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\-\_\-circ\-\_\-fold()} 
309 \end{DoxySeeAlso}
310
311 \begin{DoxyParams}[1]{Parameters}
312 \mbox{\tt out}  & {\em S\-\_\-p} & A pointer to the 'S' array (integer representation of nucleotides) \\
313 \hline
314 \mbox{\tt out}  & {\em S1\-\_\-p} & A pointer to the 'S1' array (2nd integer representation of nucleotides) \\
315 \hline
316 \mbox{\tt out}  & {\em ptype\-\_\-p} & A pointer to the pair type matrix \\
317 \hline
318 \mbox{\tt out}  & {\em qb\-\_\-p} & A pointer to the Q$^{\mbox{B}}$  matrix \\
319 \hline
320 \mbox{\tt out}  & {\em qm\-\_\-p} & A pointer to the Q$^{\mbox{M}}$  matrix \\
321 \hline
322 \mbox{\tt out}  & {\em q1k\-\_\-p} & A pointer to the 5' slice of the Q matrix ( $q1k(k) = Q(1, k)$) \\
323 \hline
324 \mbox{\tt out}  & {\em qln\-\_\-p} & A pointer to the 3' slice of the Q matrix ( $qln(l) = Q(l, n)$) \\
325 \hline
326 \end{DoxyParams}
327 \begin{DoxyReturn}{Returns}
328 Non Zero if everything went fine, 0 otherwise 
329 \end{DoxyReturn}
330 \hypertarget{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!mean\-\_\-bp\-\_\-distance@{mean\-\_\-bp\-\_\-distance}}
331 \index{mean\-\_\-bp\-\_\-distance@{mean\-\_\-bp\-\_\-distance}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
332 \subsubsection[{mean\-\_\-bp\-\_\-distance}]{\setlength{\rightskip}{0pt plus 5cm}double mean\-\_\-bp\-\_\-distance (
333 \begin{DoxyParamCaption}
334 \item[{int}]{length}
335 \end{DoxyParamCaption}
336 )}}\label{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}
337
338
339 Get the mean base pair distance of the last partition function computation. 
340
341 \begin{DoxyNote}{Note}
342 To ensure thread-\/safety, use the function \hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\-\_\-bp\-\_\-distance\-\_\-pr()} instead!
343 \end{DoxyNote}
344 \begin{DoxySeeAlso}{See Also}
345 \hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\-\_\-bp\-\_\-distance\-\_\-pr()}
346 \end{DoxySeeAlso}
347
348 \begin{DoxyParams}{Parameters}
349 {\em length} & \\
350 \hline
351 \end{DoxyParams}
352 \begin{DoxyReturn}{Returns}
353 mean base pair distance in thermodynamic ensemble 
354 \end{DoxyReturn}
355 \hypertarget{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}!mean\-\_\-bp\-\_\-distance\-\_\-pr@{mean\-\_\-bp\-\_\-distance\-\_\-pr}}
356 \index{mean\-\_\-bp\-\_\-distance\-\_\-pr@{mean\-\_\-bp\-\_\-distance\-\_\-pr}!Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
357 \subsubsection[{mean\-\_\-bp\-\_\-distance\-\_\-pr}]{\setlength{\rightskip}{0pt plus 5cm}double mean\-\_\-bp\-\_\-distance\-\_\-pr (
358 \begin{DoxyParamCaption}
359 \item[{int}]{length, }
360 \item[{double $\ast$}]{pr}
361 \end{DoxyParamCaption}
362 )}}\label{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}
363
364
365 Get the mean base pair distance in the thermodynamic ensemble. 
366
367 This is a threadsafe implementation of \hyperlink{part__func_8h_ae9556ba7ded44fe2321b6f67c3fc02a3}{mean\-\_\-bp\-\_\-dist()} !
368
369 $<d> = \sum_{a,b} p_a p_b d(S_a,S_b)$\par
370  this can be computed from the pair probs $p_ij$ as\par
371  $<d> = \sum_{ij} p_{ij}(1-p_{ij})$
372
373 \begin{DoxyNote}{Note}
374 This function is threadsafe
375 \end{DoxyNote}
376
377 \begin{DoxyParams}{Parameters}
378 {\em length} & The length of the sequence \\
379 \hline
380 {\em pr} & The matrix containing the base pair probabilities \\
381 \hline
382 \end{DoxyParams}
383 \begin{DoxyReturn}{Returns}
384 The mean pair distance of the structure ensemble 
385 \end{DoxyReturn}