| 1 |
\section{Infernal 1.1's profile/sequence comparison pipeline} |
| 2 |
\label{section:pipeline} |
| 3 |
\setcounter{footnote}{0} |
| 4 |
|
| 5 |
In this section, we briefly outline the processing pipeline for a |
| 6 |
single profile/sequence comparison. This should help give you a sense |
| 7 |
of what Infernal is doing under the hood, what sort of mistakes it may |
| 8 |
make, and what the various results in the output actually mean. If you |
| 9 |
haven't already worked through the tutorial section of the guide, you |
| 10 |
should do that first before reading this section as it lays some |
| 11 |
foundation for this discussion. |
| 12 |
|
| 13 |
We'll first discuss the \emph{standard} pipeline used by Infernal, |
| 14 |
which is excecuted on each comparison between a CM and full length |
| 15 |
sequence. Then we'll discuss \emph{truncated variants} of the pipeline |
| 16 |
that are \emph{re}run on the sequence ends for detection of truncated |
| 17 |
hits. Finally, we'll cover the HMM-only pipeline which is run for |
| 18 |
models with zero basepairs. Before we begin, a few notes on |
| 19 |
terminology. In this discussion, the term ``profile'' refers to either |
| 20 |
a profile HMM filter or a CM, and nucleotide and residue are used |
| 21 |
interchangeably for a single symbol of an input DNA/RNA sequence (even |
| 22 |
though ``residue'' traditionally refers to an amino acid residue of a |
| 23 |
protein sequence). Also, if I refer to ``the pipeline'' without |
| 24 |
specifying which variant (standard or a truncated one), then I mean |
| 25 |
the standard one. |
| 26 |
|
| 27 |
Infernal's standard pipeline is based closely on the profile |
| 28 |
HMM/sequence comparison pipeline in HMMER3 (\url{hmmer.org}). In fact, |
| 29 |
the first several stages of the pipeline use code from HMMER's |
| 30 |
pipeline to score candidate sequences with profile HMMs that act as |
| 31 |
filters for the later, more computationally expensive CM stages. |
| 32 |
|
| 33 |
In briefest outline, the comparison pipeline takes the following |
| 34 |
steps: |
| 35 |
|
| 36 |
\begin{description} |
| 37 |
\item[Profile HMM filter stages:] The first several stages of the |
| 38 |
pipeline use only a profile HMM, putting off all calculations with |
| 39 |
the CM until later. Since profile HMM algorithms are less complex |
| 40 |
than CM ones, this saves time by only using the expensive CM |
| 41 |
methods for regions the HMM has identified as having a good chance |
| 42 |
of containing a high-scoring hit. Of course, by relying on |
| 43 |
sequence-only based filters like HMMs, we are potentially going to |
| 44 |
miss homologs that are divergent at the sequence level but that the |
| 45 |
CM would still score highly thanks to conserved secondary |
| 46 |
structure. Our benchmarks reveal this is rare, but it does happen |
| 47 |
and is an important failure mode to keep in mind. |
| 48 |
|
| 49 |
The profile HMM filter stages are very closely based on the similar |
| 50 |
steps in HMMER3's accelerated comparison pipeline with the important |
| 51 |
difference that both \emph{local} and \emph{glocal} versions of HMM |
| 52 |
algorithms are used. |
| 53 |
|
| 54 |
Here's a list of the profile HMM filter stages: |
| 55 |
\begin{description} |
| 56 |
\item[\textbf{Null model.}] Calculate a score term for the ``null |
| 57 |
hypothesis'' (a probability model of \emph{non-}homology). This |
| 58 |
score correction is used to turn all subsequent profile/sequence bit |
| 59 |
scores into a final log-odds bit score. |
| 60 |
|
| 61 |
\item[\textbf{Local scanning SSV filter.}] The SSV (``Single Segment |
| 62 |
Viterbi'') algorithm looks for high-scoring \emph{ungapped} |
| 63 |
alignments. Each sequence segment (referred to as a ``diagonal'') in |
| 64 |
a SSV alignment is extended slightly to define a window. Overlapping |
| 65 |
windows are merged together into a single window. Then, long windows |
| 66 |
greater than a maximum length $2L$ (where $L$ is the maximum of the |
| 67 |
model's $W$ parameter\footnote{$W$ is the expected maximum hit |
| 68 |
length for the model calculated by \prog{cmbuild} and stored in the |
| 69 |
CM file} and $1.25$ times the consensus length of the model) are |
| 70 |
split into multiple windows of length $2L$ with $L-1$ overlapping |
| 71 |
nucleotides between adjacent windows. Each window is then passed on |
| 72 |
to the next next pipeline step. Any nucleotides that are not |
| 73 |
contained in an SSV window are not evaluated further. |
| 74 |
|
| 75 |
\item[\textbf{Local Viterbi filter.}] A more stringent accelerated |
| 76 |
filter. An optimal (maximum likelihood) gapped alignment score is |
| 77 |
calculated for each sequence window that survived SSV. If this score |
| 78 |
passes a set threshold, the sequence passes to the next step; else |
| 79 |
it is rejected. |
| 80 |
|
| 81 |
\item[\textbf{Bias filter.}] A hack that reduces false positive |
| 82 |
Viterbi hits due to biased composition sequences. A two-state HMM is |
| 83 |
constructed from the mean nucleotide composition of the profile HMM |
| 84 |
and the standard nucleotide composition of the null model, and used |
| 85 |
to score the sequence window. The Viterbi bit score is corrected |
| 86 |
using this as a second null hypothesis. If the Viterbi score still |
| 87 |
passes the Viterbi threshold, the sequence passes on to the next |
| 88 |
step; else it is rejected. \emph{The bias filter score correction |
| 89 |
will also be applied to the local Forward filter and glocal Forward |
| 90 |
filter scores that follow.} |
| 91 |
|
| 92 |
\item[\textbf{Local Forward filter.}] The full likelihood of |
| 93 |
the profile/sequence window comparison is evaluated, summed over the |
| 94 |
entire alignment ensemble, using the HMM Forward algorithm with the |
| 95 |
HMM in \emph{local} mode. This score is corrected to a bit score using the |
| 96 |
null model and bias filter scores. If the bit score passes a set |
| 97 |
threshold, the sequence window passes on to the next step; else it |
| 98 |
is rejected. |
| 99 |
|
| 100 |
\item[\textbf{Glocal Forward filter/parser.}] The HMM Forward |
| 101 |
algorithm is again used to evaluate the full likelihood of the |
| 102 |
profile/sequence window comparison, but this time the HMM is |
| 103 |
configured in \emph{global} mode, which requires that any valid |
| 104 |
alignment begin at the first consensus position (match or delete) |
| 105 |
and end at the final consensus position. (In local mode alignments |
| 106 |
can begin and end at any model positios.) Aligments in this stage, |
| 107 |
as in all previous stages can be local \emph{with respect to the |
| 108 |
sequence} (starting and ending at any sequence position), which is |
| 109 |
why this stage is referred to as \emph{glocal}: global with respect |
| 110 |
to the model and local with respect to the sequence. The glocal |
| 111 |
Forward score is corrected to a bit score using the null model and |
| 112 |
bias filter scores. If the bit score passes a set threshold, the |
| 113 |
sequence window passes on to the next step; else it is rejected. |
| 114 |
|
| 115 |
\item[\textbf{Glocal envelope definition.}] Using the glocal Forward |
| 116 |
parser results, now combined with glocal Backward parser results, |
| 117 |
posterior probabilities that each nucleotide in the window is aligned |
| 118 |
to a position of the model are calculated. A discrete set of |
| 119 |
putative alignments is identified by applying heuristics to |
| 120 |
posterior probabilities. This procedure identifies \emph{envelopes}: |
| 121 |
subsequences in the target sequence window which contain a lot of |
| 122 |
probability mass for a match to the profile. The envelopes are often |
| 123 |
significantly shorter than the full window, containing only nucleotides |
| 124 |
that have a signficant probability of aligning to the HMM, which is |
| 125 |
critical for the subsequent CM stages of the pipeline. Each |
| 126 |
envelope's (there can be more than one if the evaluation reveals |
| 127 |
multiple full length alignments in a single window) glocal Forward |
| 128 |
score is corrected to a bit score using the null model and bias |
| 129 |
filter scores. If the bit score passes a set threshold, the sequence |
| 130 |
envelope passes on to the next step; else it is rejected. |
| 131 |
|
| 132 |
\end{description} |
| 133 |
|
| 134 |
\item[Covariance model stages:] The remainder of the pipeline uses the |
| 135 |
CM to evaluate each envelope that survived the profile HMM filter |
| 136 |
stages. |
| 137 |
|
| 138 |
\begin{description} |
| 139 |
\item[\textbf{HMM banded CYK filter.}] For each envelope, posterior |
| 140 |
probabilities that each sequence residue aligns to each state of a |
| 141 |
profile HMM is computed\footnote{The profile HMM used at this stage |
| 142 |
is referred to as a CM plan 9 (CP9) HMM in it the code. It is |
| 143 |
similar but not identical to the one used for filtering. It was |
| 144 |
constructed to be maximally similar to the CM and includes |
| 145 |
transitions between insert and delete states not allowed in the |
| 146 |
HMMER plan 7 models used in the filtering steps. CP9 HMMs are |
| 147 |
essentially a reimplementation of the maximum likelihood heuristic |
| 148 |
HMM described in \citep{WeinbergRuzzo06}.} and used to derive bands |
| 149 |
(constraints) for the CM CYK algorithm \citep{Brown00, |
| 150 |
Nawrocki09b}. A banded version of the CYK algorithm is used to |
| 151 |
determine the bit score of the maximum likelihood alignment of any |
| 152 |
subsequence within the envelope to the CM that is consistent with |
| 153 |
the HMM-derived bands. If this score passes a set threshold, the |
| 154 |
sequence envelope passes on to the next step; else it is rejected. |
| 155 |
Additionally, the boundaries of the envelope may be modified |
| 156 |
(shortened: the start position increased and/or the end position |
| 157 |
decreased) at this stage, as detailed below. |
| 158 |
|
| 159 |
\item[\textbf{HMM banded Inside parser.}] The full likelihood of the |
| 160 |
profile/sequence envelope is now evaluated, summed over the entire |
| 161 |
alignment ensemble for every subsequence of the envelope, using the |
| 162 |
CM Inside algorithm. Again HMM bands are used to constrain the CM |
| 163 |
dynamic programming calculations. This procedure identifies zero or |
| 164 |
more non-overlapping \emph{hits}, each defined as a subsequence in |
| 165 |
the envelope. An \emph{ad hoc} ``null3'' hypothesis is constructed |
| 166 |
for each hit's composition and used to calculate a biased |
| 167 |
composition score correction. The null3 score is subtracted from the |
| 168 |
Inside bit score and an E-value is computed for that score. |
| 169 |
|
| 170 |
\item[\textbf{CM bias filter: the ``null3'' model.}] To reduce false |
| 171 |
positive CM hits due to biased composition sequences, the Inside |
| 172 |
score is adjusted using a bias filter that is similar, but not |
| 173 |
identical, to the one used by the HMM stages. A single state HMM is |
| 174 |
constructed with emission probabilities equal to the mean nucleotide |
| 175 |
composition of the sequence of the hit, and used to score the hit. |
| 176 |
The Inside bit score is corrected using this as a second null |
| 177 |
hypothesis. |
| 178 |
|
| 179 |
\item[\textbf{Alignment.}] For each identified hit, the HMM banded |
| 180 |
Inside/Outside algorithm is performed and an optimal accuracy (also |
| 181 |
sometimes called maximum expected accuracy) alignment is |
| 182 |
calculated. |
| 183 |
|
| 184 |
\item[\textbf{Storage.}] Now we have a \emph{hit score} (and E-value) |
| 185 |
and each hit has an optimal accuracy alignment annotated with |
| 186 |
per-residue posterior probabilities. |
| 187 |
|
| 188 |
\end{description} |
| 189 |
\end{description} |
| 190 |
|
| 191 |
\subsection{Filter thresholds are dependent on database size} |
| 192 |
Before we go into more detail on each stage, we'll briefly discuss the |
| 193 |
filter thresholds used for each stage of the pipeline. These are the |
| 194 |
P-values required for a window or envelope to pass each stage of the |
| 195 |
pipeline. Unlike in HMMER, in which the filter thresholds are always |
| 196 |
the same regardless of the query and target, in Infernal, the HMM |
| 197 |
filter thresholds are dependent on the size of the search space. We |
| 198 |
use the parameter $Z$ in the code and in this documentation to |
| 199 |
represent the search space. |
| 200 |
|
| 201 |
For \prog{cmsearch}, $Z$ is the size of the target sequence database, |
| 202 |
in total number of nucleotides, multiplied by 2 because both strands |
| 203 |
of each sequence will be searched. For \prog{cmscan}, $Z$ is defined |
| 204 |
differently; it is the length of the current query sequence (again, |
| 205 |
multiplied by 2) in nucleotides \emph{multiplied by the number of |
| 206 |
models in the target CM database}. |
| 207 |
|
| 208 |
In general, the larger the search space, the stricter the filter |
| 209 |
thresholds become. The specific thresholds used for all stages of the |
| 210 |
pipeline for all possible search space sizes $Z$ are given in |
| 211 |
Table~\ref{tbl:thresholds}. |
| 212 |
|
| 213 |
The rationale for making filter thresholds more strict as $Z$ |
| 214 |
increases is as follows. As $Z$ increases so too does the CM bit score |
| 215 |
necessary for a hit to reach the E-value reporting threshold (by |
| 216 |
default 10.0). If we assume that a hit's filter HMM score increases |
| 217 |
with its CM score (which should be true for most true homologs), then it |
| 218 |
follows that we should be able to decrease filter P-value thresholds |
| 219 |
as $Z$ increases without sacrificing sensitivity relative to an |
| 220 |
unfiltered search. Of course, it's unclear exactly how much we can |
| 221 |
decrease the thresholds by before we start losing an unacceptable |
| 222 |
amount of sensitivity. We've taken an empirical approach to determine |
| 223 |
this by measuring performance on an internal benchmark of remote |
| 224 |
structural RNA homology search based on Rfam. The sets of filter |
| 225 |
thresholds in Table~\ref{tbl:thresholds} were determined to achieve |
| 226 |
what we feel is a good trade-off between sensitivity, specificity and |
| 227 |
speed on that benchmark. |
| 228 |
|
| 229 |
% Source of table: |
| 230 |
% ~nawrockie/notebook/12_0326_talk_xfam/latex/xfam.tex |
| 231 |
% 'Avg relative speed' row calc'ed using relative rmark3 times |
| 232 |
% from 'Avg model per Gb time' row of the version of the |
| 233 |
% table in ~nawrockie/notebook/12_0326_talk_xfam/latex/xfam.tex, |
| 234 |
% and rounding. |
| 235 |
% |
| 236 |
\begin{center} |
| 237 |
\begin{table} |
| 238 |
\small |
| 239 |
\begin{tabular}{lll|r|r|r|r|r|r|} |
| 240 |
\multicolumn{3}{c}{} & \multicolumn{6}{|c|}{size of search space ($Z$)} \\ \cline{4-9} |
| 241 |
& & model & & 2Mb & 20Mb & 200Mb & 2Gb & \\ |
| 242 |
filter stage & model & configuration & $<$ 2Mb & to 20Mb & to 200Mb & to 2Gb & to 20Gb & $>$ 20Gb \\ \hline |
| 243 |
& & & & & & & & \\ |
| 244 |
SSV & HMM & local & 0.35 & 0.35 & 0.35 & 0.15 & 0.15 & 0.06 \\ |
| 245 |
& & & & & & & & \\ |
| 246 |
Viterbi & HMM & local & off & off & 0.15 & 0.15 & 0.15 & 0.02 \\ |
| 247 |
& & & & & & & & \\ |
| 248 |
Forward & HMM & local & 0.02 & 0.005 & 0.003 & 0.0008 & 0.0002 & 0.0002 \\ |
| 249 |
& & & & & & & & \\ |
| 250 |
Forward & HMM & global & 0.02 & 0.005 & 0.003 & 0.0008 & 0.0002 & 0.0002 \\ |
| 251 |
& & & & & & & & \\ |
| 252 |
envelope definition & HMM & global & 0.02 & 0.005 & 0.003 & 0.0008 & 0.0002 & 0.0002 \\ |
| 253 |
& & & & & & & & \\ |
| 254 |
HMM banded CYK & CM & local & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 & 0.0001 \\ |
| 255 |
& & & & & & & & \\ |
| 256 |
HMM banded Inside & CM & local & E $\leq$ 10 & E $\leq$ 10 & E $\leq$ 10 & E $\leq$ 10 & E $\leq$ 10 & E $\leq$ 10 \\ \hline |
| 257 |
& & & & & & & & \\ |
| 258 |
%Avg model per Gb time & & 3.48h & 1.25h & 0.54h & 0.27h & 0.18h & 0.11h \\ |
| 259 |
\multicolumn{3}{c|}{Average relative running time per Mb} & 30.0 & 10.0 & 5.0 & 2.5 & 1.5 & 1.0 \\ |
| 260 |
\end{tabular} |
| 261 |
\caption{\textbf{Default P-value survival thresholds used for each |
| 262 |
filter stage for different search space sizes $Z$.} These values can |
| 263 |
be changed with command-line options as described in the text. The |
| 264 |
``HMM banded Inside'' stage is not actually a filter, hits with an |
| 265 |
E-value $\leq$ 10 after this stage are reported to the search output. |
| 266 |
The final line ``Average relative running time'' |
| 267 |
provides rough estimates of the relative speed per Mb of the different |
| 268 |
parameter settings for each range of $Z$ (these are relative units, |
| 269 |
not an actual unit of time like minutes). Importantly, $Z$ is |
| 270 |
defined differently in \prog{cmsearch} and \prog{cmscan}. In |
| 271 |
\prog{cmsearch}, $Z$ is the total number of nucleotides in the |
| 272 |
target database file multiplied by 2 (because both strands of each |
| 273 |
sequence is searched). For \prog{cmscan}, $Z$ is the length of the |
| 274 |
current query sequence multiplied by 2 (because both strands of the |
| 275 |
sequence are searched) and multiplied again by the number of CMs in |
| 276 |
the target CM database.} |
| 277 |
\label{tbl:thresholds} |
| 278 |
\end{table} |
| 279 |
\end{center} |
| 280 |
|
| 281 |
\subsection{Manually setting filter thresholds} |
| 282 |
|
| 283 |
As described above, by default filter thresholds are automatically set |
| 284 |
based on the search space $Z$, but several options exist for |
| 285 |
overriding these defaults. There are four pre-defined sets of |
| 286 |
thresholds, each available via a single command-line option to |
| 287 |
\prog{cmsearch} or \prog{cmscan}. In order from least strict to most |
| 288 |
strict these are: \ccode{--max}, \ccode{--nohmm}, \ccode{--mid}, and |
| 289 |
\ccode{--rfam}. (The default thresholds lie somewhere between |
| 290 |
\ccode{--mid} and \ccode{--rfam}.) Additionally, you can specify that |
| 291 |
the filter thresholds be set as if the search space was \ccode{<x>} |
| 292 |
megabases with the \ccode{--FZ <x>} option. More detail on each of |
| 293 |
these options is provided below. A one-line description of each option |
| 294 |
is printed as part of the \prog{cmsearch} and \prog{cmscan} 'help' |
| 295 |
output that gets displayed with the use of the \ccode{-h} |
| 296 |
option. There's also descriptions of these options in the |
| 297 |
\prog{cmsearch} and \prog{cmscan} manual pages. |
| 298 |
|
| 299 |
\begin{description} |
| 300 |
\item[\ccode{--max}:] Turn off all filters, run Inside on full length |
| 301 |
target sequences. This option will result in maximum sensitivity but |
| 302 |
is also the slowest. Using this option will slow down |
| 303 |
\prog{cmsearch} by about 3 or 4 orders of magnitude for typical |
| 304 |
searches. |
| 305 |
\item[\ccode{--nohmm}:] Turn off all profile HMM filters, run only the |
| 306 |
CYK filter on full length sequences and Inside on surviving |
| 307 |
envelopes. Searches with this option will often be between 5 and |
| 308 |
10 times faster than \ccode{--max} searches. |
| 309 |
\item[\ccode{--mid}:] Turn off the SSV and Viterbi filters, and set |
| 310 |
all profile HMM filter thresholds (local Forward, glocal Forward and |
| 311 |
glocal domain definition) to the same, set P-value. By default this |
| 312 |
P-value is $0.02$, but it is settable to \ccode{<x>} by also using |
| 313 |
the \ccode{--Fmid <x>} option. |
| 314 |
\item[\ccode{--rfam}:] Set all filter thresholds as if the search |
| 315 |
space were more than 20 Gb. These are the filter thresholds used by |
| 316 |
a database like Rfam, which annotates RNAs in an EMBL-based sequence |
| 317 |
dataset that is several hundred Gb. If you're trying to |
| 318 |
reproduce results in future versions of Rfam that use Infernal 1.1 |
| 319 |
(of course, at the time of writing, no version of Rfam yet exists |
| 320 |
which has used version 1.1) you probably want to use this option. |
| 321 |
This option will have no effect if the target search space is more |
| 322 |
than 20 Gb. |
| 323 |
\item[\ccode{--FZ <x>}:] Set the filter thresholds as if the search space |
| 324 |
were \ccode{<x>} Mb instead of its actual size. Importantly, the E-values |
| 325 |
reported will still correspond to the actual size. (To change the |
| 326 |
search space size the E-values correspond to, use the \ccode{-Z <x2>} |
| 327 |
option\footnote{Note that if you use \ccode{-Z <x2>} without |
| 328 |
\ccode{--FZ <x>}, the filter thresholds will be set as if the |
| 329 |
search space size is \ccode{<x2>} Mb.}.) |
| 330 |
\end{description} |
| 331 |
|
| 332 |
For expert users, options also exist to precisely set each individual |
| 333 |
filter stage's threshold. Each stage is referred to by an option that |
| 334 |
begins with \ccode{F} and ends with a number for the stages position |
| 335 |
in the pipeline (SSV is F1, local Viterbi is F2, and so on). Also, |
| 336 |
options that pertain to the bias filter part of each stage end in |
| 337 |
\ccode{b}. The complete list of options for controlling the filter |
| 338 |
thresholds is: \ccode{--F1}, \ccode{--F1b}, \ccode{--F2}, |
| 339 |
\ccode{--F2b}, \ccode{--F3}, \ccode{--F3b}, \ccode{--F4}, |
| 340 |
\ccode{--F4b}, \ccode{--F5}, \ccode{--F5b}, and |
| 341 |
\ccode{--F6}. Additional options exist for turning on or of each stage |
| 342 |
as well: \ccode{--noF1}, \ccode{--doF1b}, \ccode{--noF2}, |
| 343 |
\ccode{--noF2b}, \ccode{--noF3}, \ccode{--noF3b}, \ccode{--noF4}, |
| 344 |
\ccode{--noF4b}, \ccode{--noF5}, \ccode{--noF5b}, and \ccode{--noF6}. |
| 345 |
Because these options are only expected to be useful to a small |
| 346 |
minority of users, they are only displayed in the help message for |
| 347 |
\prog{cmsearch} or \prog{cmscan} if the special \ccode{--devhelp} |
| 348 |
option is used. |
| 349 |
|
| 350 |
\subsection{In more detail: profile HMM filter stages} |
| 351 |
|
| 352 |
Now we'll go back and revisit each stage of the pipeline in a bit more detail. |
| 353 |
|
| 354 |
\subsubsection{Null model.} |
| 355 |
|
| 356 |
The ``null model'' calculates the probability that the target |
| 357 |
subsequence (window or envelope) is \emph{not} homologous to the query |
| 358 |
profile. A profile HMM or CM bit score is the log of the ratio of the |
| 359 |
sequence's probability according to the profile (the homology |
| 360 |
hypothesis) over the null model probability (the non-homology |
| 361 |
hypothesis). |
| 362 |
|
| 363 |
The null model is a one-state HMM configured to generate ``random'' |
| 364 |
sequences of the same mean length $L$ as the target subsequence window |
| 365 |
or envelope being evaluated\footnote{For the SSV filter, which |
| 366 |
examines full length target sequences instead of windows, $L$ is set |
| 367 |
as the expected maximum length of a hit for the profile, defined as |
| 368 |
the maximum of the $1.25$ times the consensus length of the model and |
| 369 |
the $W$ parameter for the CM we're filtering for. The $W$ parameter is |
| 370 |
calculated by \prog{cmbuild}.}, with each residue drawn from a |
| 371 |
background frequency distribution of $0.25$ for all four RNA |
| 372 |
nucleotides (a standard i.i.d. model: residues are treated as |
| 373 |
independent and identically distributed). This null model is used for |
| 374 |
the profile HMM and the CM stages of the pipeline. |
| 375 |
|
| 376 |
For technical reasons, the \emph{residue emission} probabilities of |
| 377 |
the null model are incorporated directly into the profile HMM, by |
| 378 |
turning each emission probability in the profile into an odds |
| 379 |
ratio. The null model score calculation therefore is only concerned |
| 380 |
with accounting for the remaining \emph{transition} probabilities of |
| 381 |
the null model and toting them up into a bit score correction. The |
| 382 |
null model calculation is fast, because it only depends on the length |
| 383 |
of the target sequence window being evaluated, not its sequence. |
| 384 |
|
| 385 |
\subsubsection{SSV filter.} |
| 386 |
|
| 387 |
The sequence is aligned to the profile using a specialized model that |
| 388 |
allows a single high-scoring local ungapped segment to match. The |
| 389 |
optimal alignment score (Viterbi score) is calculated under this |
| 390 |
specialized model, hence the term SSV, for ``single-segment |
| 391 |
Viterbi''. SSV is similar, but not identical to, the MSV |
| 392 |
(``multi-segment Viterbi) algorithm used by the programs in HMMER |
| 393 |
for protein sequence analysis. There are two main differences. First, |
| 394 |
SSV only allows a single ungapped segment match between the sequence |
| 395 |
and specialized model. Second, the variant of SSV used by Infernal is |
| 396 |
designed for scanning along potentially long sequences (think |
| 397 |
chromosomes instead of protein sequences) and potentially finding many |
| 398 |
high-scoring hits in each sequence. This scanning SSV algorithm was |
| 399 |
developed by Travis Wheeler for a soon-to-be released version of HMMER |
| 400 |
that includes a program for DNA homology search called \prog{nhmmer}. |
| 401 |
|
| 402 |
Vector parallelization methods are used to accelerate optimal ungapped |
| 403 |
alignment in SSV. The P-value threshold for what subsequences pass |
| 404 |
this filter range from $0.35$ for small target databases down to |
| 405 |
$0.06$ for large ones (Table~\ref{tbl:thresholds}). Take as an |
| 406 |
example, the \prog{cmsearch} for tRNAs performed in the tutorial. The |
| 407 |
database size was roughly 6 Mb, so the SSV threshold was set as |
| 408 |
$0.35$. This means that about 35\% of nonhomologous sequence is |
| 409 |
expected to pass. |
| 410 |
|
| 411 |
The SSV bit score is calculated as a log-odds score using the null |
| 412 |
model for comparison. No correction for a biased composition or |
| 413 |
repetitive sequence is done at this stage. For comparisons involving |
| 414 |
biased sequences and/or profiles, more than 35\% of comparisons will |
| 415 |
pass the SSV filter. For the tRNA search from the tutorial, the end of |
| 416 |
the search output contained a line like: |
| 417 |
|
| 418 |
\begin{sreoutput} |
| 419 |
Windows passing local HMM SSV filter: 11197 (0.2108); expected (0.35) |
| 420 |
\end{sreoutput} |
| 421 |
|
| 422 |
which tells you how many windows and what fraction of the total |
| 423 |
database was comprised by those windows passed the |
| 424 |
SSV filter, versus what fraction was expected. |
| 425 |
|
| 426 |
The \ccode{--F1 <x>} expert option sets filter P-value threshold for |
| 427 |
passing the SSV filter to \ccode{<x>}. The \ccode{--doF1b} and |
| 428 |
\ccode{--F1b <x>} options turn on a SSV bias filter (described further |
| 429 |
below) and control its P-value threshold, respectively. SSV is turned |
| 430 |
off if the \ccode{--max}, \ccode{--nohmm}, \ccode{--mid}, or |
| 431 |
\ccode{--noF1} options are used. |
| 432 |
|
| 433 |
\subsubsection{Local Viterbi filter.} |
| 434 |
Each sequence window that survives the SSV filter is now aligned to |
| 435 |
the profile HMM using a fast Viterbi algorithm for optimal gapped |
| 436 |
alignment. This stage is identical the Viterbi stage of the HMMER3 |
| 437 |
pipeline. |
| 438 |
|
| 439 |
This Viterbi implementation is specialized for speed. It is |
| 440 |
implemented in 8-way parallel SIMD vector instructions, using reduced |
| 441 |
precision scores that have been scaled to 16-bit integers. Only one |
| 442 |
row of the dynamic programming matrix is stored, so the routine only |
| 443 |
recovers the score, not the optimal alignment itself. The reduced |
| 444 |
representation has limited range; local alignment scores will not |
| 445 |
underflow, but high scoring comparisons can overflow and return |
| 446 |
infinity, in which case they automatically pass the filter. |
| 447 |
|
| 448 |
The final Viterbi filter bit score is then computed using the null |
| 449 |
model score. |
| 450 |
|
| 451 |
As with SSV, and all other HMM filter stages, the local Viterbi filter |
| 452 |
threshold depends on the search space $Z$. It is the only stage that |
| 453 |
is actually turned off if $Z$ is low enough (less than $20$ Mb). |
| 454 |
For the tRNA search used in the tutorial $Z$ was less than $20$ Mb, so |
| 455 |
the local Viterbi filter was turned off, and the following line was |
| 456 |
included in the output in the pipeline summary output: |
| 457 |
|
| 458 |
\begin{sreoutput} |
| 459 |
Windows passing local HMM Viterbi filter: (off) |
| 460 |
\end{sreoutput} |
| 461 |
|
| 462 |
For searches with $Z$ greater than $20$ Mb, this line would be |
| 463 |
formatted similar to the one for the SSV filter. For example, |
| 464 |
a search of the tRNA model from the tutorial against the |
| 465 |
\emph{Saccharomyces cerevisiae} genome results in: |
| 466 |
|
| 467 |
\begin{sreoutput} |
| 468 |
Windows passing local HMM Viterbi filter: 20666 (0.09861); expected (0.15) |
| 469 |
\end{sreoutput} |
| 470 |
|
| 471 |
In this search $20666$ windows have survived the local Viterbi filter, |
| 472 |
comprising $0.09861$ fraction of all nucleotides searched. The |
| 473 |
expected survival fraction was $0.15$. This large of a deviation from |
| 474 |
expectation is common. One reason for it is that the $0.15$ |
| 475 |
expectation assumes that the full (100\%) of the database is subjected |
| 476 |
to the Viterbi filter, but remember that only the fraction that |
| 477 |
survived SSV will be (roughly 35\%). You might expect that in general |
| 478 |
most of the windows that would eventually survive Viterbi would also |
| 479 |
survive SSV, but surely some of them will fail to pass SSV which will |
| 480 |
lower the expectation from $0.15$. Exactly how much it will lower it |
| 481 |
is based on many factors and is probably difficult to predict |
| 482 |
accurately - Infernal doesn't even try. So while $0.15$ is printed as |
| 483 |
the expectation, you will often observe survival fractions |
| 484 |
substantially lower than this. This same logic applies to all |
| 485 |
downstream filter stages. There are other factors at play here too, |
| 486 |
including biased composition effects, which will also impact the |
| 487 |
accuracy of the survival fraction predictions of all other stages of |
| 488 |
the pipeline. |
| 489 |
|
| 490 |
The \ccode{--F2 <x>} option controls the P-value threshold for passing |
| 491 |
the Viterbi filter, and can be turned off with \ccode{--noF2}. The |
| 492 |
local Viterbi filter is also turned off if the \ccode{--max}, |
| 493 |
\ccode{--nohmm}, or \ccode{--mid} options are used. |
| 494 |
|
| 495 |
\subsubsection{Biased composition filter.} |
| 496 |
|
| 497 |
It's possible for profile HMMs and/or sequences to have biased nucleotide |
| 498 |
compositions that result in ``significant'' log-odds bit scores not |
| 499 |
because the profile matches the sequence particularly well, but |
| 500 |
because the \emph{null model} matches the sequence particularly badly. |
| 501 |
|
| 502 |
In a few cases, profiles and/or target sequences are sufficiently |
| 503 |
biased that too many comparisons pass the local Viterbi or local |
| 504 |
Forward stages of the filter pipeline, causing Infernal speed |
| 505 |
performance to be severely degraded. The treatment of biased |
| 506 |
composition comparisons is a serious problem for the HMM |
| 507 |
implementations in HMMER and Infernal. Solving it well will require |
| 508 |
more research. As a stopgap solution to rescuing most of the speed |
| 509 |
degradation while not sacrificing too much sensitivity, an \emph{ad |
| 510 |
hoc} biased composition filtering step is applied to remove highly |
| 511 |
biased comparisons. |
| 512 |
|
| 513 |
On the fly, a two-state HMM is constructed. One state emits nucleotides |
| 514 |
from the background frequency distribution (same as the null1 model), |
| 515 |
and the other state emits nucleotides from the mean nucleotide composition |
| 516 |
of the profile (i.e. the expected composition of sequences generated |
| 517 |
by the core model, including match and insert states |
| 518 |
[\ccode{hmmer/src/p7\_hmm.c:p7\_hmm\_SetComposition()}]). Thus if the profile is |
| 519 |
highly biased (A-rich, for example), this composition bias will be captured |
| 520 |
by this second state. This model's transitions are arbitrarily set |
| 521 |
such that state 1 emits an expected length of the size of the current |
| 522 |
window, and state |
| 523 |
2 emits an expected length of M/8 at a time (for a profile HMM of |
| 524 |
consensus length |
| 525 |
M). An overall target sequence length distribution is set to a mean of |
| 526 |
$L$, identical to the null1 model. |
| 527 |
|
| 528 |
The sequence is then rescored using this ``bias filter model'' in |
| 529 |
place of the null1 model, using the HMM Forward algorithm. A new |
| 530 |
local Viterbi bit score is obtained. If the P-value of this satisfies |
| 531 |
the local Viterbi bias filter threshold, the sequence passes to the |
| 532 |
next stage of the pipeline. |
| 533 |
|
| 534 |
The bias filter score is used in an analogous way in the next two |
| 535 |
stages of the pipeline: the local Forward and glocal Forward stages. |
| 536 |
The biased composition filter step compromises a small amount of |
| 537 |
sensitivity. Though it is good to have it on by default, you may want |
| 538 |
to shut it off if you know you will have no problem with biased |
| 539 |
composition hits. |
| 540 |
|
| 541 |
The default value used for the local Viterbi bias filter depends on |
| 542 |
the search space size, $Z$. Like the local Viterbi filter it is turned |
| 543 |
off by default if $Z$ is less than $20$ Mb. So it too was off in the |
| 544 |
example tRNA search from the tutorial, and the summary line in the |
| 545 |
output was: |
| 546 |
|
| 547 |
\begin{sreoutput} |
| 548 |
Windows passing local HMM Viterbi bias filter: (off) |
| 549 |
\end{sreoutput} |
| 550 |
|
| 551 |
For searches with $Z$ greater than $20$ Mb, this line would be |
| 552 |
formatted similar to the one for the SSV filter. For example, |
| 553 |
a search of the tRNA model from the tutorial against the |
| 554 |
\emph{Saccharomyces cerevisiae} genome results in: |
| 555 |
|
| 556 |
\begin{sreoutput} |
| 557 |
Windows passing local HMM Viterbi bias filter: 20342 (0.09712); expected (0.15) |
| 558 |
\end{sreoutput} |
| 559 |
|
| 560 |
So $20342$ windows survive this stage, making up $0.09712$ fraction of |
| 561 |
the total sequence space searched. A similar line is included above |
| 562 |
for the (non-bias) local HMM Viterbi filter, indicating that $20666$ |
| 563 |
windows passed that stage, meaning that $324$ windows were removed by |
| 564 |
the Viterbi bias filter. |
| 565 |
|
| 566 |
The \ccode{--F2b <x>} option controls the P-value threshold for |
| 567 |
passing the local Viterbi bias filter stage. The \ccode{--noF2b} |
| 568 |
option turns off (bypasses) the local Viterbi biased composition |
| 569 |
filter. With this option, the local Viterbi filter will still be used, |
| 570 |
but its score is not recomputed using the bias composition model. The |
| 571 |
local Viterbi bias filter is also turned off if the \ccode{--max} or |
| 572 |
\ccode{--nohmm} options are used. |
| 573 |
|
| 574 |
\subsubsection{Local Forward filter.} |
| 575 |
|
| 576 |
Each surviving window is now aligned to the profile HMM using the full |
| 577 |
Forward algorithm with the model configured in local mode (allowing |
| 578 |
alignments to begin and end at any position of the model), which |
| 579 |
calculates the likelihood of the target sequence given the profile, |
| 580 |
summed over the ensemble of all possible alignments. This step is |
| 581 |
identical to the ``Forward filter/parser'' stage of the HMMER |
| 582 |
pipeline. |
| 583 |
|
| 584 |
This is a specialized time- and memory-efficient Forward |
| 585 |
implementation called the ``Forward parser''. It is implemented in |
| 586 |
4-way parallel SIMD vector instructions, in full precision (32-bit |
| 587 |
floating point). |
| 588 |
|
| 589 |
The local Forward filter bit score is calculated by correcting this |
| 590 |
score using the standard null model log likelihood. If the P-value of |
| 591 |
this score passes the local Forward filter threshold then it passes to |
| 592 |
the Forward bias filter and the score is recomputed using the biased |
| 593 |
composition model. If the P-value of this score passes the Forward |
| 594 |
bias filter threshold, then this window is pass onto the next stage of |
| 595 |
the pipeline\footnote{You might wonder why the intial score with just |
| 596 |
the null model is even computed if the bias adjusted score must also |
| 597 |
pass the threshold for the window to survive. We do this solely for |
| 598 |
more informative output - so we can report how many windows fail to |
| 599 |
pass at each of these two stages independently, to potentially alert |
| 600 |
users if a large number of windows are being thrown out by the bias |
| 601 |
filter alone.}. |
| 602 |
|
| 603 |
The local Forward filter threshold used depends on |
| 604 |
the search space $Z$ (Table~\ref{tbl:thresholds}). For the tRNA search |
| 605 |
in the tutorial, $Z$ was about ~$6$ Mb and the threshold for the local |
| 606 |
Forward stage and its bias filter were set as $0.005$. The summary |
| 607 |
output contains two lines of output pertaining to this stage: |
| 608 |
|
| 609 |
\begin{sreoutput} |
| 610 |
Windows passing local HMM Forward filter: 140 (0.002747); expected (0.005) |
| 611 |
Windows passing local HMM Forward bias filter: 139 (0.002728); expected (0.005) |
| 612 |
\end{sreoutput} |
| 613 |
|
| 614 |
For this search $140$ windows survived the local HMM Forward filter, |
| 615 |
and one of these was removed by the subsequent bias filter. |
| 616 |
|
| 617 |
The \ccode{--F3 <x>} and \ccode{--F3b <x>} control the P-value thresholds for |
| 618 |
passing the local Forward and local Forward bias filter stages. The |
| 619 |
\ccode{--noF3} and \ccode{--noF3b} options turn off (bypasses) the |
| 620 |
stages. Both filters are also turned off if the \ccode{--max} or |
| 621 |
\ccode{--nohmm} options are used. |
| 622 |
|
| 623 |
\subsubsection{Glocal Forward filter.} |
| 624 |
|
| 625 |
Each surviving window is now aligned to the profile HMM again using the full |
| 626 |
Forward algorithm, but this time with the model configured in global |
| 627 |
mode, only allowing alignments that begin at the first position of the |
| 628 |
model and end at the final position. This stage is referred to as |
| 629 |
\emph{glocal} because it is global with respect to the profile HMM, |
| 630 |
but (potentially) local with respect to the sequence window, |
| 631 |
alignments can begin and end at any position in the sequence |
| 632 |
window. |
| 633 |
|
| 634 |
For technical reasons related to the inability to guarantee a lower |
| 635 |
bound on the glocal Forward score, glocal Forward is not implemented |
| 636 |
with parallel SIMD vector instructions, and consequently it is |
| 637 |
significantly slower than the local Forward filter |
| 638 |
implementation. However, in practice it is run on a significantly |
| 639 |
smaller fraction of the database than is the local stage, which |
| 640 |
decreases the impact of this slower speed on the overall running time |
| 641 |
of the search. |
| 642 |
|
| 643 |
It is not immediately obvious that using a glocal HMM filter stage is |
| 644 |
a good idea, when our final CM stages of the pipeline will allow local |
| 645 |
hits to the model. You might imagine that the glocal filter will |
| 646 |
remove some windows that don't match well enough to the \emph{full} |
| 647 |
model to survive but do contain a high-scoring local CM hit. This is |
| 648 |
undoubtedly true in some cases (indeed, we could certainly construct |
| 649 |
examples of this) but it does not seem to be common enough to be a |
| 650 |
concern, at least based on our internal benchmarking. That is, using |
| 651 |
both a local and glocal Forward filter does not seem to decrease |
| 652 |
sensitivity compared with only using a local one. The reason probably |
| 653 |
lies in the relatively high ($0.005$) filter threshold used at this |
| 654 |
stage. Even hits that will eventually be reported as local hits still |
| 655 |
contain surrounding sequence similar enough to the profile to make up |
| 656 |
a global score that passes threshold. |
| 657 |
|
| 658 |
An obvious failure mode of the glocal filter is for identifying |
| 659 |
hits that are truncated at one or both ends due to the beginning or |
| 660 |
termination of a sequencing read. However, Infernal uses a special |
| 661 |
pipeline for identifying these hits at the ends of sequences, as |
| 662 |
described in a later section, so if they're missed at this stage, they |
| 663 |
should be detected later when the truncated variants of the |
| 664 |
pipeline are run. |
| 665 |
|
| 666 |
The glocal Forward filter bit score is calculated by correcting the |
| 667 |
score found by the Forward algorithm using the standard null model log |
| 668 |
likelihood. If the P-value of this score passes the glocal Forward |
| 669 |
filter threshold then it passes to the glocal Forward bias filter and the |
| 670 |
score is recomputed using the biased composition model. If the P-value |
| 671 |
of this score passes the glocal Forward bias filter threshold, then this |
| 672 |
window is pass onto the next stage of the pipeline. |
| 673 |
|
| 674 |
The glocal Forward filter threshold used depends on |
| 675 |
the search space $Z$ (Table~\ref{tbl:thresholds}). For the tRNA search |
| 676 |
in the tutorial, $Z$ was about ~$6$ Mb and the threshold for the glocal |
| 677 |
Forward stage and its bias filter were set as $0.005$. The summary |
| 678 |
output contains two lines of output pertaining to this stage: |
| 679 |
|
| 680 |
\begin{sreoutput} |
| 681 |
Windows passing glocal HMM Forward filter: 88 (0.001973); expected (0.005) |
| 682 |
Windows passing glocal HMM Forward bias filter: 88 (0.001973); expected (0.005) |
| 683 |
\end{sreoutput} |
| 684 |
|
| 685 |
For this search $88$ of the $139$ windows evaluated by the glocal HMM |
| 686 |
Forward filter survived, and none of them were removed by the subsequent bias filter. |
| 687 |
|
| 688 |
The \ccode{--F4 <x>} and \ccode{--F4b <x>} control the P-value thresholds for |
| 689 |
passing the glocal Forward and glocal Forward bias filter stages. The |
| 690 |
\ccode{--noF4} and \ccode{--noF4b} options turn off (bypasses) the |
| 691 |
stages. Both filters are also turned off if the \ccode{--max} or |
| 692 |
\ccode{--nohmm} options are used. |
| 693 |
|
| 694 |
\subsubsection{Envelope definition.} |
| 695 |
|
| 696 |
A target sequence window that reaches this point is likely to be |
| 697 |
larger than the eventual hit or hit(s) (if any) contained within it, |
| 698 |
including nonhomologous nucleotides at the ends of the target sequence |
| 699 |
window and possibly in between hits (if there are more than one). At |
| 700 |
this stage, each window is transformed into one or more envelopes that |
| 701 |
usually are significantly shorter than the original window. |
| 702 |
|
| 703 |
%Removing nucleotides that are not involved in an eventual hit |
| 704 |
%non-homologous at this stage is crucial for the efficiency of the |
| 705 |
%downstream CM stages of the pipeline which rely on sequence-based |
| 706 |
%constraints which are tighter if only homologous sequence |
| 707 |
|
| 708 |
Infernal's HMM envelope definition step is very similar to the |
| 709 |
\emph{domain} definition step of HMMER, with the important difference |
| 710 |
that the profile HMM is configured for global alignment instead of |
| 711 |
local alignment. The envelope definition step is essentially its own |
| 712 |
pipeline, with steps as follows: |
| 713 |
|
| 714 |
\paragraph{Backward parser.} |
| 715 |
The counterpart of the glocal Forward filter algorithm is calculated. |
| 716 |
The Forward algorithm gives the likelihood of all \emph{prefixes} of |
| 717 |
the target sequence, summed over their alignment ensemble, and the |
| 718 |
Backward algorithm gives the likelihood of all \emph{suffixes}. For |
| 719 |
any given point of a possible model state/residue alignment, the |
| 720 |
product of the Forward and Backward likelihoods gives the likelihood |
| 721 |
of the entire alignment ensemble conditional on using that particular |
| 722 |
alignment point. Thus, we can calculate things like the posterior |
| 723 |
probability that an alignment starts or ends at a given position in |
| 724 |
the target sequence. |
| 725 |
|
| 726 |
\paragraph{Decoding.} |
| 727 |
The posterior decoding algorithm is applied, to calculate the |
| 728 |
posterior probability of alignment starts and ends (profile B and E |
| 729 |
state alignments) with respect to target sequence position. |
| 730 |
|
| 731 |
The sum of the posterior probabilities of alignment starts (B states) |
| 732 |
over the entire target sequence window is the \emph{expected number of |
| 733 |
hits} in the sequence window. |
| 734 |
|
| 735 |
\paragraph{Region identification.} |
| 736 |
|
| 737 |
A heuristic is now applied to identify a \emph{non-overlapping} set of |
| 738 |
``regions'' that contain significant probability mass suggesting the |
| 739 |
presence of a match (alignment) to the profile. |
| 740 |
|
| 741 |
For each region, the expected number of envelopes is calculated (again |
| 742 |
by posterior decoding on the Forward/Backward parser results). This |
| 743 |
number should be about 1: we expect each region to contain one global |
| 744 |
alignment to the profile. |
| 745 |
|
| 746 |
\paragraph{Envelope identification.} |
| 747 |
|
| 748 |
Now, within each region, we will attempt to identify envelopes. |
| 749 |
An envelope is a subsequence of the target sequence that |
| 750 |
appears to contain alignment probability mass for a likely hit (one |
| 751 |
global alignment to the profile). |
| 752 |
|
| 753 |
When the region contains $\simeq$1 expected envelope, envelope |
| 754 |
identification is already done: the region's start and end points are |
| 755 |
converted directly to envelope coordinates. |
| 756 |
|
| 757 |
In some cases, the region appears to contain more than |
| 758 |
one expected hit -- where more than one hit is closely spaced on |
| 759 |
the target sequence and/or the domain scores are weak and the |
| 760 |
probability masses are ill-resolved from each other. These |
| 761 |
``multi-hit regions'', when they occur, are passed off to an even |
| 762 |
more \emph{ad hoc} resolution algorithm called \emph{stochastic |
| 763 |
traceback clustering}. In stochastic traceback clustering, we sample |
| 764 |
many alignments from the posterior alignment ensemble, cluster those |
| 765 |
alignments according to their overlap in start/end coordinates, and |
| 766 |
pick clusters that sum up to sufficiently high probability. Consensus |
| 767 |
start and end points are chosen for each cluster of sampled |
| 768 |
alignments. These start/end points define envelopes. |
| 769 |
|
| 770 |
It's also possible (though rare) for stochastic clustering to identify |
| 771 |
\emph{no} envelopes in the region. |
| 772 |
|
| 773 |
During envelope identification, the Forward algorithm is used to score |
| 774 |
each putative envelope, and the standard null model (not the bias one) |
| 775 |
is used as a correction (using mean length $L$ equal to the envelope |
| 776 |
length) and this score is checked to see if it is below a P-value |
| 777 |
threshold. This threshold is $Z$-dependent |
| 778 |
(Table~\ref{tbl:thresholds}. For the tRNA search in the tutorial, this |
| 779 |
threshold is $0.005$. If the P-value is less than the threshold the |
| 780 |
envelope has survived all HMM filter stages and is passed onto the CYK |
| 781 |
stage of the filter pipeline. |
| 782 |
|
| 783 |
In the tRNA search example, the summary output line for the envelope |
| 784 |
definition stage is shown below (the line for the previous filter stage is also |
| 785 |
shown for comparison): |
| 786 |
|
| 787 |
\begin{sreoutput} |
| 788 |
Windows passing glocal HMM Forward bias filter: 88 (0.001973); expected (0.005) |
| 789 |
Envelopes passing glocal HMM envelope defn filter: 101 (0.001358); expected (0.005) |
| 790 |
\end{sreoutput} |
| 791 |
|
| 792 |
Note that while only $88$ windows were passed into this stage, |
| 793 |
comprising $0.001973$ fraction of the total database, $101$ envelopes |
| 794 |
survived making up $0.001358$ fraction of the database survived. Some |
| 795 |
windows have been transformed into multiple envelopes and in general |
| 796 |
the surviving envelopes are significantly shorter than the input |
| 797 |
windows. |
| 798 |
|
| 799 |
The \ccode{--F5 <x>} expert option sets the filter P-value threshold for |
| 800 |
passing the envelope definition filter to \ccode{<x>}. The \ccode{--doF5b} and |
| 801 |
\ccode{--F5b <x>} options turn on a bias filter for this stage |
| 802 |
and control its P-value threshold, respectively. HMM envelope |
| 803 |
definition is turned off if the \ccode{--max} or \ccode{--nohmm} |
| 804 |
options are used. |
| 805 |
|
| 806 |
\subsection{In more detail: CM stages of the pipeline} |
| 807 |
|
| 808 |
After all profile HMM filter stages are complete, we have defined a |
| 809 |
set of envelopes each of which may contain a single hit to the CM. We |
| 810 |
now using sequence- and structure-based CM algorithms to score each |
| 811 |
envelope and determine if it has a significant (reportable) hit to the |
| 812 |
CM within it. Unfortunately, CM algorithms are computationally |
| 813 |
expensive (more than an order of magnitude more complex than HMM |
| 814 |
algorithms) so we need to constrain these algorithms in order to |
| 815 |
incorporate them into a comparison pipeline that runs at a practical |
| 816 |
speed. The acceleration technique used by Infernal relies on computing |
| 817 |
and imposing bands on the CM dynamic programming matrices derived from |
| 818 |
an HMM Forward/Backward decoding of the sequence, similar to the one |
| 819 |
used in the envelope definition filter stage. This technique is based |
| 820 |
on one pioneered by Michael Brown \citep{Brown00}. Next, we'll discuss the |
| 821 |
calculation of those bands and how they're utilized to accelerate the |
| 822 |
remaining CM stages of the pipeline. |
| 823 |
|
| 824 |
\subsubsection{HMM band definition for CM stages.} |
| 825 |
|
| 826 |
For each envelope that survives all the filter HMM stages, |
| 827 |
sequence-specific bands are derived for a CYK dynamic programming |
| 828 |
alignment of the envelope. The bands are derived from a HMM \\ |
| 829 |
Forward/Backward/Decoding steps (similar to those used in the envelope |
| 830 |
definition pipeline) are used to determine the posterior probability |
| 831 |
that each HMM position aligns to each sequence position of the |
| 832 |
envelope. From these probabilities, \emph{bands} are determined for |
| 833 |
each state, defined as sequence coordinate ranges that exclude only a |
| 834 |
preset amount of the probability mass for that state. By default, the |
| 835 |
excluded probability mass (referred to as tau ($\tau$) in the code) is |
| 836 |
$0.0001$ ($1e-4$). For example, a band for state $x$ defined as |
| 837 |
positions $10$ to $20$ (inclusive) of an envelope of length $30$ |
| 838 |
indicates that the summed probability of state $x$ aligning to |
| 839 |
positions $1$ through $9$ and $21$ through $30$ is less than |
| 840 |
$1e-4$. These HMM bands are then mapped onto the CM by converting them |
| 841 |
to/from analogous states in the HMM and CM that model the same |
| 842 |
position in the consensus model. A more detailed discussion of the |
| 843 |
calculation and mapping of these bands can be found in |
| 844 |
\citep{Nawrocki09b}. |
| 845 |
|
| 846 |
The HMM used for deriving these bands is not the same one used in the |
| 847 |
filter HMM stages of the pipeline. The new HMM used here is called a |
| 848 |
CM Plan 9 (CP9) HMM, and it is constructed to be maximally similar to |
| 849 |
a CM. These HMMs are essentially a reimplementation of of the maximum |
| 850 |
likelihood heuristic HMM described in \citep{WeinbergRuzzo06}. |
| 851 |
CP9 HMMs are more similar to CMs than are the plan 7 HMMs of HMMER in |
| 852 |
that they include transitions from delete states to insert states and |
| 853 |
vice versa. These transitions are allowed in CMs, but not in plan 7 |
| 854 |
HMMs. Also, CP9 HMMs have special states for mirroring the local end |
| 855 |
(EL) state of a CM, which don't occur in plan 7 HMMs. Finally, these |
| 856 |
CP9 HMMs are configured in a local mode with an uneven begin and end |
| 857 |
probability distribution that places the highest probability on |
| 858 |
beginning at model position 1 and ending at the final model position. |
| 859 |
This local configuration more closely matches the CM local |
| 860 |
configuration than both the local and global p7 filter HMM |
| 861 |
configuration\footnote{In the plan 7 HMMER3 HMMs used in the filter |
| 862 |
stages, begin and end probabilities are equal for all positions of |
| 863 |
the model \citep{Eddy08}.}. |
| 864 |
|
| 865 |
\subsubsection{HMM banded CM CYK filter.} |
| 866 |
|
| 867 |
Given an envelope and CP9 HMM-derived bands constraining possible |
| 868 |
alignments of a CM to the sequence positions in the envelope, a banded |
| 869 |
version of the CM CYK algorithm is used to determine the |
| 870 |
maximum-likelihood CM alignment\footnote{The CYK algorithm is the CM |
| 871 |
analog of the HMM Viterbi algorithm.} of any subsequence in the |
| 872 |
envelope to the CM that is consistent with the HMM bands \citep{Nawrocki09b}. |
| 873 |
|
| 874 |
In most cases that occur in Infernal's pipeline, the HMM banded |
| 875 |
version of CYK is significantly faster than non-banded, or even |
| 876 |
query-dependent banded \citep{NawrockiEddy07} implementations of the CM |
| 877 |
CYK algorithm. The speedup gained typically increases with the |
| 878 |
consensus length of the model being used. However, HMM banded CYK is |
| 879 |
only efficient when the target sequence alignment with an HMM is |
| 880 |
well-resolved (includes at least some sequence position/model position |
| 881 |
pairs that align with high probability), because only then will |
| 882 |
the resulting bands be ``tight'' and exclude a large fraction of |
| 883 |
possible alignments. For this reason, the HMM filter stages of the |
| 884 |
pipeline, in particular the envelope definition stage, are crucial for |
| 885 |
enabling the HMM banded CM stages to work efficiently. |
| 886 |
|
| 887 |
The null-corrected CYK bit score (corrected using the same type of |
| 888 |
equiprobable (25\% A, C, G and U) iid, null model used by the profile |
| 889 |
HMM filter stages) is returned from the HMM banded CYK algorithm. No |
| 890 |
bias correction is used at this stage. If this score has a P-value |
| 891 |
less than $0.0001$ then the envelope is passed to the next stage of |
| 892 |
the pipeline. Unlike in the HMM filter stages, the P-value threshold |
| 893 |
used for the CYK filter is not dependent on the search space $Z$, but |
| 894 |
it is controllable with the \ccode{--F6} option. |
| 895 |
|
| 896 |
Envelope boundaries are potentially redefined at this stage based on |
| 897 |
CYK scores. Envelopes can only be shortened, not extended, at either |
| 898 |
boundary. We take advantage of the fact that the CYK algorithm |
| 899 |
computes the maximum likelihood alignment score (consistent with the |
| 900 |
HMM bands) of all possible subsequences in the envelope to the CM, and |
| 901 |
examine each nucleotide to see if it is included in any possible |
| 902 |
alignment to the model above a certain score threshold. By default, |
| 903 |
this threshold is a 10-fold lower P-value than the filter survival |
| 904 |
threshold, so it is $0.001$ ($10*0.0001$). This envelope redefinition |
| 905 |
can be turned off with the \ccode{--nocykenvx} option and it the |
| 906 |
threshold for it can be changed with the \ccode{--cykenvx <x>} option. |
| 907 |
|
| 908 |
\subsubsection{HMM banded CM Inside filter/parser.} |
| 909 |
|
| 910 |
Envelopes that survive CYK are evaluated using the CM Inside |
| 911 |
algorithm, which is the CM analog of the HMM Forward algorithm. HMM |
| 912 |
bands are rederived for this step (remember the envelope boundaries |
| 913 |
may now be different), using a smaller $\tau$ value of $5e-6$. With |
| 914 |
Inside, the probability of all possible alignments (instead of just |
| 915 |
the most likely one) of each subsequence to the model that is |
| 916 |
consistent with the bands are summed to define a probability for that |
| 917 |
subsequence. A log-odds score is determined by applying two null |
| 918 |
models: the standard null model used in CYK and an alternative null3 |
| 919 |
model based on the composition of the aligned subsequence. The null3 |
| 920 |
model is explained below. |
| 921 |
|
| 922 |
A non-overlapping set of subsequence/model hits that fall below the |
| 923 |
reporting E-value threshold is then collected using a greedy |
| 924 |
approach\footnote{This greedy approach is as follows: while any hits |
| 925 |
below threshold that do not overlap with previously reported ones |
| 926 |
remain, select the top scoring one and report it}. Each hit is defined |
| 927 |
by a start/end position in the envelope. |
| 928 |
|
| 929 |
By default, the reporting threshold is an E-value of $10.0$, but this |
| 930 |
is settable to a different E-value with the \ccode{-E <x>} option, or |
| 931 |
to a particular bit score with the \ccode{-T <x>} option. |
| 932 |
|
| 933 |
\subsubsection{Optimal accuracy alignment.} |
| 934 |
|
| 935 |
For each hit reported by Inside, an optimally accurate |
| 936 |
alignment\footnote{This is the same type of alignment referred to as |
| 937 |
``maximum expected accuracy'' in the HMMER documentation} is computed |
| 938 |
using HMM banded versions of the Inside and Outside algorithm (using |
| 939 |
the same bands from the Inside filter) and annotated with posterior |
| 940 |
probabilities for each aligned nucleotide. The optimally accurate |
| 941 |
alignment is the alignment that maximizes the sum of the posterior |
| 942 |
probabilities of all aligned nucleotides. The alignment is then stored in |
| 943 |
memory until the end of the search when it is finally output as part |
| 944 |
of a ranked list of hits and their alignments. |
| 945 |
|
| 946 |
\subsubsection{Biased composition CM score correction: the null3 model.} |
| 947 |
|
| 948 |
CM Inside scores are adjusted using an alternative null hypothesis |
| 949 |
called the null3 model in an effort to counteract the contribution of |
| 950 |
biased sequence composition to the scores of hits. The null3 model |
| 951 |
was motivated by the observation that many high-scoring false positive |
| 952 |
hits in CM searches are to regions of the target database with with |
| 953 |
highly biased residue composition, in particular regions with high |
| 954 |
percentages of A and U residues. If a model has a bias for a |
| 955 |
particular residue, for example A, and a target region is composed of |
| 956 |
an overrepresentation of that residue then it will receive a high |
| 957 |
score simply because it is A-rich. |
| 958 |
|
| 959 |
A different null3 model is calculated for every alignment. The 4 |
| 960 |
emission probabilities of the null3 model are calculated as |
| 961 |
simply their occurence within the region of the hit. For example, if |
| 962 |
the hit is 50 residues long and contains $20$ As, $5$ Cs, $5$ Gs and $20$ Us, |
| 963 |
then the null3 model probabilitiles will be calculated as $(0.4, 0.1, |
| 964 |
0.1, 0.4)$. |
| 965 |
|
| 966 |
The null3 model is similar to the bias filter model used in the |
| 967 |
profile HMM stages but it often gives more severe corrections for |
| 968 |
highly biased hits because it is a single HMM state with emission |
| 969 |
probabilities defined by the hit composition, not the model |
| 970 |
composition. Importantly, scores collected during model calibration |
| 971 |
for estimating E-value parameters in \prog{cmcalibrate} are also |
| 972 |
corrected using the null3 model. |
| 973 |
|
| 974 |
The null3 model is used in combination with the standard null model |
| 975 |
(single state equiprobable A,C,G and U, same as the profile HMM |
| 976 |
standard null model). We told you earlier that an Infernal bit score |
| 977 |
is the log of the ratio of the sequence's probability according to the |
| 978 |
profile over the null model probability, but how do we calculate this |
| 979 |
score if we have more than one null hypothesis? Infernal does a bit |
| 980 |
of algebraic sleight of hand here, to arrive at an additive correction |
| 981 |
to the original score that it calls the ``null3 score correction''. |
| 982 |
|
| 983 |
\paragraph{Derivation of the null3 score correction} |
| 984 |
|
| 985 |
We arrived at the parameters of the null3 model in a very \emph{ad |
| 986 |
hoc} way. However, after that, the way Infernal arrives at the final bit |
| 987 |
score once the null3 parameters have been determined is clean |
| 988 |
(e.g. derivable) Bayesian probability theory. It is analagous to the |
| 989 |
way HMMER uses the \emph{null2} score correction. |
| 990 |
|
| 991 |
If we take the Bayesian view, we're interested in the probability of a |
| 992 |
hypothesis $H$ given some observed data $D$: |
| 993 |
|
| 994 |
\[ |
| 995 |
P(H | D) = \frac{P(D | H) P(H)}{\sum_{H_i} P(D | H_i) P(H_i)}, |
| 996 |
\] |
| 997 |
|
| 998 |
an equation which forces us to state explicit probabilistic models not |
| 999 |
just for the hypothesis we want to test, but also for the alternative |
| 1000 |
hypotheses we want to test against. Up until now, we've considered two |
| 1001 |
hypotheses for an observed sequence $D$: either it came from our |
| 1002 |
CM (call that model $M$), or it came from our null hypothesis |
| 1003 |
for random, unrelated sequences (call that model $N$). If these are |
| 1004 |
the only two models we consider, the Bayesian posterior for the model |
| 1005 |
$M$ is: |
| 1006 |
|
| 1007 |
\[ |
| 1008 |
P(M | D) = \frac{P(D | M) P(M)}{P(D | M) P(M) + P(D | N) P(N)} |
| 1009 |
\] |
| 1010 |
|
| 1011 |
Recall that the log odds score (in units of bits) reported by |
| 1012 |
Infernal's alignment algorithms is |
| 1013 |
|
| 1014 |
\[ |
| 1015 |
s = \log_2 \frac{P(D | M)}{P(D | N)}. |
| 1016 |
\] |
| 1017 |
|
| 1018 |
Let's assume for simplicity that \emph{a priori}, the profile and the |
| 1019 |
null model are equiprobable, so the priors $P(M)$ and $P(N)$ |
| 1020 |
cancel. Then the log odds score $s$ is related to the Bayesian |
| 1021 |
posterior by a sigmoid function, |
| 1022 |
|
| 1023 |
\[ |
| 1024 |
P(M | D) = \frac{2^s}{2^s + 1}. |
| 1025 |
\] |
| 1026 |
|
| 1027 |
(We don't have to assume that the two hypotheses are equiprobable; |
| 1028 |
keeping these around would just add an extra $\pi = \log P(M) / P(N)$ |
| 1029 |
factor to $s$. We'll reintroduce these prior log odds scores $\pi$ |
| 1030 |
shortly.) |
| 1031 |
|
| 1032 |
The simple sigmoid relationship between the posterior and the log odds |
| 1033 |
score suggests a plausible basis for calculating a score that includes |
| 1034 |
contributions of more than one null hypothesis: \textbf{we desire a |
| 1035 |
generalized score $S$ such that:} |
| 1036 |
|
| 1037 |
\[ |
| 1038 |
\frac{2^S}{2^S + 1} = P(M | D), |
| 1039 |
\] |
| 1040 |
|
| 1041 |
\textbf{for \emph{any} number of alternative hypotheses under consideration.} |
| 1042 |
|
| 1043 |
So, let $N_i$ represent any number of alternative null models |
| 1044 |
$N_i$. Then, by algebraic rearrangement of Bayes' theorem, |
| 1045 |
|
| 1046 |
\[ |
| 1047 |
S = \log \frac{P(D | M) P(M)}{ \sum_{i} P(D | N_i) P(N_i)}. |
| 1048 |
\] |
| 1049 |
|
| 1050 |
We saw above that Infernal internally calculates a log odds score $s$, of |
| 1051 |
the model relative to the first null hypothesis. Let's now call that |
| 1052 |
$s_M$, the alignment score of the model. Infernal extends that same |
| 1053 |
scoring system to all additional competing hypotheses, calculating a |
| 1054 |
log odds score relative to the first null hypothesis for any |
| 1055 |
additional null hypotheses $i > 1$: |
| 1056 |
|
| 1057 |
\[ |
| 1058 |
s_i = \log \frac{P(D | N_i)}{P(D | N_1)} |
| 1059 |
\] |
| 1060 |
|
| 1061 |
We can also state prior scores $\pi_i$ for how relatively likely |
| 1062 |
each null hypothesis is, relative to the main one: |
| 1063 |
|
| 1064 |
\[ |
| 1065 |
\pi_i = \log \frac{P(N_i)}{P(N_1)} |
| 1066 |
\] |
| 1067 |
|
| 1068 |
(Remember that we assumed $\pi_M = 0$; but we're going to put it back |
| 1069 |
in anyway now.) |
| 1070 |
|
| 1071 |
Now we can express $S$ in terms of the internal scores $s$ and |
| 1072 |
prior scores $\pi$: |
| 1073 |
|
| 1074 |
\[ |
| 1075 |
S = \log \frac{e^{s_M + \pi_M}} { 1 + \sum_{i>1} e^{s_i + \pi_i}}, |
| 1076 |
\] |
| 1077 |
|
| 1078 |
which therefore simply amounts to an additive correction of the |
| 1079 |
original score, $(s_M + \pi_M)$: |
| 1080 |
|
| 1081 |
\[ |
| 1082 |
S = (s_M + \pi_M) - \log \left( 1 + \sum_{i>1} e^{s_i + \pi_i} \right) |
| 1083 |
\] |
| 1084 |
|
| 1085 |
So, to calculate its reported score, Infernal uses four quantities: |
| 1086 |
|
| 1087 |
\begin{enumerate} |
| 1088 |
\item [$s_M$] The (simple, uncorrected) log odds score for the model, |
| 1089 |
calculated by optimal alignment of the model to the sequence. |
| 1090 |
|
| 1091 |
\item [$\pi_M$] The log odds of the priors, $\log P(M)/P(N_1)$. Infernal |
| 1092 |
implicitly assumes this factor to be 0. |
| 1093 |
|
| 1094 |
\item [$s_2$] The (simple, uncorrected) log odds score |
| 1095 |
for the null3 hypothesis, calculated by rescoring the residues |
| 1096 |
of the alignment under the null3 model. |
| 1097 |
|
| 1098 |
\item [$\pi_2$] The log odds of the priors, $\log P(N_2)/P(N_1)$. |
| 1099 |
Infernal arbitrarily assumes that the null3 model is |
| 1100 |
$\frac{1}{65536}$ as likely as the main null model, so this factor |
| 1101 |
is -16 bits.\footnote{In versions 1.0 through 1.0.2, the null3 model |
| 1102 |
was assumed to be $\frac{1}{32}$ as likely as the main null model |
| 1103 |
(-5 bit factor instead of -16 bits). The decreased value in version |
| 1104 |
1.1 means that null3 penalties are reduced. We decided to do this |
| 1105 |
based on internal benchmarking results. Version 1.1 uses a new |
| 1106 |
default prior for parameterizing models which apparently alleviates |
| 1107 |
the problem of biased composition, thus allowing us to reduce this |
| 1108 |
value without sacrificing performance.} |
| 1109 |
\end{enumerate} |
| 1110 |
|
| 1111 |
The code that calculates the null3 correction is in |
| 1112 |
\prog{cm\_parsetree.c:ScoreCorrectionNull3()}. |
| 1113 |
|
| 1114 |
The null3 correction is usually close to zero, for random sequences, |
| 1115 |
but becomes a significant quantitative penalty on biased composition |
| 1116 |
sequences. It gets added to the original alignment score to form |
| 1117 |
Infernal's final bit score. |
| 1118 |
|
| 1119 |
The null3 score correction is introduced in version 1.0 and was not |
| 1120 |
present in any of the 0.x versions of Infernal. This can |
| 1121 |
lead to large differences in the scores reported by 1.0 and previous |
| 1122 |
versions. |
| 1123 |
|
| 1124 |
The following table shows the penalty for a $100$ nucleotide hit with |
| 1125 |
varying compositions of A, C, G, and U residues. This table is included to give you |
| 1126 |
an idea of how severe the null3 correction is, and can be useful for |
| 1127 |
comparing bit scores from Infernal 1.0 to previous |
| 1128 |
versions (which did not use the null3 correction). These are just a |
| 1129 |
sample of the possible composition of hits you might see. Again, these |
| 1130 |
scores are for $100$ nucleotide hits, to determine the correction for |
| 1131 |
a hit of length $x$ simply multiply the corresponding correction below |
| 1132 |
by $x/100$. For example, a $35$\% A, $15$\% C, $15$\% G, $35$\% U hit |
| 1133 |
of length $100$ nt would receive a $6.88$ bit penalty from |
| 1134 |
null3 (row 4). A $200$ nt hit of the same composition would |
| 1135 |
receive a penalty of $13.76$ bits. A $50$ nt hit of the same |
| 1136 |
composition would receive a $3.44$ bit penalty. |
| 1137 |
|
| 1138 |
\vspace{0.5in} |
| 1139 |
|
| 1140 |
\begin{center} |
| 1141 |
\begin{tabular}{r|rrrr|c} |
| 1142 |
& & & & & NULL3 \\ |
| 1143 |
GC\%& A\% & C\% & G\% & U\% & correction (bits) \\ \hline |
| 1144 |
0.0 & 50.0 & 0.0 & 0.0 & 50.0 & 95.00 \\ |
| 1145 |
10.0 & 45.0 & 5.0 & 5.0 & 45.0 & 48.10 \\ |
| 1146 |
20.0 & 40.0 & 10.0 & 10.0 & 40.0 & 22.81 \\ |
| 1147 |
30.0 & 35.0 & 15.0 & 15.0 & 35.0 & 6.88 \\ |
| 1148 |
35.0 & 32.5 & 17.5 & 17.5 & 32.5 & 2.01 \\ |
| 1149 |
40.0 & 30.0 & 20.0 & 20.0 & 30.0 & 0.30 \\ |
| 1150 |
45.0 & 27.5 & 22.5 & 22.5 & 27.5 & 0.07 \\ |
| 1151 |
50.0 & 25.0 & 25.0 & 25.0 & 25.0 & 0.04 \\ |
| 1152 |
55.0 & 22.5 & 27.5 & 27.5 & 22.5 & 0.07 \\ |
| 1153 |
60.0 & 20.0 & 30.0 & 30.0 & 20.0 & 0.30 \\ |
| 1154 |
65.0 & 17.5 & 32.5 & 32.5 & 17.5 & 2.01 \\ |
| 1155 |
70.0 & 15.0 & 35.0 & 35.0 & 15.0 & 6.88 \\ |
| 1156 |
80.0 & 10.0 & 40.0 & 40.0 & 10.0 & 22.81 \\ |
| 1157 |
90.0 & 5.0 & 45.0 & 45.0 & 5.0 & 48.10 \\ |
| 1158 |
100.0 & 0.0 & 50.0 & 50.0 & 0.0 & 95.00 \\ |
| 1159 |
|
| 1160 |
\end{tabular} |
| 1161 |
\end{center} |
| 1162 |
|
| 1163 |
\vspace{0.5in} |
| 1164 |
|
| 1165 |
% obtained using esl-null3 a specialized easel miniapp |
| 1166 |
% created basically solely to make this table. |
| 1167 |
% A frozen copy of the version used to make this table |
| 1168 |
% (with -l option) |
| 1169 |
% is: /groups/eddy/home/nawrockie/notebook/12_0503_inf_tutorial/wd-infernal/easel/miniapps/bkups/12_0605-1/ |
| 1170 |
% |
| 1171 |
% raw output: |
| 1172 |
% > esl-null3 -l |
| 1173 |
% GC A C G U correction (bits) |
| 1174 |
%----- ----- ----- ----- ----- ----------------- |
| 1175 |
%100.0 0.0 50.0 50.0 0.0 84.00000 |
| 1176 |
% 90.0 5.0 45.0 45.0 5.0 37.10043 |
| 1177 |
% 80.0 10.0 40.0 40.0 10.0 11.80760 |
| 1178 |
% 70.0 15.0 35.0 35.0 15.0 0.08019 |
| 1179 |
% 65.0 17.5 32.5 32.5 17.5 0.00213 |
| 1180 |
% 60.0 20.0 30.0 30.0 20.0 0.00016 |
| 1181 |
% 55.0 22.5 27.5 27.5 22.5 0.00004 |
| 1182 |
% 50.0 25.0 25.0 25.0 25.0 0.00002 |
| 1183 |
% 45.0 27.5 22.5 22.5 27.5 0.00004 |
| 1184 |
% 40.0 30.0 20.0 20.0 30.0 0.00016 |
| 1185 |
% 35.0 32.5 17.5 17.5 32.5 0.00213 |
| 1186 |
% 30.0 35.0 15.0 15.0 35.0 0.08019 |
| 1187 |
% 20.0 40.0 10.0 10.0 40.0 11.80759 |
| 1188 |
% 10.0 45.0 5.0 5.0 45.0 37.10044 |
| 1189 |
% 0.0 50.0 0.0 0.0 50.0 84.00000 |
| 1190 |
|
| 1191 |
By default, the null3 score correction is used by \prog{cmcalibrate, |
| 1192 |
cmsearch} and \prog{cmscan}. It can be turned off in any of these |
| 1193 |
programs by using the \prog{--nonull3} option. However, be careful, |
| 1194 |
the E-values for models that are calibrated with \prog{--nonull3} are |
| 1195 |
only valid when \prog{--nonull3} is also used with \prog{cmsearch} or |
| 1196 |
\prog{cmscan}. Likewise, if \prog{--nonull3} is \emph{not} used during |
| 1197 |
calibration, it should not be used during searches or scans. |
| 1198 |
|
| 1199 |
\subsection{Truncated hit detection using variants of the pipeline} |
| 1200 |
|
| 1201 |
The Infernal pipeline discussed above is designed to find complete RNA |
| 1202 |
homologs within a (usually) larger sequence, e.g. a choromosome. |
| 1203 |
\emph{Final} hits may be local (not full-length) with respect to the |
| 1204 |
model, but the glocal HMM filter stage requires that at least some |
| 1205 |
statistical signal remain in a full length match to the profile |
| 1206 |
HMM. That is, enough signal to result in a good enough glocal Forward |
| 1207 |
score to pass the glocal filter (e.g. a P-value of $0.005$ for a |
| 1208 |
search space between 2 and 20 Mb). In our benchmarking, the vast |
| 1209 |
majority of statistically significant CM hits do pass the glocal |
| 1210 |
Forward HMM filter, however, there is the obvious failure mode of the |
| 1211 |
pipeline on \emph{truncated} hits. A truncated hit is defined as a hit |
| 1212 |
that is missing one or more nucleotides at the 5' and/or 3' end solely |
| 1213 |
because of the position where the sequencing read happened to begin or |
| 1214 |
end. While the chromosome the read derives from presumably included a |
| 1215 |
full length hit, the read itself does not because the sequencing |
| 1216 |
reaction used to determine the sequence began or ended at a position |
| 1217 |
internal to the hit. Infernal uses modified versions of its |
| 1218 |
profile/sequence comparison pipeline for detection of truncated hits. |
| 1219 |
This modified pipeline is executed after the full sequence is examined |
| 1220 |
with the standard pipeline. |
| 1221 |
|
| 1222 |
The modified pipeline is only used near the sequence termini because |
| 1223 |
Infernal only expects truncated hits to occur due to the premature |
| 1224 |
ending of a sequencing read\footnote{There are cases where truncated |
| 1225 |
hits might occur within sequences (``split tRNAs'' in archaea |
| 1226 |
\citep{Randau05}, for example), but these are rare and Infernal does |
| 1227 |
not explicit look for these types of hits, unless the |
| 1228 |
\ccode{--anytrunc} option is used, as discussed at the end of this |
| 1229 |
section.}. Specifically only the first or final $X$ nucleotides at |
| 1230 |
either sequence end are examined for truncated hits, where $X$ is |
| 1231 |
defined as the minimum of the $W$ parameter (maximum expected hit |
| 1232 |
length, calculated in \prog{cmbuild}) and $1.25$ times the consensus |
| 1233 |
length of the model. |
| 1234 |
|
| 1235 |
There are three variants of the pipeline used for truncated hit |
| 1236 |
detection: |
| 1237 |
|
| 1238 |
\begin{enumerate} |
| 1239 |
|
| 1240 |
\item \textbf{5' truncated hit detection.} |
| 1241 |
This pipeline is used only on the $X$ 5'-most nucleotides of each |
| 1242 |
sequence. These $X$ nucleotides are also searched along with the rest |
| 1243 |
of the complete sequence as part of the standard pipeline. Only 5' |
| 1244 |
truncated or non-truncated alignments can be found by this pipeline |
| 1245 |
variant, but non-truncated alignments will be duplicates of |
| 1246 |
those found previously by the standard pipeline. |
| 1247 |
|
| 1248 |
\item \textbf{3' truncated hit detection.} |
| 1249 |
This pipeline is used only on the $X$ 3'-most nucleotides of each |
| 1250 |
sequence. These $X$ nucleotides are also searched along with the rest |
| 1251 |
of the complete sequence as part of the standard pipeline. Only 3' |
| 1252 |
truncated or non-truncated alignments can be found by this pipeline |
| 1253 |
variant, but non-truncated alignments will be duplicates of |
| 1254 |
those found previously by the standard pipeline. |
| 1255 |
|
| 1256 |
\item \textbf{5' and 3' truncated hit detection.} |
| 1257 |
This pipeline is used only on complete sequences that are less than |
| 1258 |
$X$ nucleotides long. These sequences are also searched in their |
| 1259 |
entirety by the standard pipeline, the 5' truncated variant pipeline, |
| 1260 |
and the 3' truncated variant pipeline. Any types of alignments are |
| 1261 |
possible at this stage (5' truncated, 3' truncated, 5' \emph{and} 3' |
| 1262 |
truncated or non-truncated) but only 5' \emph{and} 3' truncated |
| 1263 |
alignments will not be duplicates of previously found alignments. |
| 1264 |
|
| 1265 |
\end{enumerate} |
| 1266 |
|
| 1267 |
Given a sequence to search, the standard pipeline described in the |
| 1268 |
first part of this section is used on the full sequence. Then the |
| 1269 |
truncated pipeline variants 1 and 2 are used on the sequence |
| 1270 |
termini. Finally, if the sequence is less than $X$ nucleotides long, |
| 1271 |
variant 3 is used. Before hits are output, overlapping hits |
| 1272 |
potentially found in different variants of the pipeline are removed, |
| 1273 |
by keeping the highest scoring one. Also, remember that Infernal |
| 1274 |
searches both strands of each sequence, so each pipeline is run |
| 1275 |
separately on each strand. |
| 1276 |
|
| 1277 |
It may seem like Infernal is duplicating effort by searching the first |
| 1278 |
and final $X$ nucleotides twice, i.e. once in the standard pipeline |
| 1279 |
and once in the 5' truncated variant or the 3' truncated variant. One |
| 1280 |
might argue that only searching these $X$ nucleotides with the |
| 1281 |
truncated pipeline variant should be sufficient to find truncated and |
| 1282 |
non-truncated hits. However, as we'll discuss next, the glocal HMM |
| 1283 |
filter stages, HMM band construction and the CYK and Inside algorithms |
| 1284 |
are different between the standard and truncated variants of the |
| 1285 |
pipeline and some non-truncated hits found by the standard variant |
| 1286 |
will be missed by the truncated variants, and vice versa. So it is |
| 1287 |
important we search the $X$ terminal nucleotides on the 5' and 3' end |
| 1288 |
using both standard and truncated variants of the pipeline. The same |
| 1289 |
is true of sequences that are less than $X$ nucleotides, which get |
| 1290 |
searched four times, once by each of the four pipeline variants (the |
| 1291 |
standard plus the three truncated variants). |
| 1292 |
|
| 1293 |
\subsubsection{Differences between the standard pipeline and the |
| 1294 |
truncated variants} |
| 1295 |
|
| 1296 |
For all three truncated variants of the pipeline, the first three HMM |
| 1297 |
filter stages (SSV, local Viterbi and local Forward), as well as their |
| 1298 |
bias composition corrections, are identical to the standard pipeline |
| 1299 |
described above. However, the glocal HMM Forward, glocal HMM envelope |
| 1300 |
definition, CYK and Inside differ to accomodate truncated hits. |
| 1301 |
|
| 1302 |
Recall that in the standard pipeline in the glocal HMM Forward and |
| 1303 |
envelope definition stages, the HMM is configured in global mode which |
| 1304 |
forces all alignments to begin in the first model position and end in |
| 1305 |
the final one (in the match or delete state in both cases). Also, in |
| 1306 |
these stages, the alignment could begin or end in any position of the |
| 1307 |
sequence window (i.e. local with respect to the sequence). These |
| 1308 |
aspects of these two pipeline stages differ in the truncated variants. |
| 1309 |
For the 5' truncated pipeline variant, alignments can begin |
| 1310 |
at any model position but must end at the final model position, |
| 1311 |
\emph{and} the \emph{first} nucleotide in the window must be aligned to an HMM |
| 1312 |
model position. The 3' truncated pipeline variant does the opposite, |
| 1313 |
allowing alignments to end at any position but requiring they start at |
| 1314 |
the first position \emph{and} requiring that the \emph{final} nucleotide |
| 1315 |
in the sequence be aligned to an HMM model position. |
| 1316 |
In the 5' and 3' truncated pipeline variant, alignments can begin and |
| 1317 |
end at any model position but the first and final nucleotide of the |
| 1318 |
sequence window must both be aligned to model positions. |
| 1319 |
|
| 1320 |
Similar changes are necessary for the truncated pipeline variants in |
| 1321 |
the CM pipeline stages. The HMM bands are computed using CP9 HMMs |
| 1322 |
configured in modified ways, similar to the modifications for the |
| 1323 |
filter HMMs in the glocal filter stages. Specifically, in the 5' |
| 1324 |
variant the first nucleotide in the window must be aligned to the |
| 1325 |
model and model \emph{begin} probabilities are equal for all model |
| 1326 |
positions. In the 3' variant, the final nucleotide in the window must |
| 1327 |
be aligned to the model and the model \emph{end} probabilities are |
| 1328 |
equal for all model positions. In the 5' and 3' variant, the first and |
| 1329 |
final nucleotides (i.e. all nucleotides) in the window must be aligned |
| 1330 |
to the model and model begin \emph{and} end probabilities are equal |
| 1331 |
for all model positions. |
| 1332 |
|
| 1333 |
Also, additional score corrections are used in the CM stages to |
| 1334 |
compensate for the fact that alignments are now allowed to begin |
| 1335 |
and/or end at any model position to account for the truncation. The |
| 1336 |
correction is roughly the log of $1/M$ bits for the 5'-only and |
| 1337 |
3'-only pipeline variants, and roughly the log of $2/(M*(M+1))$ bits |
| 1338 |
for the 5' and 3' pipeline variant. For all hits found in a truncated |
| 1339 |
pipeline variant, this correction is subtracted from the CM bit score. |
| 1340 |
|
| 1341 |
For the CYK and Inside stages, specialized versions of the CM |
| 1342 |
alignment algorithms are necessary to cope with truncated |
| 1343 |
alignments. Allowing truncated alignments requires more changes to CM |
| 1344 |
algorithms than for HMM algorithms because CMs are arranged in a |
| 1345 |
tree-like structure instead of in a linear structure like HMMs, and |
| 1346 |
need to be able to deal with the possibility that the sequence |
| 1347 |
aligning to part of a subtree of the model has been truncated |
| 1348 |
away. For example, a truncated CM alignment algorithm must be able to |
| 1349 |
deal with the case where the left half but not the right half of a |
| 1350 |
stem has been deleted, and vice versa. For details on CM truncated |
| 1351 |
alignment, see \citep{KolbeEddy09}. HMM banded, truncated versions of |
| 1352 |
CYK and Inside are implemented in Infernal, and are used by the |
| 1353 |
truncated pipeline variants (see \ccode{src/cm\_dpsearch\_trunc.c} and |
| 1354 |
\ccode{src/cm\_dpalign\_trunc.c}. These implementations allow either 5' |
| 1355 |
truncation, 3' truncation, or both, and can require that valid |
| 1356 |
alignments begin at the first nucleotide of the sequence or end at the |
| 1357 |
final nucleotide of the sequence. For the 5' truncated pipeline |
| 1358 |
variant, only 5' truncations are allowed and all valid alignments must |
| 1359 |
begin with the first nucleotide of the sequence. For the 3' variant, |
| 1360 |
only 3' truncations are allowed and all valid alignments must end with |
| 1361 |
the final nucleotide of the sequence. For the 5' and 3' pipeline |
| 1362 |
variant, 5' and/or 3' truncations are allowed, but all valid |
| 1363 |
alignments must include all nucleotides of the sequence. |
| 1364 |
|
| 1365 |
%REF TO FIGURE WITH ALIGNMENT DISPLAY OF TRUNCATED HITS. |
| 1366 |
|
| 1367 |
\subsubsection{Modifying how truncated hits are detected using |
| 1368 |
command-line options} |
| 1369 |
|
| 1370 |
The description above of the truncated variants of the pipeline |
| 1371 |
describe Infernal's default behavior. You can turn off truncated hit |
| 1372 |
detection with the \ccode{--notrunc} option. You can also modify how |
| 1373 |
truncated hit detection works with the \ccode{--anytrunc} option. With |
| 1374 |
\ccode{--anytrunc}, truncated hits are allowed to occur anywhere |
| 1375 |
within a sequence, instead of necessarily including the first or final |
| 1376 |
nucleotide.\footnote{As of version 1.1.5, truncated hits that end at |
| 1377 |
sequence terminii with a lower score penalty than internally |
| 1378 |
truncated hits are also considered (these were not considered in |
| 1379 |
1.1x versions prior to 1.1.5). To reproduce the behavior of |
| 1380 |
\ccode{--anytrunc} from v1.1.4, use the \ccode{--inttrunc} option |
| 1381 |
instead.} |
| 1382 |
|
| 1383 |
Importantly, the truncated variants of the pipeline are currently not |
| 1384 |
implemented for use with non-HMM banded alignment. This means that the |
| 1385 |
they are incompatible with the \ccode{--max} options and |
| 1386 |
\ccode{--nohmm} options. When either of these options are used, |
| 1387 |
truncated hit detection is automatically turned off. |
| 1388 |
|
| 1389 |
\subsection{HMM-only pipeline variant for models without structure} |
| 1390 |
|
| 1391 |
As mentioned and demonstrated in the tutorial section of the guide, |
| 1392 |
Infernal uses a special HMM-only pipeline for models that have zero |
| 1393 |
basepairs. For a family with zero basepairs, it makes sense to use a |
| 1394 |
profile HMM instead of a covariance model because they will be very |
| 1395 |
similar models (the only important difference between CMs and profile |
| 1396 |
HMMs is the former's ability to model two basepaired positions as |
| 1397 |
dependent on one another) and HMM algorithms are more efficient than |
| 1398 |
CM ones. So a profile HMM search will be as sensitive but faster than |
| 1399 |
a CM one for families with zero basepairs. When \prog{cmsearch} or |
| 1400 |
\prog{cmscan} is being used for a comparison between a sequence and a |
| 1401 |
model with zero basepairs, it will automatically use the HMM-only |
| 1402 |
filter pipeline. For these models, the truncated variants of the |
| 1403 |
pipeline are not used, because the standard HMM pipeline is capable of |
| 1404 |
identifying truncated hits. |
| 1405 |
|
| 1406 |
The HMM-only pipeline that Infernal uses is essentially identical to |
| 1407 |
HMMER3's (version 3.0) pipeline, with the lone |
| 1408 |
difference that the scanning local SSV filter (described for the |
| 1409 |
standard pipeline above) replaces the full-sequence (non-scanning) MSV |
| 1410 |
filter used in HMMER. The scanning SSV filter was originally |
| 1411 |
implemented by Travis Wheeler for a new program in a |
| 1412 |
soon-to-be-released version of HMMER called \prog{nhmmer} for DNA |
| 1413 |
homology search. |
| 1414 |
|
| 1415 |
We won't go through the HMM-only pipeline in as much detail as the |
| 1416 |
standard one (for more, see the HMMER3 user's guide |
| 1417 |
\citep{hmmer3guide}), but briefly the HMM-only pipeline consists of |
| 1418 |
the following steps: local scanning SSV filter to define windows, a |
| 1419 |
bias filter to correct SSV scores for biased composition (identical to |
| 1420 |
the one in the standard pipeline used after the local Viterbi stage), |
| 1421 |
local Viterbi filter for each window, and finally local Forward filter |
| 1422 |
for each window. Windows that survive the local Forward filter are |
| 1423 |
then subject to the 'domain identification' stage of the HMMER |
| 1424 |
pipeline, which identifies hits after full alignment ensemble |
| 1425 |
calculation using the Forward and Backward algorithms. Each hit is |
| 1426 |
then aligned to the HMM using an optimal accuracy alignment algorithm |
| 1427 |
that maximizes the summed posterior probability of all aligned |
| 1428 |
residues. The null3 biased composition model is not used in the |
| 1429 |
HMM-only pipeline, but HMMER's null2 biased composition model is used, |
| 1430 |
see the HMMER3 guide for details on null2. |
| 1431 |
|
| 1432 |
Unlike in the standard pipeline, the filter thresholds used in the |
| 1433 |
HMM-only pipeline are always the same, i.e. they are not dependent on |
| 1434 |
the size of the search space. The default thresholds are the same |
| 1435 |
values used in the HMMER3 pipeline: the SSV filter threshold is |
| 1436 |
$0.02$, the local Viterbi threshold is $0.001$ and the local Forward |
| 1437 |
threshold is $1e-5$. These can be changed with the \ccode{--hmmF1} |
| 1438 |
(SSV), \ccode{--hmmF2} (Viterbi) and \ccode{--hmmF3} (Forward). The |
| 1439 |
\ccode{--hmmmax} option runs the HMM-only pipeline in maximum |
| 1440 |
sensitivity mode with the SSV P-value threshold set at 0.3 and the |
| 1441 |
Viterbi and Forward filters turned off. The HMM-only pipeline can be |
| 1442 |
turned off with the \ccode{--nohmmonly} option. When turned off, all |
| 1443 |
models will use the standard and truncated CM pipelines, even those |
| 1444 |
with no structure. |
| 1445 |
|