\hypertarget{group__pf__fold}{
\section{Calculating Partition Functions and Pair Probabilities}
\label{group__pf__fold}\index{Calculating Partition Functions and Pair Probabilities@{Calculating Partition Functions and Pair Probabilities}}
}


This section provides information about all functions and variables related to the calculation of the partition function and base pair probabilities.  


Collaboration diagram for Calculating Partition Functions and Pair Probabilities:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=420pt]{group__pf__fold}
\end{center}
\end{figure}
\subsection*{Modules}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__mea__fold}{Compute the structure with maximum expected accuracy (MEA)}
\item 
\hyperlink{group__centroid__fold}{Compute the centroid structure}
\item 
\hyperlink{group__pf__cofold}{Partition Function for two hybridized Sequences}


\begin{DoxyCompactList}\small\item\em Partition Function Cofolding. \item\end{DoxyCompactList}\item 
\hyperlink{group__up__cofold}{Partition Function for two hybridized Sequences as a stepwise Process}


\begin{DoxyCompactList}\small\item\em Partition Function Cofolding as a stepwise process. \item\end{DoxyCompactList}\item 
\hyperlink{group__consensus__pf__fold}{Partition Function and Base Pair Probabilities for Sequence Alignment(s)}
\item 
\hyperlink{group__local__pf__fold}{Partition functions for locally stable secondary structures}
\item 
\hyperlink{group__kl__neighborhood__pf}{Calculate Partition Functions of a Distance Based Partitioning}


\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}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
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)
\begin{DoxyCompactList}\small\item\em Compute the partition function $Q$ for a given RNA sequence. \item\end{DoxyCompactList}\item 
float \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold} (const char $\ast$sequence, char $\ast$structure)
\begin{DoxyCompactList}\small\item\em Compute the partition function $Q$ of an RNA sequence. \item\end{DoxyCompactList}\item 
float \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold} (const char $\ast$sequence, char $\ast$structure)
\begin{DoxyCompactList}\small\item\em Compute the partition function of a circular RNA sequence. \item\end{DoxyCompactList}\item 
void \hyperlink{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{free\_\-pf\_\-arrays} (void)
\begin{DoxyCompactList}\small\item\em Free arrays for the partition function recursions. \item\end{DoxyCompactList}\item 
void \hyperlink{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}{update\_\-pf\_\-params} (int length)
\begin{DoxyCompactList}\small\item\em Recalculate energy parameters. \item\end{DoxyCompactList}\item 
\hypertarget{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}{
void \hyperlink{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}{update\_\-pf\_\-params\_\-par} (int length, \hyperlink{structpf__paramT}{pf\_\-paramT} $\ast$parameters)}
\label{group__pf__fold_ga0733527a94de3b79eee3c3c03c99c1bc}

\begin{DoxyCompactList}\small\item\em Recalculate energy parameters. \item\end{DoxyCompactList}\item 
double $\ast$ \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export\_\-bppm} (void)
\begin{DoxyCompactList}\small\item\em Get a pointer to the base pair probability array

Accessing the base pair probabilities for a pair (i,j) is achieved by. \item\end{DoxyCompactList}\item 
void \hyperlink{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}{assign\_\-plist\_\-from\_\-pr} (\hyperlink{structplist}{plist} $\ast$$\ast$pl, double $\ast$probs, int length, double cutoff)
\begin{DoxyCompactList}\small\item\em Create a \hyperlink{structplist}{plist} from a probability matrix. \item\end{DoxyCompactList}\item 
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)
\begin{DoxyCompactList}\small\item\em Get the pointers to (almost) all relavant computation arrays used in partition function computation. \item\end{DoxyCompactList}\item 
double \hyperlink{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}{mean\_\-bp\_\-distance} (int length)
\begin{DoxyCompactList}\small\item\em Get the mean base pair distance of the last partition function computation. \item\end{DoxyCompactList}\item 
double \hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\_\-bp\_\-distance\_\-pr} (int length, double $\ast$\hyperlink{fold__vars_8h_a0f5757427fd5f2f79d6fca0081cd5a52}{pr})
\begin{DoxyCompactList}\small\item\em Get the mean base pair distance in the thermodynamic ensemble. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
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. 

\subsection{Function Documentation}
\hypertarget{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{
\index{pf\_\-fold@{pf\_\-fold}!pf\_\-fold\_\-par@{pf\_\-fold\_\-par}}
\index{pf\_\-fold\_\-par@{pf\_\-fold\_\-par}!pf_fold@{pf\_\-fold}}
\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})}}
\label{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}


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.

