\hypertarget{part__func_8h}{
\section{H/part\_\-func.h File Reference}
\label{part__func_8h}\index{H/part\_\-func.h@{H/part\_\-func.h}}
}


Partition function of single RNA sequences.  
Include dependency graph for part\_\-func.h:\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
float \hyperlink{part__func_8h_a1839c61275760944b3a007c41d5c0823}{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{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{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{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}{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 
char $\ast$ \hyperlink{part__func_8h_ac03ca6db186bb3bf0a2a326d7fb3ba03}{pbacktrack} (char $\ast$sequence)
\begin{DoxyCompactList}\small\item\em Sample a secondary structure from the Boltzmann ensemble according its probability\par
. \item\end{DoxyCompactList}\item 
char $\ast$ \hyperlink{part__func_8h_a00474051204ac9ad576b3e45174d03ff}{pbacktrack\_\-circ} (char $\ast$sequence)
\begin{DoxyCompactList}\small\item\em Sample a secondary structure of a circular RNA from the Boltzmann ensemble according its probability. \item\end{DoxyCompactList}\item 
void \hyperlink{part__func_8h_ae73db3f49a94f0f72e067ecd12681dbd}{free\_\-pf\_\-arrays} (void)
\begin{DoxyCompactList}\small\item\em Free arrays for the partition function recursions. \item\end{DoxyCompactList}\item 
void \hyperlink{part__func_8h_a384e927890f9c034ff09fa66da102d28}{update\_\-pf\_\-params} (int length)
\begin{DoxyCompactList}\small\item\em Recalculate energy parameters. \item\end{DoxyCompactList}\item 
FLT\_\-OR\_\-DBL $\ast$ \hyperlink{part__func_8h_ac5ac7ee281aae1c5cc5898a841178073}{export\_\-bppm} (void)
\begin{DoxyCompactList}\small\item\em Get a pointer to the base pair probability array. \item\end{DoxyCompactList}\item 
void \hyperlink{part__func_8h_a2f29542659beb5ebd176631a3da11580}{assign\_\-plist\_\-from\_\-pr} (\hyperlink{structplist}{plist} $\ast$$\ast$pl, FLT\_\-OR\_\-DBL $\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{part__func_8h_a42faebdfce6f070c5f89adfc8427525c}{get\_\-pf\_\-arrays} (short $\ast$$\ast$S\_\-p, short $\ast$$\ast$S1\_\-p, char $\ast$$\ast$ptype\_\-p, FLT\_\-OR\_\-DBL $\ast$$\ast$qb\_\-p, FLT\_\-OR\_\-DBL $\ast$$\ast$qm\_\-p, FLT\_\-OR\_\-DBL $\ast$$\ast$q1k\_\-p, FLT\_\-OR\_\-DBL $\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 
\hypertarget{part__func_8h_a189e2a1ec6cc32c53ea72f7543b0441e}{
double \hyperlink{part__func_8h_a189e2a1ec6cc32c53ea72f7543b0441e}{get\_\-subseq\_\-F} (int i, int j)}
\label{part__func_8h_a189e2a1ec6cc32c53ea72f7543b0441e}

\begin{DoxyCompactList}\small\item\em Get the free energy of a subsequence from the q\mbox{[}\mbox{]} array. \item\end{DoxyCompactList}\item 
char $\ast$ \hyperlink{part__func_8h_a9aba0ba1433a6d259331e0fe9fc4a9a6}{get\_\-centroid\_\-struct\_\-pl} (int length, double $\ast$dist, \hyperlink{structplist}{plist} $\ast$pl)
\begin{DoxyCompactList}\small\item\em Get the centroid structure of the ensemble. \item\end{DoxyCompactList}\item 
char $\ast$ \hyperlink{part__func_8h_ac92486ce514677256f4a832dc518759c}{get\_\-centroid\_\-struct\_\-pr} (int length, double $\ast$dist, FLT\_\-OR\_\-DBL $\ast$\hyperlink{fold__vars_8h_ac98ec419070aee6831b44e5c700f090f}{pr})
\begin{DoxyCompactList}\small\item\em Get the centroid structure of the ensemble. \item\end{DoxyCompactList}\item 
double \hyperlink{part__func_8h_a79cbc375af65f11609feb6b055269e7d}{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{part__func_8h_ad5ba36cef8d01cf4244cc09b9bf1ce1d}{mean\_\-bp\_\-distance\_\-pr} (int length, FLT\_\-OR\_\-DBL $\ast$\hyperlink{fold__vars_8h_ac98ec419070aee6831b44e5c700f090f}{pr})
\begin{DoxyCompactList}\small\item\em Get the mean base pair distance in the thermodynamic ensemble. \item\end{DoxyCompactList}\item 
\hypertarget{part__func_8h_a129d81c4a1ead793c5b2311333e03dfa}{
void \hyperlink{part__func_8h_a129d81c4a1ead793c5b2311333e03dfa}{bppm\_\-to\_\-structure} (char $\ast$structure, FLT\_\-OR\_\-DBL $\ast$\hyperlink{fold__vars_8h_ac98ec419070aee6831b44e5c700f090f}{pr}, unsigned int length)}
\label{part__func_8h_a129d81c4a1ead793c5b2311333e03dfa}

\begin{DoxyCompactList}\small\item\em Create a dot-\/bracket like structure string from base pair probability matrix. \item\end{DoxyCompactList}\item 
\hypertarget{part__func_8h_a49962ad6242b8c628de6ca16bb831c1d}{
char \hyperlink{part__func_8h_a49962ad6242b8c628de6ca16bb831c1d}{bppm\_\-symbol} (const float $\ast$x)}
\label{part__func_8h_a49962ad6242b8c628de6ca16bb831c1d}

\begin{DoxyCompactList}\small\item\em Get a pseudo dot bracket notation for a given probability information. \item\end{DoxyCompactList}\item 
void \hyperlink{part__func_8h_a15176e23eceeff8c7d14eabcfec8a2af}{init\_\-pf\_\-fold} (int length)
\begin{DoxyCompactList}\small\item\em Allocate space for \hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}. \item\end{DoxyCompactList}\item 
char $\ast$ \hyperlink{part__func_8h_ae89a63bd83e75a80b2ba36d20b31ce81}{centroid} (int length, double $\ast$dist)
\item 
double \hyperlink{part__func_8h_ae9556ba7ded44fe2321b6f67c3fc02a3}{mean\_\-bp\_\-dist} (int length)
\begin{DoxyCompactList}\small\item\em get the mean pair distance of ensemble \item\end{DoxyCompactList}\item 
double \hyperlink{part__func_8h_a68ba6f3a48e08ca131ab54621ce3a2d7}{expLoopEnergy} (int u1, int u2, int type, int type2, short si1, short sj1, short sp1, short sq1)
\item 
double \hyperlink{part__func_8h_a7b6ab474cc80accc48010ccfcc59f96b}{expHairpinEnergy} (int u, int type, short si1, short sj1, const char $\ast$string)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hypertarget{part__func_8h_acd79b1a570e6ad9be24cb11fe8cae30a}{
int \hyperlink{part__func_8h_acd79b1a570e6ad9be24cb11fe8cae30a}{st\_\-back}}
\label{part__func_8h_acd79b1a570e6ad9be24cb11fe8cae30a}

\begin{DoxyCompactList}\small\item\em a flag indicating that auxilary arrays are needed throughout the computations which are necessary for stochastic backtracking \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Partition function of single RNA sequences. This file includes (almost) all function declarations within the {\bfseries RNAlib} that are related to Partion function folding...

\begin{DoxyNote}{Note}
If you plan on using the functions provided from this section of the RNAlib concurrently via {\bfseries OpenMP} you have to place a {\itshape COPYIN\/} clause right before your {\itshape PARALLEL\/} directive! Otherwise, some functions may not behave as expected. A complete list of variables that have to be passed to the {\itshape COPYIN\/} clause can be found in the detailed description of each function below. 
\end{DoxyNote}


\subsection{Function Documentation}
\hypertarget{part__func_8h_a1839c61275760944b3a007c41d5c0823}{
\index{part\_\-func.h@{part\_\-func.h}!pf\_\-fold\_\-par@{pf\_\-fold\_\-par}}
\index{pf\_\-fold\_\-par@{pf\_\-fold\_\-par}!part_func.h@{part\_\-func.h}}
\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{part__func_8h_a1839c61275760944b3a007c41d5c0823}


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_ac98ec419070aee6831b44e5c700f090f}{pr} will contain the probability that bases {\itshape i\/} and {\itshape j\/} pair. \begin{DoxyNote}{Note}
The global array \hyperlink{fold__vars_8h_ac98ec419070aee6831b44e5c700f090f}{pr} is deprecated and the user who wants the calculated base pair probabilities for further computations is advised to use the function \hyperlink{part__func_8h_ac5ac7ee281aae1c5cc5898a841178073}{export\_\-bppm()}
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\hyperlink{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()}, \hyperlink{part__func_8h_a129d81c4a1ead793c5b2311333e03dfa}{bppm\_\-to\_\-structure()}, \hyperlink{part__func_8h_ac5ac7ee281aae1c5cc5898a841178073}{export\_\-bppm()}, \hyperlink{params_8h_a6fc2f3eef5a3024d44963ac59a42e39d}{get\_\-boltzmann\_\-factors()}
\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) \item[{\em parameters}]Data structure containing the precalculated Boltzmann factors \item[{\em calculate\_\-bppm}]Switch to Base pair probability calculations on/off (0==off) \item[{\em is\_\-constrained}]Switch to indicate that a structure contraint is passed via the structure argument (0==off) \item[{\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{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{
\index{part\_\-func.h@{part\_\-func.h}!pf\_\-fold@{pf\_\-fold}}
\index{pf\_\-fold@{pf\_\-fold}!part_func.h@{part\_\-func.h}}
\subsubsection[{pf\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}float pf\_\-fold (const char $\ast$ {\em sequence}, \/  char $\ast$ {\em structure})}}
\label{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}


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_ac98ec419070aee6831b44e5c700f090f}{pr} will contain the probability that bases {\itshape i\/} and {\itshape j\/} pair. \begin{DoxyNote}{Note}
The global array \hyperlink{fold__vars_8h_ac98ec419070aee6831b44e5c700f090f}{pr} is deprecated and the user who wants the calculated base pair probabilities for further computations is advised to use the function \hyperlink{part__func_8h_ac5ac7ee281aae1c5cc5898a841178073}{export\_\-bppm()}
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\hyperlink{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()}, \hyperlink{part__func_8h_a129d81c4a1ead793c5b2311333e03dfa}{bppm\_\-to\_\-structure()}, \hyperlink{part__func_8h_ac5ac7ee281aae1c5cc5898a841178073}{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{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}{
\index{part\_\-func.h@{part\_\-func.h}!pf\_\-circ\_\-fold@{pf\_\-circ\_\-fold}}
\index{pf\_\-circ\_\-fold@{pf\_\-circ\_\-fold}!part_func.h@{part\_\-func.h}}
\subsubsection[{pf\_\-circ\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}float pf\_\-circ\_\-fold (const char $\ast$ {\em sequence}, \/  char $\ast$ {\em structure})}}
\label{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}


Compute the partition function of a circular RNA sequence. \begin{DoxySeeAlso}{See also}
\hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{part__func_8h_a1839c61275760944b3a007c41d5c0823}{pf\_\-fold\_\-par()}
\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{part__func_8h_ac03ca6db186bb3bf0a2a326d7fb3ba03}{
\index{part\_\-func.h@{part\_\-func.h}!pbacktrack@{pbacktrack}}
\index{pbacktrack@{pbacktrack}!part_func.h@{part\_\-func.h}}
\subsubsection[{pbacktrack}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ pbacktrack (char $\ast$ {\em sequence})}}
\label{part__func_8h_ac03ca6db186bb3bf0a2a326d7fb3ba03}


Sample a secondary structure from the Boltzmann ensemble according its probability\par
. \begin{DoxyNote}{Note}
You have to call \hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()} first in order to fill the partition function matrices

{\bfseries OpenMP notice:}\par
This function relies on passing the following variables to the appropriate {\itshape COPYIN\/} clause {\itshape (additionally to the ones needed by \hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()})\/}:\par
 pstruc, sequence
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
\item[{\em sequence}]The RNA sequence \end{DoxyParams}
\begin{DoxyReturn}{Returns}
A sampled secondary structure in dot-\/bracket notation 
\end{DoxyReturn}
\hypertarget{part__func_8h_a00474051204ac9ad576b3e45174d03ff}{
\index{part\_\-func.h@{part\_\-func.h}!pbacktrack\_\-circ@{pbacktrack\_\-circ}}
\index{pbacktrack\_\-circ@{pbacktrack\_\-circ}!part_func.h@{part\_\-func.h}}
\subsubsection[{pbacktrack\_\-circ}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ pbacktrack\_\-circ (char $\ast$ {\em sequence})}}
\label{part__func_8h_a00474051204ac9ad576b3e45174d03ff}


Sample a secondary structure of a circular RNA from the Boltzmann ensemble according its probability. This function does the same as \hyperlink{part__func_8h_ac03ca6db186bb3bf0a2a326d7fb3ba03}{pbacktrack()} but assumes the RNA molecule to be circular

\begin{DoxyNote}{Note}
{\bfseries OpenMP notice:}\par
This function relies on passing the following variables to the appropriate {\itshape COPYIN\/} clause {\itshape (additionally to the ones needed by \hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()})\/}:\par
 pstruc, sequence
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
\item[{\em sequence}]The RNA sequence \end{DoxyParams}
\begin{DoxyReturn}{Returns}
A sampled secondary structure in dot-\/bracket notation 
\end{DoxyReturn}
\hypertarget{part__func_8h_ae73db3f49a94f0f72e067ecd12681dbd}{
\index{part\_\-func.h@{part\_\-func.h}!free\_\-pf\_\-arrays@{free\_\-pf\_\-arrays}}
\index{free\_\-pf\_\-arrays@{free\_\-pf\_\-arrays}!part_func.h@{part\_\-func.h}}
\subsubsection[{free\_\-pf\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}void free\_\-pf\_\-arrays (void)}}
\label{part__func_8h_ae73db3f49a94f0f72e067ecd12681dbd}


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{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}{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{DoxySeeAlso}{See also}
\hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()} 
\end{DoxySeeAlso}
\hypertarget{part__func_8h_a384e927890f9c034ff09fa66da102d28}{
\index{part\_\-func.h@{part\_\-func.h}!update\_\-pf\_\-params@{update\_\-pf\_\-params}}
\index{update\_\-pf\_\-params@{update\_\-pf\_\-params}!part_func.h@{part\_\-func.h}}
\subsubsection[{update\_\-pf\_\-params}]{\setlength{\rightskip}{0pt plus 5cm}void update\_\-pf\_\-params (int {\em length})}}
\label{part__func_8h_a384e927890f9c034ff09fa66da102d28}


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{part__func_8h_ac5ac7ee281aae1c5cc5898a841178073}{
\index{part\_\-func.h@{part\_\-func.h}!export\_\-bppm@{export\_\-bppm}}
\index{export\_\-bppm@{export\_\-bppm}!part_func.h@{part\_\-func.h}}
\subsubsection[{export\_\-bppm}]{\setlength{\rightskip}{0pt plus 5cm}FLT\_\-OR\_\-DBL$\ast$ export\_\-bppm (void)}}
\label{part__func_8h_ac5ac7ee281aae1c5cc5898a841178073}


Get a pointer to the base pair probability array. Accessing the base pair probabilities for a pair (i,j) is achieved by \begin{DoxyVerb}FLT_OR_DBL *pr = export_bppm(); pr_ij = pr[iindx[i]-j]; \end{DoxyVerb}


\begin{DoxyNote}{Note}
Call \hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()} before using this function!
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}{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{part__func_8h_a2f29542659beb5ebd176631a3da11580}{
\index{part\_\-func.h@{part\_\-func.h}!assign\_\-plist\_\-from\_\-pr@{assign\_\-plist\_\-from\_\-pr}}
\index{assign\_\-plist\_\-from\_\-pr@{assign\_\-plist\_\-from\_\-pr}!part_func.h@{part\_\-func.h}}
\subsubsection[{assign\_\-plist\_\-from\_\-pr}]{\setlength{\rightskip}{0pt plus 5cm}void assign\_\-plist\_\-from\_\-pr ({\bf plist} $\ast$$\ast$ {\em pl}, \/  FLT\_\-OR\_\-DBL $\ast$ {\em probs}, \/  int {\em length}, \/  double {\em cutoff})}}
\label{part__func_8h_a2f29542659beb5ebd176631a3da11580}


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[{\em pl}]A pointer to the \hyperlink{structplist}{plist} that is to be created \item[{\em probs}]The probability matrix used for creting the \hyperlink{structplist}{plist} \item[{\em length}]The length of the RNA sequence \item[{\em cutoff}]The cutoff value \end{DoxyParams}
\hypertarget{part__func_8h_a42faebdfce6f070c5f89adfc8427525c}{
\index{part\_\-func.h@{part\_\-func.h}!get\_\-pf\_\-arrays@{get\_\-pf\_\-arrays}}
\index{get\_\-pf\_\-arrays@{get\_\-pf\_\-arrays}!part_func.h@{part\_\-func.h}}
\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}, \/  FLT\_\-OR\_\-DBL $\ast$$\ast$ {\em qb\_\-p}, \/  FLT\_\-OR\_\-DBL $\ast$$\ast$ {\em qm\_\-p}, \/  FLT\_\-OR\_\-DBL $\ast$$\ast$ {\em q1k\_\-p}, \/  FLT\_\-OR\_\-DBL $\ast$$\ast$ {\em qln\_\-p})}}
\label{part__func_8h_a42faebdfce6f070c5f89adfc8427525c}


Get the pointers to (almost) all relavant computation arrays used in partition function computation. \begin{DoxyNote}{Note}
In order to assign meaningful pointers, you have to call pf\_\-fold first!
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}, \hyperlink{part__func_8h_a819ce5fca8984004ac81c4a3b04cb735}{pf\_\-circ\_\-fold()}
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
\item[{\em S\_\-p}]A pointer to the 'S' array (integer representation of nucleotides) \item[{\em S1\_\-p}]A pointer to the 'S1' array (2nd integer representation of nucleotides) \item[{\em ptype\_\-p}]A pointer to the pair type matrix \item[{\em qb\_\-p}]A pointer to the Q$^{\mbox{B}}$  matrix \item[{\em qm\_\-p}]A pointer to the Q$^{\mbox{M}}$  matrix \item[{\em q1k\_\-p}]A pointer to the 5' slice of the Q matrix ($q1k(k) = Q(1, k)$) \item[{\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{part__func_8h_a9aba0ba1433a6d259331e0fe9fc4a9a6}{
\index{part\_\-func.h@{part\_\-func.h}!get\_\-centroid\_\-struct\_\-pl@{get\_\-centroid\_\-struct\_\-pl}}
\index{get\_\-centroid\_\-struct\_\-pl@{get\_\-centroid\_\-struct\_\-pl}!part_func.h@{part\_\-func.h}}
\subsubsection[{get\_\-centroid\_\-struct\_\-pl}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ get\_\-centroid\_\-struct\_\-pl (int {\em length}, \/  double $\ast$ {\em dist}, \/  {\bf plist} $\ast$ {\em pl})}}
\label{part__func_8h_a9aba0ba1433a6d259331e0fe9fc4a9a6}


