1 \hypertarget{group__consensus__fold}{\section{Predicting Consensus Structures from Alignment(s)}
2 \label{group__consensus__fold}\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
6 compute various properties (consensus M\-F\-E structures, partition function, Boltzmann distributed stochastic samples, ...) for R\-N\-A sequence alignments
9 Collaboration diagram for Predicting Consensus Structures from Alignment(s)\-:
14 \includegraphics[width=350pt]{group__consensus__fold}
18 \begin{DoxyCompactItemize}
20 \hyperlink{group__consensus__mfe__fold}{M\-F\-E Consensus Structures for Sequence Alignment(s)}
22 \hyperlink{group__consensus__pf__fold}{Partition Function and Base Pair Probabilities for Sequence Alignment(s)}
24 \hyperlink{group__consensus__stochbt}{Stochastic Backtracking of Consensus Structures from Sequence Alignment(s)}
26 \hyperlink{group__local__consensus__fold}{Local M\-F\-E consensus structures for Sequence Alignments}
27 \end{DoxyCompactItemize}
29 \begin{DoxyCompactItemize}
31 file \hyperlink{alifold_8h}{alifold.\-h}
32 \begin{DoxyCompactList}\small\item\em compute various properties (consensus M\-F\-E structures, partition function, Boltzmann distributed stochastic samples, ...) for R\-N\-A sequence alignments \end{DoxyCompactList}\end{DoxyCompactItemize}
33 \subsection*{Functions}
34 \begin{DoxyCompactItemize}
36 int \hyperlink{group__consensus__fold_gaa2d600be90844094ec145ea14a314d2f}{get\-\_\-mpi} (char $\ast$Alseq\mbox{[}$\,$\mbox{]}, int n\-\_\-seq, int length, int $\ast$mini)
37 \begin{DoxyCompactList}\small\item\em Get the mean pairwise identity in steps from ?to?(ident) \end{DoxyCompactList}\item
38 \hypertarget{group__consensus__fold_ga5e125c9586fcd4e2e1559fe76f7289cc}{float $\ast$$\ast$ \hyperlink{group__consensus__fold_ga5e125c9586fcd4e2e1559fe76f7289cc}{readribosum} (char $\ast$name)}\label{group__consensus__fold_ga5e125c9586fcd4e2e1559fe76f7289cc}
40 \begin{DoxyCompactList}\small\item\em Read a ribosum or other user-\/defined scoring matrix. \end{DoxyCompactList}\item
41 float \hyperlink{group__consensus__fold_ga1c48869c03b49a342bf4cbdd61900081}{energy\-\_\-of\-\_\-alistruct} (const char $\ast$$\ast$sequences, const char $\ast$structure, int n\-\_\-seq, float $\ast$energy)
42 \begin{DoxyCompactList}\small\item\em Calculate the free energy of a consensus structure given a set of aligned sequences. \end{DoxyCompactList}\item
43 void \hyperlink{group__consensus__fold_gaa3e40277c837d6f7603afe319884c786}{encode\-\_\-ali\-\_\-sequence} (const char $\ast$sequence, short $\ast$S, short $\ast$s5, short $\ast$s3, char $\ast$ss, unsigned short $\ast$as, int \hyperlink{fold__vars_8h_af9202a1a09f5828dc731e2d9a10fa111}{circ})
44 \begin{DoxyCompactList}\small\item\em Get arrays with encoded sequence of the alignment. \end{DoxyCompactList}\item
45 void \hyperlink{group__consensus__fold_ga8a560930f7f2582cc3967723a86cfdfa}{alloc\-\_\-sequence\-\_\-arrays} (const char $\ast$$\ast$sequences, short $\ast$$\ast$$\ast$S, short $\ast$$\ast$$\ast$S5, short $\ast$$\ast$$\ast$S3, unsigned short $\ast$$\ast$$\ast$a2s, char $\ast$$\ast$$\ast$Ss, int \hyperlink{fold__vars_8h_af9202a1a09f5828dc731e2d9a10fa111}{circ})
46 \begin{DoxyCompactList}\small\item\em Allocate memory for sequence array used to deal with aligned sequences. \end{DoxyCompactList}\item
47 void \hyperlink{group__consensus__fold_ga298a420a8c879202e2617b3f724fde38}{free\-\_\-sequence\-\_\-arrays} (unsigned int n\-\_\-seq, short $\ast$$\ast$$\ast$S, short $\ast$$\ast$$\ast$S5, short $\ast$$\ast$$\ast$S3, unsigned short $\ast$$\ast$$\ast$a2s, char $\ast$$\ast$$\ast$Ss)
48 \begin{DoxyCompactList}\small\item\em Free the memory of the sequence arrays used to deal with aligned sequences. \end{DoxyCompactList}\item
49 int \hyperlink{group__consensus__fold_ga0cc49457fd79eeb04d4a7f97c868b09b}{get\-\_\-alipf\-\_\-arrays} (short $\ast$$\ast$$\ast$S\-\_\-p, short $\ast$$\ast$$\ast$S5\-\_\-p, short $\ast$$\ast$$\ast$S3\-\_\-p, unsigned short $\ast$$\ast$$\ast$a2s\-\_\-p, char $\ast$$\ast$$\ast$Ss\-\_\-p, double $\ast$$\ast$qb\-\_\-p, double $\ast$$\ast$qm\-\_\-p, double $\ast$$\ast$q1k\-\_\-p, double $\ast$$\ast$qln\-\_\-p, short $\ast$$\ast$pscore)
50 \begin{DoxyCompactList}\small\item\em Get pointers to (almost) all relavant arrays used in alifold's partition function computation. \end{DoxyCompactList}\end{DoxyCompactItemize}
51 \subsection*{Variables}
52 \begin{DoxyCompactItemize}
54 double \hyperlink{group__consensus__fold_gaf3cbac6ff5d706d6e414677841ddf94c}{cv\-\_\-fact}
55 \begin{DoxyCompactList}\small\item\em This variable controls the weight of the covariance term in the energy function of alignment folding algorithms. \end{DoxyCompactList}\item
56 double \hyperlink{group__consensus__fold_ga502948a122a2af5b914355b1f3ea2f61}{nc\-\_\-fact}
57 \begin{DoxyCompactList}\small\item\em This variable controls the magnitude of the penalty for non-\/compatible sequences in the covariance term of alignment folding algorithms. \end{DoxyCompactList}\end{DoxyCompactItemize}
60 \subsection{Detailed Description}
61 compute various properties (consensus M\-F\-E structures, partition function, Boltzmann distributed stochastic samples, ...) for R\-N\-A sequence alignments Consensus structures can be predicted by a modified version of the \hyperlink{group__mfe__fold_gaadafcb0f140795ae62e5ca027e335a9b}{fold()} algorithm that takes a set of aligned sequences instead of a single sequence. The energy function consists of the mean energy averaged over the sequences, plus a covariance term that favors pairs with consistent and compensatory mutations and penalizes pairs that cannot be formed by all structures. For details see\cite{hofacker:2002} and \cite{bernhart:2008}.
63 \subsection{Function Documentation}
64 \hypertarget{group__consensus__fold_gaa2d600be90844094ec145ea14a314d2f}{\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}!get\-\_\-mpi@{get\-\_\-mpi}}
65 \index{get\-\_\-mpi@{get\-\_\-mpi}!Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
66 \subsubsection[{get\-\_\-mpi}]{\setlength{\rightskip}{0pt plus 5cm}int get\-\_\-mpi (
67 \begin{DoxyParamCaption}
68 \item[{char $\ast$}]{Alseq\mbox{[}$\,$\mbox{]}, }
69 \item[{int}]{n\-\_\-seq, }
70 \item[{int}]{length, }
71 \item[{int $\ast$}]{mini}
72 \end{DoxyParamCaption}
73 )}}\label{group__consensus__fold_gaa2d600be90844094ec145ea14a314d2f}
76 Get the mean pairwise identity in steps from ?to?(ident)
79 \begin{DoxyParams}{Parameters}
82 {\em n\-\_\-seq} & The number of sequences in the alignment \\
84 {\em length} & The length of the alignment \\
89 \begin{DoxyReturn}{Returns}
90 The mean pairwise identity
92 \hypertarget{group__consensus__fold_ga1c48869c03b49a342bf4cbdd61900081}{\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}!energy\-\_\-of\-\_\-alistruct@{energy\-\_\-of\-\_\-alistruct}}
93 \index{energy\-\_\-of\-\_\-alistruct@{energy\-\_\-of\-\_\-alistruct}!Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
94 \subsubsection[{energy\-\_\-of\-\_\-alistruct}]{\setlength{\rightskip}{0pt plus 5cm}float energy\-\_\-of\-\_\-alistruct (
95 \begin{DoxyParamCaption}
96 \item[{const char $\ast$$\ast$}]{sequences, }
97 \item[{const char $\ast$}]{structure, }
98 \item[{int}]{n\-\_\-seq, }
99 \item[{float $\ast$}]{energy}
100 \end{DoxyParamCaption}
101 )}}\label{group__consensus__fold_ga1c48869c03b49a342bf4cbdd61900081}
104 Calculate the free energy of a consensus structure given a set of aligned sequences.
107 \begin{DoxyParams}{Parameters}
108 {\em sequences} & The N\-U\-L\-L terminated array of sequences \\
110 {\em structure} & The consensus structure \\
112 {\em n\-\_\-seq} & The number of sequences in the alignment \\
114 {\em energy} & A pointer to an array of at least two floats that will hold the free energies (energy\mbox{[}0\mbox{]} will contain the free energy, energy\mbox{[}1\mbox{]} will be filled with the covariance energy term) \\
117 \begin{DoxyReturn}{Returns}
118 free energy in kcal/mol
120 \hypertarget{group__consensus__fold_gaa3e40277c837d6f7603afe319884c786}{\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}!encode\-\_\-ali\-\_\-sequence@{encode\-\_\-ali\-\_\-sequence}}
121 \index{encode\-\_\-ali\-\_\-sequence@{encode\-\_\-ali\-\_\-sequence}!Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
122 \subsubsection[{encode\-\_\-ali\-\_\-sequence}]{\setlength{\rightskip}{0pt plus 5cm}void encode\-\_\-ali\-\_\-sequence (
123 \begin{DoxyParamCaption}
124 \item[{const char $\ast$}]{sequence, }
125 \item[{short $\ast$}]{S, }
126 \item[{short $\ast$}]{s5, }
127 \item[{short $\ast$}]{s3, }
128 \item[{char $\ast$}]{ss, }
129 \item[{unsigned short $\ast$}]{as, }
131 \end{DoxyParamCaption}
132 )}}\label{group__consensus__fold_gaa3e40277c837d6f7603afe319884c786}
135 Get arrays with encoded sequence of the alignment.
137 this function assumes that in S, S5, s3, ss and as enough space is already allocated (size must be at least sequence length+2)
140 \begin{DoxyParams}{Parameters}
141 {\em sequence} & The gapped sequence from the alignment \\
143 {\em S} & pointer to an array that holds encoded sequence \\
145 {\em s5} & pointer to an array that holds the next base 5' of alignment position i \\
147 {\em s3} & pointer to an array that holds the next base 3' of alignment position i \\
153 {\em circ} & assume the molecules to be circular instead of linear (circ=0) \\
156 \hypertarget{group__consensus__fold_ga8a560930f7f2582cc3967723a86cfdfa}{\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}!alloc\-\_\-sequence\-\_\-arrays@{alloc\-\_\-sequence\-\_\-arrays}}
157 \index{alloc\-\_\-sequence\-\_\-arrays@{alloc\-\_\-sequence\-\_\-arrays}!Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
158 \subsubsection[{alloc\-\_\-sequence\-\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}void alloc\-\_\-sequence\-\_\-arrays (
159 \begin{DoxyParamCaption}
160 \item[{const char $\ast$$\ast$}]{sequences, }
161 \item[{short $\ast$$\ast$$\ast$}]{S, }
162 \item[{short $\ast$$\ast$$\ast$}]{S5, }
163 \item[{short $\ast$$\ast$$\ast$}]{S3, }
164 \item[{unsigned short $\ast$$\ast$$\ast$}]{a2s, }
165 \item[{char $\ast$$\ast$$\ast$}]{Ss, }
167 \end{DoxyParamCaption}
168 )}}\label{group__consensus__fold_ga8a560930f7f2582cc3967723a86cfdfa}
171 Allocate memory for sequence array used to deal with aligned sequences.
173 Note that these arrays will also be initialized according to the sequence alignment given
175 \begin{DoxySeeAlso}{See Also}
176 \hyperlink{group__consensus__fold_ga298a420a8c879202e2617b3f724fde38}{free\-\_\-sequence\-\_\-arrays()}
179 \begin{DoxyParams}{Parameters}
180 {\em sequences} & The aligned sequences \\
182 {\em S} & A pointer to the array of encoded sequences \\
184 {\em S5} & A pointer to the array that contains the next 5' nucleotide of a sequence position \\
186 {\em S3} & A pointer to the array that contains the next 3' nucleotide of a sequence position \\
188 {\em a2s} & A pointer to the array that contains the alignment to sequence position mapping \\
190 {\em Ss} & A pointer to the array that contains the ungapped sequence \\
192 {\em circ} & assume the molecules to be circular instead of linear (circ=0) \\
195 \hypertarget{group__consensus__fold_ga298a420a8c879202e2617b3f724fde38}{\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}!free\-\_\-sequence\-\_\-arrays@{free\-\_\-sequence\-\_\-arrays}}
196 \index{free\-\_\-sequence\-\_\-arrays@{free\-\_\-sequence\-\_\-arrays}!Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
197 \subsubsection[{free\-\_\-sequence\-\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}void free\-\_\-sequence\-\_\-arrays (
198 \begin{DoxyParamCaption}
199 \item[{unsigned int}]{n\-\_\-seq, }
200 \item[{short $\ast$$\ast$$\ast$}]{S, }
201 \item[{short $\ast$$\ast$$\ast$}]{S5, }
202 \item[{short $\ast$$\ast$$\ast$}]{S3, }
203 \item[{unsigned short $\ast$$\ast$$\ast$}]{a2s, }
204 \item[{char $\ast$$\ast$$\ast$}]{Ss}
205 \end{DoxyParamCaption}
206 )}}\label{group__consensus__fold_ga298a420a8c879202e2617b3f724fde38}
209 Free the memory of the sequence arrays used to deal with aligned sequences.
211 This function frees the memory previously allocated with \hyperlink{group__consensus__fold_ga8a560930f7f2582cc3967723a86cfdfa}{alloc\-\_\-sequence\-\_\-arrays()}
213 \begin{DoxySeeAlso}{See Also}
214 \hyperlink{group__consensus__fold_ga8a560930f7f2582cc3967723a86cfdfa}{alloc\-\_\-sequence\-\_\-arrays()}
217 \begin{DoxyParams}{Parameters}
218 {\em n\-\_\-seq} & The number of aligned sequences \\
220 {\em S} & A pointer to the array of encoded sequences \\
222 {\em S5} & A pointer to the array that contains the next 5' nucleotide of a sequence position \\
224 {\em S3} & A pointer to the array that contains the next 3' nucleotide of a sequence position \\
226 {\em a2s} & A pointer to the array that contains the alignment to sequence position mapping \\
228 {\em Ss} & A pointer to the array that contains the ungapped sequence \\
231 \hypertarget{group__consensus__fold_ga0cc49457fd79eeb04d4a7f97c868b09b}{\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}!get\-\_\-alipf\-\_\-arrays@{get\-\_\-alipf\-\_\-arrays}}
232 \index{get\-\_\-alipf\-\_\-arrays@{get\-\_\-alipf\-\_\-arrays}!Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
233 \subsubsection[{get\-\_\-alipf\-\_\-arrays}]{\setlength{\rightskip}{0pt plus 5cm}int get\-\_\-alipf\-\_\-arrays (
234 \begin{DoxyParamCaption}
235 \item[{short $\ast$$\ast$$\ast$}]{S\-\_\-p, }
236 \item[{short $\ast$$\ast$$\ast$}]{S5\-\_\-p, }
237 \item[{short $\ast$$\ast$$\ast$}]{S3\-\_\-p, }
238 \item[{unsigned short $\ast$$\ast$$\ast$}]{a2s\-\_\-p, }
239 \item[{char $\ast$$\ast$$\ast$}]{Ss\-\_\-p, }
240 \item[{double $\ast$$\ast$}]{qb\-\_\-p, }
241 \item[{double $\ast$$\ast$}]{qm\-\_\-p, }
242 \item[{double $\ast$$\ast$}]{q1k\-\_\-p, }
243 \item[{double $\ast$$\ast$}]{qln\-\_\-p, }
244 \item[{short $\ast$$\ast$}]{pscore}
245 \end{DoxyParamCaption}
246 )}}\label{group__consensus__fold_ga0cc49457fd79eeb04d4a7f97c868b09b}
249 Get pointers to (almost) all relavant arrays used in alifold's partition function computation.
251 \begin{DoxyNote}{Note}
252 To obtain meaningful pointers, call alipf\-\_\-fold first!
254 \begin{DoxySeeAlso}{See Also}
255 pf\-\_\-alifold(), \hyperlink{group__consensus__pf__fold_ga6b4dde1d43b79ab3753508c46cf50363}{alipf\-\_\-circ\-\_\-fold()}
258 \begin{DoxyParams}{Parameters}
259 {\em S\-\_\-p} & A pointer to the 'S' array (integer representation of nucleotides) \\
261 {\em S5\-\_\-p} & A pointer to the 'S5' array \\
263 {\em S3\-\_\-p} & A pointer to the 'S3' array \\
265 {\em a2s\-\_\-p} & A pointer to the pair type matrix \\
267 {\em Ss\-\_\-p} & A pointer to the 'Ss' array \\
269 {\em qb\-\_\-p} & A pointer to the Q$^{\mbox{B}}$ matrix \\
271 {\em qm\-\_\-p} & A pointer to the Q$^{\mbox{M}}$ matrix \\
273 {\em q1k\-\_\-p} & A pointer to the 5' slice of the Q matrix ( $q1k(k) = Q(1, k)$) \\
275 {\em qln\-\_\-p} & A pointer to the 3' slice of the Q matrix ( $qln(l) = Q(l, n)$) \\
278 \begin{DoxyReturn}{Returns}
279 Non Zero if everything went fine, 0 otherwise
283 \subsection{Variable Documentation}
284 \hypertarget{group__consensus__fold_gaf3cbac6ff5d706d6e414677841ddf94c}{\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}!cv\-\_\-fact@{cv\-\_\-fact}}
285 \index{cv\-\_\-fact@{cv\-\_\-fact}!Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
286 \subsubsection[{cv\-\_\-fact}]{\setlength{\rightskip}{0pt plus 5cm}double cv\-\_\-fact}}\label{group__consensus__fold_gaf3cbac6ff5d706d6e414677841ddf94c}
289 This variable controls the weight of the covariance term in the energy function of alignment folding algorithms.
291 Default is 1. \hypertarget{group__consensus__fold_ga502948a122a2af5b914355b1f3ea2f61}{\index{Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}!nc\-\_\-fact@{nc\-\_\-fact}}
292 \index{nc\-\_\-fact@{nc\-\_\-fact}!Predicting Consensus Structures from Alignment(s)@{Predicting Consensus Structures from Alignment(s)}}
293 \subsubsection[{nc\-\_\-fact}]{\setlength{\rightskip}{0pt plus 5cm}double nc\-\_\-fact}}\label{group__consensus__fold_ga502948a122a2af5b914355b1f3ea2f61}
296 This variable controls the magnitude of the penalty for non-\/compatible sequences in the covariance term of alignment folding algorithms.