\begin{DoxyNote}{Note}
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()} 
\end{DoxyNote}
\begin{DoxyPostcond}{Postcondition}
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. 
\end{DoxyPostcond}
\begin{DoxySeeAlso}{See also}
\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()} 
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
\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}
\begin{DoxyReturn}{Returns}
The Gibbs free energy of the ensemble ($G = -RT \cdot \log(Q) $) in kcal/mol 
\end{DoxyReturn}
\hypertarget{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{
\index{pf\_\-fold@{pf\_\-fold}!pf\_\-fold@{pf\_\-fold}}
\index{pf\_\-fold@{pf\_\-fold}!pf_fold@{pf\_\-fold}}
\subsubsection[{pf\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}float pf\_\-fold (const char $\ast$ {\em sequence}, \/  char $\ast$ {\em structure})}}
\label{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}


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.

\begin{DoxyNote}{Note}
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()}. 

{\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. 
\end{DoxyNote}
\begin{DoxyPrecond}{Precondition}
This function takes its model details from the global variables provided in {\itshape RNAlib\/} 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
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. 
\end{DoxyPostcond}
\begin{DoxySeeAlso}{See also}
\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()} 
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
\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}
\begin{DoxyReturn}{Returns}
The Gibbs free energy of the ensemble ($G = -RT \cdot \log(Q) $) in kcal/mol 
\end{DoxyReturn}
\hypertarget{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{
\index{pf\_\-fold@{pf\_\-fold}!pf\_\-circ\_\-fold@{pf\_\-circ\_\-fold}}
\index{pf\_\-circ\_\-fold@{pf\_\-circ\_\-fold}!pf_fold@{pf\_\-fold}}
\subsubsection[{pf\_\-circ\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}float pf\_\-circ\_\-fold (const char $\ast$ {\em sequence}, \/  char $\ast$ {\em structure})}}
\label{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}


Compute the partition function of a circular RNA sequence. \begin{DoxyNote}{Note}
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()}. 

{\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. 
\end{DoxyNote}
\begin{DoxyPrecond}{Precondition}
This function takes its model details from the global variables provided in {\itshape RNAlib\/} 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
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. 
\end{DoxyPostcond}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()} 
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
\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}
\begin{DoxyReturn}{Returns}
The Gibbs free energy of the ensemble ($G = -RT \cdot \log(Q) $) in kcal/mol 
\end{DoxyReturn}
\hypertarget{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}{
\index{pf\_\-fold@{pf\_\-fold}!free\_\-pf\_\-arrays@{free\_\-pf\_\-arrays}}
\index{free\_\-pf\_\-arrays@{free\_\-pf\_\-arrays}!pf_fold@{pf\_\-fold}}
\subsubsection[{free\_\-pf\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}void free\_\-pf\_\-arrays (void)}}
\label{group__pf__fold_gae73db3f49a94f0f72e067ecd12681dbd}


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}
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. 

{\bfseries OpenMP notice:}\par
 This function should be called before leaving a thread in order to avoid leaking memory
\end{DoxyNote}
\begin{DoxyPostcond}{Postcondition}
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 
\end{DoxyPostcond}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()} 
\end{DoxySeeAlso}
\hypertarget{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}{
\index{pf\_\-fold@{pf\_\-fold}!update\_\-pf\_\-params@{update\_\-pf\_\-params}}
\index{update\_\-pf\_\-params@{update\_\-pf\_\-params}!pf_fold@{pf\_\-fold}}
\subsubsection[{update\_\-pf\_\-params}]{\setlength{\rightskip}{0pt plus 5cm}void update\_\-pf\_\-params (int {\em length})}}
\label{group__pf__fold_ga384e927890f9c034ff09fa66da102d28}


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}{
\index{pf\_\-fold@{pf\_\-fold}!export\_\-bppm@{export\_\-bppm}}
\index{export\_\-bppm@{export\_\-bppm}!pf_fold@{pf\_\-fold}}
\subsubsection[{export\_\-bppm}]{\setlength{\rightskip}{0pt plus 5cm}double$\ast$ export\_\-bppm (void)}}
\label{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}


Get a pointer to the base pair probability array

Accessing the base pair probabilities for a pair (i,j) is achieved by. 