Get the centroid structure of the ensemble. This function is a threadsafe replacement for \hyperlink{part__func_8h_ae89a63bd83e75a80b2ba36d20b31ce81}{centroid()} with a 'plist' input

The centroid is the structure with the minimal average distance to all other structures \par
 $ <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij} $ \par
 Thus, the centroid is simply the structure containing all pairs with $p_ij>0.5$ The distance of the centroid to the ensemble is written to the memory adressed by {\itshape dist\/}.


\begin{DoxyParams}{Parameters}
\item[{\em length}]The length of the sequence \item[{\em dist}]A pointer to the distance variable where the centroid distance will be written to \item[{\em pl}]A pair list containing base pair probability information about the ensemble \end{DoxyParams}
\begin{DoxyReturn}{Returns}
The centroid structure of the ensemble in dot-\/bracket notation 
\end{DoxyReturn}
\hypertarget{part__func_8h_ac92486ce514677256f4a832dc518759c}{
\index{part\_\-func.h@{part\_\-func.h}!get\_\-centroid\_\-struct\_\-pr@{get\_\-centroid\_\-struct\_\-pr}}
\index{get\_\-centroid\_\-struct\_\-pr@{get\_\-centroid\_\-struct\_\-pr}!part_func.h@{part\_\-func.h}}
\subsubsection[{get\_\-centroid\_\-struct\_\-pr}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ get\_\-centroid\_\-struct\_\-pr (int {\em length}, \/  double $\ast$ {\em dist}, \/  FLT\_\-OR\_\-DBL $\ast$ {\em pr})}}
\label{part__func_8h_ac92486ce514677256f4a832dc518759c}


