Debian Codegraph @

hmmer/documentation/userguide/introduction.tex

raw
1 \newpage
2 \chapter{Introduction}
3 \label{chapter:introduction}
4 \setcounter{footnote}{0}
5
6 Most protein sequences are composed from a relatively small number of
7 ancestral protein domain families. Our sampling of common protein
8 domain families has become comprehensive and deep, while raw sequence
9 data continues to accumulate explosively. It has become advantageous
10 to compare sequences against all known domain families, instead of all
11 known sequences.
12
13 This makes protein sequence analysis more like speech recognition.
14 When you talk to your smartphone, it doesn't compare your digitized
15 speech to everything that's ever been said. It compares what you say
16 to a prebuilt dataset of statistical models of common words and
17 phonemes. Using machine learning techniques, each statistical model
18 is trained on large datasets of examples spoken by different speakers
19 in different accents. Similarly, for each protein domain family, there
20 are typically thousands of known homologs that can be aligned into
21 deep multiple sequence alignments. Sequence alignments reveal a
22 specific pattern of evolutionary conservation particular to that
23 domain's structure and function. These patterns can be captured by
24 probabilistic models.
25
26 HMMER is a software package that provides tools for making
27 probabilistic models of protein and DNA sequence domain families --
28 called \textbf{profile hidden Markov models}, \textbf{profile HMMs},
29 or just \textbf{profiles} -- and for using these profiles to annotate
30 new sequences, to search sequence databases for additional homologs,
31 and to make deep multiple sequence alignments. HMMER underlies
32 several comprehensive collections of alignments and profiles of known
33 protein and DNA sequence domain families, including the Pfam
34 database.\sidenote{\href{http://pfam.org}{pfam.org}}
35
36
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 \section{How to avoid reading this manual}
39
40 I hate reading documentation. If you're like me, you're thinking,
41 \pageref*{manualend} pages of documentation, you've got to be joking!
42 First I want to know that the software compiles, runs, and gives
43 useful results, before I'm going to plow through some
44 \pageref*{manualend} tedious pages of someone's documentation. For
45 fellow cynics who have seen one too many software packages that don't
46 work:
47
48 \begin{itemize}
49
50 \item Follow the quick installation instructions on page
51 \pageref{chapter:installation}. An automated test suite is included,
52 so you will know immediately if something went
53 wrong.\sidenote{Nothing should go wrong.}
54
55 \item Go to the tutorial section on page \pageref{chapter:tutorial},
56 which walks you through examples of using HMMER.
57
58 \end{itemize}
59
60 Everything else, you can come back and read later.
61
62
63
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 \section{Background and brief history}
66
67 A multiple sequence alignment of a homologous family of protein
68 domains reveals patterns of site-specific evolutionary
69 conservation. Key residues may be highly conserved at certain
70 positions; some positions may tolerate certain substitutions while
71 conserving physiochemical properties like hydrophobicity, charge, or
72 size; some positions may be evolutionarily near-neutral and variable;
73 insertions and deletions are tolerated at some positions better than
74 others. A \textbf{profile} is a position-specific scoring model that
75 describes which symbols are likely to be observed and how frequently
76 insertions/deletions occur at each position (column) of a
77 multiple sequence alignment.
78
79 Pairwise sequence alignment methods such as BLAST and FASTA use
80 position-\emph{independent} substitution score matrices such as BLOSUM
81 and PAM, but the desirability of position-\emph{specific} models was
82 recognized even before BLAST and FASTA were written.\cite{Doolittle81}
83 Several groups introduced different position-specific alignment
84 scoring approaches in the 1980's. The name ``profiles'', introduced by
85 Gribskov and colleagues,\cite{Gribskov87} was a name that stuck.
86
87 Profiles have a lot of parameters. The BLOSUM and PAM amino acid
88 substitution matrices have only 210 free parameters (20 $\times$ 20,
89 symmetric), and those parameters are averages over large collections
90 of many different known sequence alignments. A profile typically has
91 at least 22 parameters\marginnote{There's $\sim$22 parameters per
92 position because there's 20 residue scores, plus gap-open and
93 gap-extend penalties for starting or extending an insertion or
94 deletion.} for each of the $\sim$200 consensus positions or so in a
95 typical protein domain, and these thousands of parameters are
96 estimated for one particular sequence family alignment, not averaged
97 across all of them. Early profile methods were vexed by a lack of
98 theoretical underpinnings for how to parameterize these models
99 effectively, especially for insertion and deletions.
100
101 In the 1990's, Anders Krogh, David Haussler, and co-workers at UC
102 Santa Cruz recognized a parallel between profiles and widely used
103 speech recognition techniques, and they introduced \textbf{profile
104 hidden Markov models (profile HMMs)}.\cite{Krogh94} HMMs had been
105 used in biology before, but the Krogh paper had dramatic impact
106 because HMM technology was so well suited to addressing the vexing
107 parameterization problem. HMMs have a formal probabilistic basis,
108 allowing the use of probability theory to set and to interpret the
109 large number of free parameters in a profile, including the
110 position-specific gap and insertion parameters. The methods are
111 mathematically consistent and therefore automatable, which was crucial
112 in allowing people to make libraries of hundreds of profile HMMs and
113 apply them on a large scale to whole genome analysis. One such
114 database of protein domain models is Pfam.\cite{Sonnhammer97}
115 Historically, Pfam and HMMER have been developed in parallel.
116
117 The first implementations of profile HMMs were computationally
118 intensive, including HMMER1 (1995) and HMMER2 (1998), but HMMER3 is
119 now typically faster than BLASTP or FASTA searches even though it uses
120 more complex models.\marginnote{For DNA searches, BLASTN remains about
121 two orders of magnitude faster than HMMER DNA searches, but is less
122 sensitive.}
123
124
125
126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127 \section{Problems HMMER is designed for}
128
129 \paragraph{Sensitive homology searches.}
130 You're working on a specific sequence family, and you've carefully
131 constructed a representative multiple sequence alignment. The HMMER
132 \mono{hmmbuild} program lets you build a profile from your alignment,
133 and the \mono{hmmsearch} program lets you search your profile against
134 a sequence database looking systematically for more homologs.
135
136 \paragraph{... even for single sequence queries.}
137 HMMER3 also works for single sequence comparisons, not just for
138 multiple alignments. Pairwise sequence comparison is just a special
139 case of profile HMMs. HMMER can use a BLOSUM substitution matrix to
140 parameterize a profile built from just one sequence. HMMER3 includes
141 two programs for searching protein databases with single query
142 sequences: \mono{phmmer} and \mono{jackhmmer}. I believe
143 \mono{phmmer} is superior in many respects to BLASTP, and
144 \mono{jackhmmer} to PSI-BLAST.
145
146 \paragraph{Automated annotation of protein domains.}
147 Various large databases of curated alignments and HMMER models of
148 known domains are available, including Pfam and others. Many top ten
149 lists of protein domains, a \emph{de rigueur} table in genome analysis
150 papers, depend on HMMER-based annotation. HMMER3's \mono{hmmscan}
151 program lets you scan a sequence against a profile database to parse
152 the sequence into its component domains.
153
154 \paragraph{Curated collections of deep multiple alignments.} There are thousands of
155 sequence families, some of which comprise hundreds of thousands of
156 sequences, and the raw sequence databases continue to double every
157 year or so. Clustering the entire sequence database into family
158 alignments is a hopeless task for manual curation, but some sort of
159 manual curation remains necessary for high-quality, biologically
160 relevant multiple alignments. Databases like Pfam are constructed by
161 distinguishing between a stable curated ``seed'' alignment of a small
162 number of representative sequences, and ``full'' alignments of all
163 detectable homologs. HMMER is used to make a model of the seed and to
164 search the database for homologs, and the \mono{hmmalign} program can
165 automatically produce the full alignment by aligning every sequence to
166 the seed consensus. \mono{hmmalign} scales to alignments of
167 millions of sequences.
168
169
170
171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
172 \section{HMMER uses ensemble algorithms, \emph{not} optimal alignment}
173
174 Most sequence search tools look for optimal high-scoring
175 alignments. However, sequence alignments are uncertain, and the more
176 distantly related sequences are, the more uncertain their alignment
177 is. Instead of using optimal alignment algorithms, HMMER uses ensemble
178 algorithms that consider all possible alignments, weighted by their
179 relative likelihood.\marginnote{In HMM jargon, HMMER uses the Forward
180 algorithm (and variants of it), not the Viterbi algorithm.} This is
181 one reason that HMMER gets more power than tools that depend on single
182 optimal alignment.
183
184 The use of ensemble algorithms shows up in several HMMER features:
185
186 \paragraph{Explicit representation of alignment uncertainty.}
187 When HMMER shows an alignment, it also calculates how much
188 probability mass that this alignment has in the ensemble -- which
189 means HMMER can annotate a probabilistic confidence in an alignment,
190 or in each individual aligned residue. Some downstream analyses that
191 depend on alignments (such as phylogenetic tree inference) benefit
192 from being able to distinguish confidently aligned residues.
193
194 \paragraph{Sequence scores, not alignment scores.} HMMER's
195 log-odds scores for a sequence aren't optimal alignment scores; they
196 are summed over the posterior alignment ensemble. Statistical
197 inference theory says that scores based on a single optimal
198 alignment are an approximation that breaks down when alignments are
199 uncertain. HMMER's calculation is the full, unapproximated
200 calculation.
201
202 \paragraph{Different speed heuristics.} The ensemble (Forward) algorithm is more
203 computationally intensive than optimal alignment algorithms.
204 HMMER3's acceleration strategy is quite different from
205 BLAST's.\cite{Eddy11}. HMMER implements heuristic accelerations of
206 the HMM Forward algorithm using vectorization technology available
207 on modern processors.\vspace{1em}
208
209 Individually, none of these points is new. As far as alignment
210 ensembles go, one reason why hidden Markov models were so
211 theoretically attractive in the first place for sequence analysis is
212 that they are good probabilistic models for explicitly dealing with
213 alignment uncertainty. The SAM profile HMM software from UC Santa Cruz
214 has always used full probabilistic inference (the HMM Forward/Backward
215 algorithms) as opposed to optimal alignment scores (the HMM Viterbi
216 algorithm). HMMER2 had the full HMM inference algorithms available as
217 command-line options, but it used Viterbi optimal alignment by
218 default, in part for speed reasons.
219
220 One reason why it's been hard to deploy sequence scores for practical
221 large-scale use is that it wasn't known how to accurately calculate
222 the statistical significance of a log-odds score that's been summed
223 over alignment uncertainty. Accurate statistical significance
224 estimates are essential when one is trying to discriminate homologs
225 from millions of unrelated sequences in a large sequence database
226 search. The statistical significance of optimal local alignment scores
227 is calculated by Karlin/Altschul statistics.\cite{Karlin90}
228 Karlin/Altschul statistics are one of the most important and
229 fundamental advances introduced by BLAST. However, Karlin/Altschul
230 theory \emph{doesn't} apply to HMMER's ensemble log-odds sequence
231 scores (HMM ``Forward scores''). The statistical significance
232 (E-values, or expectation values) of HMMER sequence scores is
233 determined by using a theoretical conjecture about the statistical
234 properties of ensemble log-odds scores which have been supported by
235 numerical simulation experiments.\cite{Eddy08}
236
237 And as far as speed goes, the pioneers of heuristic acceleration of
238 sequence database searches are the folks behind BLAST and FASTA, who
239 developed effective heuristics that closely approximate an
240 unaccelerated Smith/Waterman dynamic programming search. The first
241 implementations of profile HMM methods used dynamic programming
242 without heuristics (the profile HMM Viterbi algorithm is essentially
243 Smith/Waterman, just with position-specific probability scores), so
244 they were more comparable in speed to Smith/Waterman than to BLAST.
245 Using the Forward algorithm slowed them down still more. It was a
246 while before I invested the time to develop heuristic acceleration of
247 profile HMM methods. A principal design goal in HMMER3 was to achieve
248 at least rough speed parity with BLAST and FASTA.
249
250
251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 \section{Assumptions and limitations of profile HMMs}
253
254 Profile HMMs are primary sequence consensus models. They assume that
255 the residue at a particular position is independent of the residues at
256 all other positions, and they neglect any higher-order correlations.
257 Profile HMMs are often not good models of structural RNAs, for
258 instance, because an HMM is not an adequate model of correlated base
259 pairs.\marginnote{Our Infernal software provides better tools for
260 structural RNA sequence analysis, using \textbf{profile stochastic
261 context-free grammars}, a more complex class of probability model
262 than HMMs.}
263
264 A profile HMM also lacks any explicit model of the phylogenetic
265 relationships among a set of homologous sequences. Sequences are
266 instead assumed to be independently generated from the profile, which
267 is tantamount to assuming a star phylogeny with fixed branch
268 lengths. Ad hoc sequence weighting techniques are used to compensate
269 for the fact that typical multiple alignments include many redundant,
270 closely related sequences.
271
272
273
274
275
276
277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278 \section{How to learn more}
279
280 Our book \emph{Biological Sequence Analysis}\cite{Durbin98} describes the basic
281 theory behind profile HMMs and HMMER.
282
283 HMMER's open source development code is available on
284 GitHub.\sidenote{\href{http://github.com/EddyRivasLab/hmmer}{github.com/EddyRivasLab/hmmer}}
285 The GitHub issue tracker is the best way to give me suggestions,
286 feature requests, bug reports, and pull requests.
287
288 \textbf{Cryptogenomicon}\sidenote{\href{http://cryptogenomicon.org/}{cryptogenomicon.org}}
289 is a blog where I sometimes talk about issues as they arise in HMMER, and
290 where you can comment or follow the discussion.
291
292
293
294
295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296 \section{How to cite HMMER}
297
298 There has never been a paper on the HMMER software.\sidenote{And the
299 way things are going, there may never be!} The best citation is to
300 the web site, \url{hmmer.org}.
301
302 You should also cite what version of the software you used. I archive
303 all old versions, so anyone should be able to obtain the version you
304 used, when exact reproducibility of an analysis is an issue. The
305 version number is in the header of most output files. To see it
306 quickly, do something like \mono{hmmscan -h} to get a help page, and
307 the header will say:
308
309 \xsreoutput{inclusions/hmmscan-noargs.out}
310
311 So (from the second line there) this is from HMMER \HMMERversion{}.
312
313 If an unenlightened, url-unfriendly journal forces you to cite dead
314 trees, you can cite the 2011 paper on HMMER3
315 acceleration.\cite{Eddy11}
316
317
318
319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
320 \section{How to report a bug}
321
322 Open an issue on our issue tracker at GitHub,\sidenote{\href{https://github.com/EddyRivasLab/hmmer/issues}{github.com/EddyRivasLab/hmmer/issues}}
323 or email me.
324
325 \emph{Please} give me enough information that I can reproduce the
326 bug, including any files. Ideally, I'd like to have a small,
327 reproducible test case. So if you're reporting a bug, please send me:
328
329 \begin{itemize}
330 \item A brief description of what went wrong.
331 \item The command line(s) that reproduce the problem.
332 \item Copies of any files I need to run those command lines.
333 \item Information about what kind of hardware you're on, what
334 operating system, and (if you compiled the software yourself rather
335 than running precompiled binaries), what compiler and version you
336 used, with what configuration arguments.
337 \end{itemize}
338
339 Depending on how glaring the bug is, I may not need all this
340 information, but any work you can put into giving me a clean
341 reproducible test case doesn't hurt and often helps.
342
343 The information about hardware, operating system, and compiler is
344 often important. Bugs are frequently specific to particular
345 configurations of hardware/OS/compiler. I have a wide variety of
346 systems available for trying to reproduce bugs, and I'll try to match
347 your system as closely as we can.
348
349 If you first see a problem on some huge compute (like running a
350 zillion query sequences over a huge profile database), it will really,
351 really help me if you spend a bit of time yourself trying to isolate
352 whether the problem really only manifests itself on that huge compute,
353 or if you can isolate a smaller test case for me. The ideal bug report
354 (for me) gives me everything I need to reproduce your problem in one
355 email with at most some small attachments. \marginnote{Remember, I'm
356 not a company with dedicated support staff -- I'm one person, I've
357 got other stuff to do, the Xfam team is asking me when HMMER4's
358 going to be ready, and I'm as busy as you. I'll need to drop what
359 I'm doing to try to help you out. Work with me to save me some time,
360 and I'm more likely to stay in my usual good mood.}
361
362 If I'm in my usual good mood, I'll reply quickly. I'll probably
363 tell you we fixed the bug in our development code, and that the fix
364 will appear in the next HMMER release. This of course doesn't help you
365 much, since nobody knows when the next HMMER release is going to be.
366 So if possible, I'll usually try to describe a workaround for the
367 bug.
368
369 If the code fix is small, I might also tell you how to patch and
370 recompile the code yourself. You may or may not want to do this.
371
372
373
374
375
376
377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
378 \section{When's HMMER4 coming?}
379
380 HMMER4 has been in development since 2011.\sidenote{OK, \emph{slow}
381 development, but hey.} Some of the stuff it will include:
382
383 \paragraph{The return of glocal alignment.} Slow old HMMER2 was
384 capable of ``glocal'' alignment, in which it would align a complete
385 profile to a subsequence of a target sequence; this was great for
386 annotating domain structure of protein sequences, among other things.
387 In developing our speed heuristic for HMMER3, for numerical reasons,
388 I had to sacrifice glocal alignment; HMMER3 \emph{only} does local
389 alignment. In HMMER4, I've solved the problems that prevented H3 from
390 using glocal alignment. H4 uses a new \emph{dual-mode} profile
391 architecture, combining local and glocal alignment modes in a single
392 probability model.
393
394 \paragraph{Memory efficiency.} The HMMER ensemble alignment
395 algorithms (the HMM Forward and Backward algorithms) are expensive in
396 memory. For most uses, you don't notice, but there are extreme cases
397 where you may. H3 can require as much as $\sim 36L^2$ bytes of memory
398 for a query sequence of length $L$, and for a 35Kaa titin sequence,
399 that's 44GB of RAM. In HMMER4, I've solved this with a variety of old
400 and new techniques.
401
402 \paragraph{Ensemble calculations everywhere.} HMMER uses ensemble
403 calculations (i.e., integrates over alignment uncertainty) for scoring
404 homologous sequences and for calculating the confidence in individual
405 aligned residues. However, when it decides how many domains are in a
406 sequence, and where they are, it uses an \emph{ad hoc} procedure that
407 uses ensemble information, but is not well defined. In HMMER4, we've
408 solved that problem with a new domain definition algorithm.
409
410 \paragraph{More processor support.} One of the attractive features of the
411 HMMER ``MSV'' acceleration algorithm is that it is a very tight and
412 efficient piece of code. The bad news is, it's a very tight and
413 efficient piece of \emph{assembly} code. We have to write
414 processor-specific SIMD vector instructions for each platform that
415 HMMER runs on. HMMER currently only supports x86 (Intel/AMD) and
416 PowerPC platforms (big-endian AIX PowerPC's, not the newer crop of
417 little-endian Linux PowerPC's). HMMER4 will also include support for
418 Linux/PowerPC and ARM NEON. It also can use the latest x86 vector
419 instructions (AVX and AVX-512).
420
421 \paragraph{Better parallelization.} HMMER is so fast that it's often
422 input-bound, rather than CPU-bound: that is, it takes longer just to
423 get the sequences from your disk than it takes to compare them to a
424 profile. That's been taxing the simple parallelization methods we
425 use. HMMER's multithreaded parallelization really doesn't scale well
426 beyond 2-4 processors, on most machines; and possibly worse, if you're
427 on a slow filesystem (for example, if you're reading data from a
428 network filesystem instead of from local disk). In H4, we're working
429 on improving our parallelization and our data input.
430
431
432
433
434
435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
436 \section{What's still missing}
437
438 Two of the more important holes for me are:
439
440 \paragraph{Translated comparisons.} I'd love to have the HMM
441 equivalents of BLASTX, TBLASTN, and TBLASTX. They'll come. In the
442 meantime, I translate DNA sequence to six frames, and search
443 hypothetical ORFs as protein sequences.
444
445 \paragraph{Profile/profile comparison.} A number of pioneering papers and
446 software packages have demonstrated the power of profile/profile
447 comparison for even more sensitive remote homology detection. Check
448 out HHBLITS from Johannes S\"oding's
449 group.\sidenote{\href{https://toolkit.tuebingen.mpg.de/\#/tools/hhblits}{toolkit.tuebingen.mpg.de/\#/tools/hhblits}}
450
451
452
453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
454 \section{How to avoid using this software (links to similar software)}
455
456 Other implementations of profile HMM methods and position-specific
457 scoring matrix methods are available, including:
458
459 \begin{center}
460 \begin{tabular}{lp{5in}l}
461 Software & URL \\ \hline
462 HH-SUITE & \href{http://www.soeding.genzentrum.lmu.de/software-and-servers-2/}{www.soeding.genzentrum.lmu.de/software-and-servers-2}\\
463 PSI-BLAST & \href{https://blast.ncbi.nlm.nih.gov/}{blast.ncbi.nlm.nih.gov}\\
464 PFTOOLS & \href{http://web.expasy.org/pftools/}{web.expasy.org/pftools}\\
465 SAM & \href{https://compbio.soe.ucsc.edu/sam.html}{compbio.soe.ucsc.edu/sam.html}\\
466 \end{tabular}
467 \end{center}
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482