\begin{footnotesize}\begin{alltt}
  FLT\_OR\_DBL *pr  = \hyperlink{group__pf__fold_ga6d463707d5f64bdc4d21515b7dd9b115}{export_bppm}();
  pr\_ij           = pr[iindx[i]-j];
\end{alltt}\end{footnotesize}


\begin{DoxyPrecond}{Precondition}
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
\end{DoxyPrecond}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()}, \hyperlink{utils_8h_a55c0f6b3b07b6adf2ee235ba901fe397}{get\_\-iindx()}
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
A pointer to the base pair probability array 
\end{DoxyReturn}
\hypertarget{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}{
\index{pf\_\-fold@{pf\_\-fold}!assign\_\-plist\_\-from\_\-pr@{assign\_\-plist\_\-from\_\-pr}}
\index{assign\_\-plist\_\-from\_\-pr@{assign\_\-plist\_\-from\_\-pr}!pf_fold@{pf\_\-fold}}
\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})}}
\label{group__pf__fold_ga03e15e831a31b1154855ab47edbdb019}


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}

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

\begin{DoxyNote}{Note}
This function is threadsafe
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
\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}
\hypertarget{group__pf__fold_ga18607e79e106cad827f482eedd2f632e}{
\index{pf\_\-fold@{pf\_\-fold}!get\_\-pf\_\-arrays@{get\_\-pf\_\-arrays}}
\index{get\_\-pf\_\-arrays@{get\_\-pf\_\-arrays}!pf_fold@{pf\_\-fold}}
\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})}}
\label{group__pf__fold_ga18607e79e106cad827f482eedd2f632e}


Get the pointers to (almost) all relavant computation arrays used in partition function computation. \begin{DoxyPrecond}{Precondition}
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! 
\end{DoxyPrecond}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pf__fold_ga1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}, \hyperlink{group__pf__fold_gadc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{group__pf__fold_ga819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()} 
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
\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}
\begin{DoxyReturn}{Returns}
Non Zero if everything went fine, 0 otherwise 
\end{DoxyReturn}
\hypertarget{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}{
\index{pf\_\-fold@{pf\_\-fold}!mean\_\-bp\_\-distance@{mean\_\-bp\_\-distance}}
\index{mean\_\-bp\_\-distance@{mean\_\-bp\_\-distance}!pf_fold@{pf\_\-fold}}
\subsubsection[{mean\_\-bp\_\-distance}]{\setlength{\rightskip}{0pt plus 5cm}double mean\_\-bp\_\-distance (int {\em length})}}
\label{group__pf__fold_ga79cbc375af65f11609feb6b055269e7d}


Get the mean base pair distance of the last partition function computation. \begin{DoxyNote}{Note}
To ensure thread-\/safety, use the function \hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\_\-bp\_\-distance\_\-pr()} instead!
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{mean\_\-bp\_\-distance\_\-pr()}
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
\item[{\em length}]\end{DoxyParams}
\begin{DoxyReturn}{Returns}
mean base pair distance in thermodynamic ensemble 
\end{DoxyReturn}
\hypertarget{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}{
\index{pf\_\-fold@{pf\_\-fold}!mean\_\-bp\_\-distance\_\-pr@{mean\_\-bp\_\-distance\_\-pr}}
\index{mean\_\-bp\_\-distance\_\-pr@{mean\_\-bp\_\-distance\_\-pr}!pf_fold@{pf\_\-fold}}
\subsubsection[{mean\_\-bp\_\-distance\_\-pr}]{\setlength{\rightskip}{0pt plus 5cm}double mean\_\-bp\_\-distance\_\-pr (int {\em length}, \/  double $\ast$ {\em pr})}}
\label{group__pf__fold_ga72d84525f0afd3a9d60d830a2f501fa5}


Get the mean base pair distance in the thermodynamic ensemble. This is a threadsafe implementation of \hyperlink{part__func_8h_ae9556ba7ded44fe2321b6f67c3fc02a3}{mean\_\-bp\_\-dist()} !

$<d> = \sum_{a,b} p_a p_b d(S_a,S_b)$\par
 this can be computed from the pair probs $p_ij$ as\par
 $<d> = \sum_{ij} p_{ij}(1-p_{ij})$

\begin{DoxyNote}{Note}
This function is threadsafe
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
\item[{\em length}]The length of the sequence \item[{\em pr}]The matrix containing the base pair probabilities \end{DoxyParams}
\begin{DoxyReturn}{Returns}
The mean pair distance of the structure ensemble 
\end{DoxyReturn}