Get the centroid structure of the ensemble. This function is a threadsafe replacement for \hyperlink{part__func_8h_ae89a63bd83e75a80b2ba36d20b31ce81}{centroid()} with a probability array input

The centroid is the structure with the minimal average distance to all other structures \par
 $ <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij} $ \par
 Thus, the centroid is simply the structure containing all pairs with $p_ij>0.5$ The distance of the centroid to the ensemble is written to the memory adressed by {\itshape dist\/}.


\begin{DoxyParams}{Parameters}
\item[{\em length}]The length of the sequence \item[{\em dist}]A pointer to the distance variable where the centroid distance will be written to \item[{\em pr}]A upper triangular matrix containing base pair probabilities (access via iindx \hyperlink{utils_8h_a55c0f6b3b07b6adf2ee235ba901fe397}{get\_\-iindx()} ) \end{DoxyParams}
\begin{DoxyReturn}{Returns}
The centroid structure of the ensemble in dot-\/bracket notation 
\end{DoxyReturn}
\hypertarget{part__func_8h_a79cbc375af65f11609feb6b055269e7d}{
\index{part\_\-func.h@{part\_\-func.h}!mean\_\-bp\_\-distance@{mean\_\-bp\_\-distance}}
\index{mean\_\-bp\_\-distance@{mean\_\-bp\_\-distance}!part_func.h@{part\_\-func.h}}
\subsubsection[{mean\_\-bp\_\-distance}]{\setlength{\rightskip}{0pt plus 5cm}double mean\_\-bp\_\-distance (int {\em length})}}
\label{part__func_8h_a79cbc375af65f11609feb6b055269e7d}


Get the mean base pair distance of the last partition function computation. \begin{DoxyNote}{Note}
To ensure thread-\/safety, use the function \hyperlink{part__func_8h_ad5ba36cef8d01cf4244cc09b9bf1ce1d}{mean\_\-bp\_\-distance\_\-pr()} instead!
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\hyperlink{part__func_8h_ad5ba36cef8d01cf4244cc09b9bf1ce1d}{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{part__func_8h_ad5ba36cef8d01cf4244cc09b9bf1ce1d}{
\index{part\_\-func.h@{part\_\-func.h}!mean\_\-bp\_\-distance\_\-pr@{mean\_\-bp\_\-distance\_\-pr}}
\index{mean\_\-bp\_\-distance\_\-pr@{mean\_\-bp\_\-distance\_\-pr}!part_func.h@{part\_\-func.h}}
\subsubsection[{mean\_\-bp\_\-distance\_\-pr}]{\setlength{\rightskip}{0pt plus 5cm}double mean\_\-bp\_\-distance\_\-pr (int {\em length}, \/  FLT\_\-OR\_\-DBL $\ast$ {\em pr})}}
\label{part__func_8h_ad5ba36cef8d01cf4244cc09b9bf1ce1d}


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}
\hypertarget{part__func_8h_a15176e23eceeff8c7d14eabcfec8a2af}{
\index{part\_\-func.h@{part\_\-func.h}!init\_\-pf\_\-fold@{init\_\-pf\_\-fold}}
\index{init\_\-pf\_\-fold@{init\_\-pf\_\-fold}!part_func.h@{part\_\-func.h}}
\subsubsection[{init\_\-pf\_\-fold}]{\setlength{\rightskip}{0pt plus 5cm}void init\_\-pf\_\-fold (int {\em length})}}
\label{part__func_8h_a15176e23eceeff8c7d14eabcfec8a2af}


Allocate space for \hyperlink{part__func_8h_adc3db3d98742427e7001a7fd36ef28c2}{pf\_\-fold()}. \begin{Desc}
\item[\hyperlink{deprecated__deprecated000011}{Deprecated}]This function is obsolete and will be removed soon! \end{Desc}
\hypertarget{part__func_8h_ae89a63bd83e75a80b2ba36d20b31ce81}{
\index{part\_\-func.h@{part\_\-func.h}!centroid@{centroid}}
\index{centroid@{centroid}!part_func.h@{part\_\-func.h}}
\subsubsection[{centroid}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ centroid (int {\em length}, \/  double $\ast$ {\em dist})}}
\label{part__func_8h_ae89a63bd83e75a80b2ba36d20b31ce81}
\begin{Desc}
\item[\hyperlink{deprecated__deprecated000012}{Deprecated}]This function is deprecated and should not be used anymore as it is not threadsafe! \end{Desc}
\begin{DoxySeeAlso}{See also}
\hyperlink{part__func_8h_a9aba0ba1433a6d259331e0fe9fc4a9a6}{get\_\-centroid\_\-struct\_\-pl()}, \hyperlink{part__func_8h_ac92486ce514677256f4a832dc518759c}{get\_\-centroid\_\-struct\_\-pr()} 
\end{DoxySeeAlso}
\hypertarget{part__func_8h_ae9556ba7ded44fe2321b6f67c3fc02a3}{
\index{part\_\-func.h@{part\_\-func.h}!mean\_\-bp\_\-dist@{mean\_\-bp\_\-dist}}
\index{mean\_\-bp\_\-dist@{mean\_\-bp\_\-dist}!part_func.h@{part\_\-func.h}}
\subsubsection[{mean\_\-bp\_\-dist}]{\setlength{\rightskip}{0pt plus 5cm}double mean\_\-bp\_\-dist (int {\em length})}}
\label{part__func_8h_ae9556ba7ded44fe2321b6f67c3fc02a3}


get the mean pair distance of ensemble \begin{Desc}
\item[\hyperlink{deprecated__deprecated000013}{Deprecated}]This function is not threadsafe and should not be used anymore. Use \hyperlink{part__func_8h_a79cbc375af65f11609feb6b055269e7d}{mean\_\-bp\_\-distance()} instead! \end{Desc}
\hypertarget{part__func_8h_a68ba6f3a48e08ca131ab54621ce3a2d7}{
\index{part\_\-func.h@{part\_\-func.h}!expLoopEnergy@{expLoopEnergy}}
\index{expLoopEnergy@{expLoopEnergy}!part_func.h@{part\_\-func.h}}
\subsubsection[{expLoopEnergy}]{\setlength{\rightskip}{0pt plus 5cm}double expLoopEnergy (int {\em u1}, \/  int {\em u2}, \/  int {\em type}, \/  int {\em type2}, \/  short {\em si1}, \/  short {\em sj1}, \/  short {\em sp1}, \/  short {\em sq1})}}
\label{part__func_8h_a68ba6f3a48e08ca131ab54621ce3a2d7}
\begin{Desc}
\item[\hyperlink{deprecated__deprecated000014}{Deprecated}]Use \hyperlink{loop__energies_8h_aa5e98e524e2a41e290b942b09544bc9e}{exp\_\-E\_\-IntLoop()} from \hyperlink{loop__energies_8h}{loop\_\-energies.h} instead \end{Desc}
\hypertarget{part__func_8h_a7b6ab474cc80accc48010ccfcc59f96b}{
\index{part\_\-func.h@{part\_\-func.h}!expHairpinEnergy@{expHairpinEnergy}}
\index{expHairpinEnergy@{expHairpinEnergy}!part_func.h@{part\_\-func.h}}
\subsubsection[{expHairpinEnergy}]{\setlength{\rightskip}{0pt plus 5cm}double expHairpinEnergy (int {\em u}, \/  int {\em type}, \/  short {\em si1}, \/  short {\em sj1}, \/  const char $\ast$ {\em string})}}
\label{part__func_8h_a7b6ab474cc80accc48010ccfcc59f96b}
\begin{Desc}
\item[\hyperlink{deprecated__deprecated000015}{Deprecated}]Use \hyperlink{loop__energies_8h_a0e128184bb097dc2da33706f33b555a6}{exp\_\-E\_\-Hairpin()} from \hyperlink{loop__energies_8h}{loop\_\-energies.h} instead \end{Desc}
