Debian Codegraph @

documentation/userguide/formats.tex

raw
1 \section{File and output formats}
2 \label{section:formats}
3 \setcounter{footnote}{0}
4
5 \subsection{Infernal CM files}
6
7 The file \prog{tutorial/Cobalamin.c.cm} gives an example of an Infernal ASCII
8 CM save file. An abridged version is shown here, where (\ldots) mark
9 deletions made for clarity and space:
10
11 \begin{tinysreoutput}
12 INFERNAL1/a [1.1 | June 2012]
13 NAME Cobalamin
14 ACC RF00174
15 DESC Cobalamin riboswitch
16 STATES 592
17 NODES 163
18 CLEN 191
19 W 460
20 ALPH RNA
21 RF no
22 CONS yes
23 MAP yes
24 DATE Wed Jun 13 05:40:07 2012
25 COM [1] ./cmbuild Cobalamin.cm ../tutorial/Cobalamin.sto
26 COM [2] ./cmcalibrate Cobalamin.cm
27 PBEGIN 0.05
28 PEND 0.05
29 WBETA 1e-07
30 QDBBETA1 1e-07
31 QDBBETA2 1e-15
32 N2OMEGA 1.52588e-05
33 N3OMEGA 1.52588e-05
34 ELSELF -0.08926734
35 NSEQ 431
36 EFFN 6.652168
37 CKSUM 2307274568
38 NULL 0.000 0.000 0.000 0.000
39 GA 39.00
40 TC 39.00
41 NC 38.79
42 EFP7GF -9.3826 0.71319
43 ECMLC 0.69050 -9.55632 -0.82028 1600000 499982 0.002400
44 ECMGC 0.33713 -30.56949 -21.45119 1600000 8652 0.046232
45 ECMLI 0.68481 -7.98572 0.30786 1600000 351369 0.003415
46 ECMGI 0.38286 -21.23885 -13.16656 1600000 8796 0.045475
47 CM
48 [ ROOT 0 ] - - - - - -
49 S 0 -1 0 1 4 0 1 460 771 -8.175 -8.382 -0.025 -6.528
50 IL 1 1 2 1 4 86 133 462 774 -1.686 -2.369 -1.117 -4.855 0.000 0.000 0.000 0.000
51 IR 2 2 3 2 3 86 133 462 774 -1.442 -0.798 -4.142 0.000 0.000 0.000 0.000
52 [ MATL 1 ] 1 - u - - -
53 ML 3 2 3 5 3 86 132 461 772 -9.129 -0.009 -7.783 0.192 -0.324 -0.320 0.331
54 D 4 2 3 5 3 80 128 458 769 -6.226 -1.577 -0.618
55 IL 5 5 3 5 3 85 132 461 773 -1.442 -0.798 -4.142 0.000 0.000 0.000 0.000
56 (...)
57 [ MATL 98 ] 151 - C - - -
58 ML 588 587 3 590 2 1 1 1 1 * 0.000 -3.022 1.825 -3.061 -2.226
59 D 589 587 3 590 2 0 0 0 0 * 0.000
60 IL 590 590 3 590 2 1 1 13 28 -1.823 -0.479 0.000 0.000 0.000 0.000
61 [ END 99 ] - - - - - -
62 E 591 590 3 -1 0 0 0 0 0
63 //
64 HMMER3/f [i1.1 | June 2012]
65 NAME Cobalamin
66 ACC RF00174
67 DESC Cobalamin riboswitch
68 LENG 191
69 MAXL 565
70 ALPH RNA
71 RF no
72 MM no
73 CONS yes
74 CS yes
75 MAP yes
76 DATE Wed Jun 13 05:40:08 2012
77 COM [1] ./cmbuild Cobalamin.cm ../tutorial/Cobalamin.sto
78 NSEQ 431
79 EFFN 4.955421
80 CKSUM 2307274568
81 STATS LOCAL MSV -10.2356 0.71319
82 STATS LOCAL VITERBI -12.2484 0.71319
83 STATS LOCAL FORWARD -3.9056 0.71319
84 HMM A C G U
85 m->m m->i m->d i->m i->i d->m d->d
86 COMPO 1.37169 1.39466 1.27962 1.51293
87 1.38629 1.38629 1.38629 1.38629
88 0.02747 4.30141 4.30141 1.46634 0.26236 0.00000 *
89 1 1.24903 1.60847 1.61442 1.15831 1 u - - :
90 1.38629 1.38629 1.38629 1.38629
91 0.02747 4.30141 4.30141 1.46634 0.26236 1.09861 0.40547
92 (...)
93 191 1.51542 1.17791 1.56046 1.33817 441 c - - :
94 1.38629 1.38629 1.38629 1.38629
95 0.01381 4.28939 * 1.46634 0.26236 0.00000 *
96 //
97 \end{tinysreoutput}
98
99 A CM file consists of one or more CMs and associated filter
100 HMMs. Each CM is immediately followed by its filter HMM, this is
101 mandatory. Each CM starts with a format version identifier (here,
102 \prog{INFERNAL1/a}) and ends with \prog{//} on a line by itself. Each
103 HMM also starts with a format version identifier (here,
104 \prog{HMMER3/f}) and ends with \prog{//} on a line by itself. The
105 format version identifier allows backward compatibility as the
106 Infernal software evolves: it tells the parser this file is from
107 Infernal's save file format version a. The closing \prog{//} allows
108 Infernal to determine when a CM ends and its profile HMM begins, and
109 allows multiple CM/filter HMM pairs to be concatenated together into a
110 single file.
111
112 The CM format is divided into two regions. The first region contains
113 textual information and miscalleneous parameters in a roughly
114 tag-value scheme. This section ends with a line beginning with the
115 keyword \prog{CM}. The second region is a tabular, whitespace-limited
116 format for the main model parameters.
117
118 All emission and transition model parameters are stored as log-odds
119 scores in bits with three digits of precision to the right of the
120 decimal point, rounded.
121 %For example, a probability of $0.25$ is stored
122 %as $\log_2 0.25 = -1.38629$.
123 The special case of a score of infinity, corresponding to an
124 impossible emission or transition, is stored as '*'.
125
126 Spacing is arranged for human readability, but the parser only cares
127 that fields are separated by at least one space character.
128
129 The CM format is described in more detail below, followed by a
130 description of the HMMER3 HMM format for the CM's mandatory filter HMM
131 filter.
132
133 \subsubsection{CM header section}
134
135 The header section is parsed line by line in a tag/value format. Each
136 line type is either \textbf{mandatory} or \textbf{optional} as
137 indicated.
138
139 \begin{sreitems}{QDBBETA1 <f>}
140
141 \item [\emprog{INFERNAL1/a}] Unique identifier for the save file format
142 version; the \prog{/a} means that this is INFERNAL1 CM file format
143 version a. When INFERNAL changes its save file format, the revision
144 code advances. This way, parsers may easily remain backwards
145 compatible. The remainder of the line after the \prog{INFERNAL1/a} tag
146 is free text that is ignored by the parser. INFERNAL currently writes
147 its version number and release date in brackets here,
148 e.g. \prog{[1.1 | June 2012]} in this
149 example. \textbf{Mandatory.}
150
151 \item [\emprog{NAME <s>}] Model name; \prog{<s>} is a single word
152 containing no spaces or tabs. The name is normally picked up from the
153 \verb+#=GF ID+ line from a Stockholm alignment file. If this is not
154 present, the name is created from the name of the alignment file by
155 removing any file type suffix. For example, an otherwise nameless CM
156 built from the alignment file \prog{tRNA.sto} would be named
157 \prog{tRNA}. \textbf{Mandatory.}
158
159 \item [\emprog{ACC <s>}] Accession number; \prog{<s>} is a one-word
160 accession number. This is picked up from the \verb+#=GF AC+ line in a
161 Stockholm format alignment. \textbf{Optional.}
162
163 \item [\emprog{DESC <s>}] Description line; \prog{<s>} is a one-line
164 free text description. This is picked up from the \verb+#=GF DE+ line
165 in a Stockholm alignment file. \textbf{Optional.}
166
167 \item [\emprog{STATES <d>}] Number of states; \prog{<d>}, a positive nonzero
168 integer, is the number of states in the model.
169 \textbf{Mandatory.}
170
171 \item [\emprog{CLEN <d>}] Consensus model length; \prog{<d>}, a positive nonzero
172 integer, is the number of consensus positions in the model, which
173 equals the number of MATL nodes plus the number of MATR nodes plus two
174 times the number of MATP nodes.
175 \textbf{Mandatory.}
176
177 \item [\emprog{W <d>}] Window length; \prog{<d>}, a positive nonzero
178 integer, is the length in residues of the maximum expected size of a
179 hit to this model. This is calculated based on the transition
180 probabilities of the model\footnote{Specifically, \prog{W} is set as
181 the \emph{dmax} value for the ROOT\_S state (state 0) from the QDB
182 algorithm using $\beta$ equal to the \prog{WBETA} value
183 \citep{NawrockiEddy07}.} \textbf{Mandatory.}
184
185 \item [\emprog{ALPH <s>}] Symbol alphabet type. Currently this will
186 necessarily be \prog{RNA} for RNA sequence analysis models.
187 The symbol alphabet size $K$ is set to 4 and the
188 symbol alphabet to ``ACGU''. \textbf{Mandatory.}
189
190 \item [\emprog{RF <s>}] Reference annotation flag; \prog{<s>} is
191 either \prog{no} or \prog{yes} (case insensitive). If \prog{yes}, the
192 reference annotation character field(s) for each match state in the
193 main model (see below) is valid; if \prog{no}, these characters are
194 ignored. Reference column annotation is picked up from a Stockholm
195 alignment file's \verb+#=GC RF+ line. by \prog{cmbuild}. It is
196 propagated to alignment outputs, and also may optionally be used to
197 define consensus match columns in CM
198 construction. \textbf{Optional}; assumed to be no if not present.
199
200 \item [\emprog{CONS <s>}] Consensus residue annotation flag;
201 \prog{<s>} is either \prog{no} or \prog{yes} (case insensitive). If
202 \prog{yes}, the consensus residue field(s) for each match state in
203 the main model (see below) is valid. If \prog{no}, these characters
204 are ignored. Consensus residue annotation is determined when models
205 are built. For models of single sequences, the consensus is the same
206 as the query sequence. For models of multiple alignments, the
207 consensus is the highest scoring residue or basepair for each match
208 state. Upper case MATL\_ML and MATR\_MR (single stranded) residues
209 indicate that the model emission's score for the consensus residue
210 is $\geq$ to 1.0 bit. Upper case MATP\_MP basepairs indicate that
211 the model emission's score for the consensus basepair is $\geq$ to
212 3.0 bits.
213
214 \item [\emprog{MAP <s>}] Map annotation flag; \prog{<s>} is either
215 \prog{no} or \prog{yes} (case insensitive). If set to \prog{yes}, the
216 map annotation field in the main model (see below) is valid; if
217 \prog{no}, that field will be ignored. The CM/alignment map
218 annotates each match state with the index of the alignment column from
219 which it came. It can be used for quickly mapping any subsequent
220 CM alignment back to the original multiple alignment, via the model.
221 \textbf{Optional}; assumed to be no if not present.
222
223 \item [\emprog{DATE <s>}] Date the model was constructed; \prog{<s>}
224 is a free text date string. This field is only used for logging
225 purposes. \textbf{Optional.}
226
227 \item [\emprog{COM [<n>] <s>}] Command line log; \prog{<n>} counts
228 command line numbers, and \prog{<s>} is a one-line command. There may
229 be more than one \prog{COM} line per save file, each numbered starting
230 from $n=1$. These lines record every Infernal command that modified the
231 save file. This helps us reproducibly and automatically log how Rfam
232 models have been constructed, for example. \textbf{Optional.}
233
234 \item [\emprog{PBEGIN <f>}] Local begin probability; The aggregate
235 probability of a local begin into any internal entry state is
236 \prog{<f>}. The probability of a local begin into any single internal
237 entry state is \prog{<f>} divided by the number of internal entry
238 states in the model. All MATP\_MP, MATL\_ML, MATR\_MR, and BIF\_B
239 states, except for any in the the second node of the model (first
240 non-ROOT node), are internal entry states. The local begin probability
241 does not affect any of the emission/transition parameters in the CM
242 file, which correspond to the CM in \emph{global} search/alignment
243 mode, but it does affect the calibration of E-value parameters for
244 local search by \prog{cmcalibrate}. \prog{cmsearch} and \prog{cmscan}
245 therefore need to read this probability from the CM file in order to
246 use the same local begin probabilities used during calibration and
247 report appropriate E-values. \textbf{Optional}; assumed to be $0.05$
248 if not present.
249
250 \item [\emprog{PEND <f>}] Local end probability; The aggregate
251 probability of a local end out of any internal exit state is
252 \prog{<f>}. The probability of a local end out of any single internal
253 entry state is \prog{<f>} divided by the number of internal exit
254 states in the model. All MATP\_MP, MATL\_ML, MATR\_MR, BEGL\_S, and
255 BEGR\_S states, except for any for which the following node is an END
256 node, are internal exit states. The local end probability
257 does not affect any of the emission/transition parameters in the CM
258 file, which correspond to the CM in \emph{global} search/alignment
259 mode, but it does affect the calibration of E-value parameters for
260 local search by \prog{cmcalibrate}. \prog{cmsearch} and \prog{cmscan}
261 therefore need to read this probability from the CM file in order to
262 use the same local end probabilities used during calibration and
263 report appropriate E-values. \textbf{Optional}; assumed to be $0.05$
264 if not present.
265
266 \item [\emprog{WBETA <f>}] Tail loss probability for calculating
267 window length (W); The QDB algorithm \citep{NawrockiEddy07} was used
268 to determine the maximum expected length of a hit (W) using a tail
269 loss probability of \otext{<f>}, W was set as the \emph{dmax} value for the
270 ROOT\_S state (state 0). \textbf{Mandatory.}
271
272 \item [\emprog{QDBBETA1 <f>}] Tail loss probability for calculating
273 the tighter of the two sets of query-dependent bands (QDBs); The QDB
274 algorithm \citep{NawrockiEddy07} was used to determine the minimum
275 and maximum subsequence lengths allowed to align to the subtree
276 rooted at each state of the model, using a tail loss $\beta$
277 probability of \otext{<f>}. These minimum and maximum values for each state
278 are included in each state line in the main model section, described
279 below. below. The \prog{<f>} value for \prog{QDBBETA2} will be
280 less than or equal to the \prog{<f>} value for \prog{QDBBETA1}.
281 \textbf{Mandatory.}
282
283 \item [\emprog{QDBBETA2 <f>}] Tail loss probability for calculating
284 the looser of the two sets of query-dependent bands (QDBs); The QDB
285 algorithm \citep{NawrockiEddy07} was used to determine the minimum
286 and maximum subsequence lengths allowed to align to the subtree
287 rooted at each state of the model, using a tail loss $\beta$
288 probability of \prog{<f>}. These minimum and maximum values for each state
289 are included in each state line in the main model section, described
290 below. The \prog{<f>} value for \prog{QDBBETA2} will be less than
291 or equal to the \prog{<f>} value for \prog{QDBBETA1}.
292 \textbf{Mandatory.}
293
294 \item [\emprog{N2OMEGA <f>}] The prior probability for the alternative
295 ``null2'' model for biased composition
296 sequences. \textbf{Mandatory}; but only relevant in \prog{cmsearch} and
297 \prog{cmscan} if the \prog{--null2} option is used.
298
299 \item [\emprog{N3OMEGA <f>}] The prior probability for the alternative
300 ``null3'' model for biased composition
301 sequences. \textbf{Mandatory}; the null3 model is used by default in
302 \prog{cmcalibrate}, \prog{cmsearch} and \prog{cmscan}.
303
304 \item [\emprog{NSEQ <d>}] Sequence number; \prog{<d>} is a nonzero
305 positive integer, the number of sequences that the CM was trained on,
306 i.e. the number of sequences in the input alignment used to create the
307 CM in \prog{cmbuild}. This field is only used for logging
308 purposes. \textbf{Optional.}
309
310 \item [\emprog{EFFN <f>}] Effective sequence number; \prog{<f>} is a
311 nonzero positive real, the effective total number of sequences
312 determined by \prog{cmbuild} during sequence weighting, for combining
313 observed counts with Dirichlet prior information in parameterizing the
314 model. This field is only used for logging purposes.
315 \textbf{Optional.}
316
317 \item [\emprog{CKSUM <d>}] Training alignment checksum; \prog{<d>} is
318 a nonnegative unsigned 32-bit integer. This number is calculated
319 from the training sequence data, and used in conjunction with the
320 alignment map information to verify that a given alignment is indeed
321 the alignment that the map is for. \textbf{Optional.}
322
323 \item [\emprog{NULL <f> <f> <f> <f>}] null model emission scores for
324 each alphabet symbol. By default, these are all \prog{0.0} but may
325 not be if the \prog{--null} option was used in \prog{cmbuild} to
326 define alternative null model scores. Because only RNA CMs can be
327 built by \prog{cmbuild} there will be four values on this line, one
328 each for ``A'', ``C'', ``G'', and ``U''. \textbf{Mandatory.}
329
330 \item [\emprog{GA <f>}] Rfam GA gathering threshold bit score. The GA
331 bit score threshold is normally picked up from the \verb+#=GF GA+ line
332 from a Stockholm alignment file. GA thresholds are generally
333 considered to be the reliable curated thresholds defining family
334 membership; for example, in Rfam, these thresholds define what gets
335 included in Rfam Full alignments based on searches with Rfam Seed
336 models. \textbf{Optional.}
337
338 \item [\emprog{NC <f>}] Rfam NC noise cutoff bit score.
339 The NC bit score threshold is normally picked up from the
340 \verb+#=GF NC+ line from a Stockholm alignment file.
341 NC thresholds are generally considered to be the
342 score of the highest-scoring known false positive found by searches
343 during preparation of the Rfam database. \textbf{Optional.}
344
345 \item [\emprog{TC <f>}] Rfam TC trusted cutoff bit score.
346 The TC bit score threshold is normally picked up from the
347 \verb+#=GF TC+ line from a Stockholm alignment file.
348 TC thresholds are generally considered to be the score of the lowest
349 scoring believed true positive that is above all known false positives
350 found by searches during preparation of the Rfam database.
351 \textbf{Optional.}
352
353 \item [\emprog{EFP7GF <f1> <f2>}] Statistical parameters for filter HMM
354 E-value calculations in glocal mode for the Forward algorithm.
355 \prog{<f1>} and \prog{<f2>} are $\tau$ and $\lambda$ for exponential
356 tails for glocal Forward filter HMM scores. This line is necessary
357 in the CM file section rather than the filter HMM file because
358 glocal HMM searches are not normally performed in HMMER3, but are
359 part of the HMM filter pipeline in Infernal. \textbf{Mandatory.}
360
361 \item [\emprog{ECMLC <f1> <f2> <f3> <d1> <d2> <f4>}] Statistical
362 parameters needed for E-value calculations for the CM CYK algorithm
363 in local mode. This line, along with the next three, with tags
364 \prog{ECMGC}, \prog{ECMLI}, and \prog{ECMGI}, must either all be
365 present or none of them must be present. If present, the model is
366 considered calibrated for E-value statistics. These lines will not
367 be present in a model after it is created by \prog{cmbuild} but will
368 be added by the \prog{cmcalibrate} program. \prog{<f1>} and
369 \prog{<f2>} are $\lambda$ and $\tau$, the slope and location
370 parameters for exponential tails for local CYK scores. $\lambda$
371 values must be positive. The remaining values were computed in
372 \prog{cmcalibrate} during model calibration: \prog{<f3>} is a
373 different $\tau$ value computed for the full histogram of all hits;
374 \prog{<d1>} is the database size in residues; \prog{<d2>} is the
375 total number of non-overlapping hits of any score found; \prog{<f4>}
376 is the fraction of the high-scoring histogram tail fit to an
377 exponential tail. Of these parameters, only \prog{<f1>}, \prog{<f2>}
378 and \prog{<d2>} are used, the others are only stored in the CM file
379 for record keeping purposes.
380
381 \item [\emprog{ECMGC <f1> <f2> <f3> <d1> <d2> <f4>}] Statistical
382 parameters analogous to those described above in the \prog{ECMLC}
383 line, except that these pertain to CM CYK scores in glocal mode.
384
385 \item [\emprog{ECMLI <f1> <f2> <f3> <d1> <d2> <f4>}] Statistical
386 parameters analogous to those described above in the \prog{ECMLC}
387 line, except that these pertain to CM Inside scores in local mode.
388
389 \item [\emprog{ECMGI <f1> <f2> <f3> <d1> <d2> <f4>}] Statistical
390 parameters analogous to those described above in the \prog{ECMLC}
391 line, except that these pertain to CM Inside scores in glocal mode.
392
393 \item [\emprog{CM}] Flags the start of the main model
394 section. \textbf{Mandatory.}
395
396 \end{sreitems}
397
398 \subsubsection{CM main model section}
399
400 All the remaining fields are \textbf{mandatory}.
401
402 The model section consistes of two types of lines: node lines and
403 state lines. Each node line is immediately followed by one or more
404 state lines, one each for each state within the node.
405
406 \begin{sreitems}{\textbf{State line}}
407
408 \item [\textbf{Node line}] Each node line begins with 45 spaces, and
409 includes ten fields.
410
411 The first field is always a \prog{[} character.
412
413 The second is the node type, one of ROOT, MATP, MATL, MATR, BIF,
414 BEGL, BEGR, or END.
415
416 The next field is the index of the node in the
417 model, greater than or equal to 0. Node indices are not always in
418 increasing order, e.g. node 200 may come on a line before node 100.
419
420 The fourth field is always a \prog{]} character.
421
422 The next two fields are the \prog{MAP} annotation for this node. If
423 \prog{MAP} was \prog{yes} in the header and the node is a MATP
424 (match pair) node, then these fields will both be positive integers,
425 representing the alignment column indices for the left and right
426 halves of this match pair state, respectively. If \prog{MAP} was
427 \prog{yes} and the node is a MATL (match left) node, then the first
428 field will be the alignment column for this match state and the
429 second field will be '-'. If \prog{MAP} was
430 \prog{yes} and the node is a MATR (match right) node, then the first
431 field will be '-' and the second field will be the alignment column
432 for this match state. If the node is any other type, or if the
433 \prog{MAP} was \prog{no} in the header, then both fields will be '-'.
434
435 The next two fields are the \prog{CONS} consensus residue(s) for
436 this node. If \prog{CONS} was \prog{yes} in the header and the node
437 is a MATP (match pair) node, then these fields will both be
438 characters, the consensus residues for the left and right halves of
439 this match pair state, respectively. If \prog{CONS} was \prog{yes}
440 and the node is a MATL (match left) node, then the first field will
441 be the consensus residue for this state and the second field will be
442 '-'. If \prog{CONS} was \prog{yes} and the node is a MATR (match
443 right) node, then the first field will be '-' and the second field
444 will be the consensus residue for this state. If the node is
445 any other type, or if the \prog{CONS} was \prog{no} in the header,
446 then both fields will be '-'.
447
448 The final two fields are the \prog{RF} annotation for this node.
449 this node. If \prog{RF} was \prog{yes} in the header and the node is
450 a MATP (match pair) node, then these fields will both be characters,
451 the reference annotation character for the left and right halves of
452 this match pair state, respectively. If \prog{RF} was \prog{yes} and
453 the node is a MATL (match left) node, then the first field will be
454 the reference annotation character for this state and the second field
455 will be '-'. If \prog{RF} was \prog{yes} and the node is a MATR
456 (match right) node, then the first field will be '-' and the second
457 field will be the reference annotation character for this state. If
458 the node is any other type, or if the \prog{CONS} was \prog{no} in
459 the header, then both fields will be '-'.
460
461 Each node line is followed by 1 to 6 state
462 lines depending on the node type. ROOT, MATL, and MATR node lines
463 are followed by 3 state lines. BIF, BEGL, and END nodes are followed
464 by 1 state line. BEGLR node lines have 2 state lines after them, and
465 MATP node lines are followed by 6 state lines.
466
467 \item [\textbf{State line}]
468 The number of fields on a state line is variable depending on the
469 state type and the number of possible transitions from the
470 state. The first field is the state type, either ``MP'', ``ML'',
471 ``MR'', ``IL'', ``IR'', ``D'', ``B'', ``S'', or ``E''.
472
473 The next field is the state index, these are in increasing order
474 starting with 0 (i.e. lower numbered states always occur earlier in the
475 file than higher numbered ones).
476
477 The next field is the index of the highest numbered ``parent''
478 state for the current state, where state $a$ is a parent of state
479 $b$ if state $a$ can transition to state $b$.
480
481 The next field is the number of parent states for the current
482 state. A set of parent states are always contiguously numbered. For
483 example, if state $a$ is the highest numbered parent state of $b$
484 and $b$ has 3 parent states, then $a-2$, $a-1$, and $a$ are the
485 three parent states of $b$.
486
487 The next field is the index of the lowest numbered ``child'' state
488 for the current state, where state $c$ is a child of state $b$ if
489 $b$ can transition to state $c$.
490
491 The next field is the number of child states for the current
492 state. A set of child states are always contiguously numbered. For
493 example, if state $c$ is the lowest numbered parent state of $b$ and
494 $b$ has 3 parent states, then $c$, $c+1$, and $c+2$ are the three
495 child states of $b$. As a special case, for ``B'' (bifurcation) states
496 this field is the state index of the ``BEGR\_S'' state to which the
497 ``B'' state necessarily transitions with probability 1.0.
498
499 The next four fields \prog{<n1>}, \prog{<n2>}, \prog{<n3>}, and
500 \prog{<n4>} are query dependent band values for the current
501 state. These are integers. \prog{<n1>} is the minimum expected
502 subsequence length to align at the subtree rooted at this state
503 calculated with the QDB algorithm \citep{NawrockiEddy07} using a
504 $\beta$ tail loss probability value given in the header in the
505 \prog{QDBBETA2} line. \prog{<n2>} is the same, but calculated with
506 $\beta$ equal to the value from the \prog{QDBBETA1} header line.
507 \prog{<n3>} is the maximum expected
508 subsequence length to align at the subtree rooted at this state
509 calculated with the QDB algorithm \citep{NawrockiEddy07} using a
510 $\beta$ tail loss probability value given in the header in the
511 \prog{QDBBETA1} line. \prog{<n4>} is the same, but calculated with
512 $\beta$ equal to the value from the \prog{QDBBETA2} header line.
513 These values should be in increasing order: $<n1> \leq <n2> \leq
514 <n3> \leq <n4>$, although Infernal does not enforce this to be
515 true. The QDB values will only be used by \prog{cmsearch} and
516 \prog{cmscan} if certain option combinations are used (see the
517 manual page for those programs); by default they are not used.
518
519 After the four QDB values, the next set of fields are log-odds bit
520 scores for possible transitions out of this state to all child
521 states of the current states. The number of child states is given
522 earlier on the line as the sixth field. It varies depending on the
523 state type and the node type of the \emph{next} node in the model.
524 For a list of all possible sets of transitions for each possible
525 state type/next node combination see Table 1 of
526 \citep{NawrockiEddy07}. As a special case, ``B'' (bifurcation) states
527 have zero transition score fields, they necessarily transition to
528 their child ``BEGL\_S'' and ``BEGR\_S'' states with a probability of
529 $1.0$ (score of $0$ bits).
530
531 After the transition scores are the emission scores.
532 ``MP'' state lines have 16 emission log-odds bit scores. All other
533 types of emitting states (``ML'', ``MR'', ``IL'', ``IR'') will have
534 four emission scores. All other types of states will have no
535 emission scores. For ``MP'' states, the sixteen scores are for the
536 sixteen possible non-degenerate RNA basepairs: ``AA'', ``AC'',
537 ``AG'', ``AU'', ``CA'', ``CC'', ``CG'', ``CU'', ``GA'', ``GC'',
538 ``GG'', ``GU'', ``UA'', ``UC'', ``UG'', ``UU'', in that order.
539 For the other emitting states the four scores are for ``A'', ``C'',
540 ``G'', and ``U'', in that order.
541 \end{sreitems}
542
543 Finally, the last line of the format is the ``//'' record separator.
544 After the CM comes its associated filter HMM in HMMER3 format,
545 described below.
546
547 \subsubsection{HMMER3 filter HMM format}
548
549 As with the CM, the HMM format is divided into two regions. The first
550 region contains textual information and miscalleneous parameters in a
551 roughly tag-value scheme. This section ends with a line beginning
552 with the keyword \prog{HMM}. The second region is a tabular,
553 whitespace-limited format for the main model parameters.
554
555 All HMM probability parameters are all stored as negative natural log
556 probabilities with five digits of precision to the right of the
557 decimal point, rounded. For example, a probability of $0.25$ is stored
558 as $-\log 0.25 = 1.38629$. The special case of a zero probability is
559 stored as '*'.
560
561 Spacing is arranged for human readability, but the parser only cares
562 that fields are separated by at least one space character.
563
564 A more detailed description of the format follows\footnote{This section is
565 nearly identical to one from the HMMER3 user's guide
566 \cite{hmmer3guide}. It is included here, instead of just providing
567 reference to the HMMER guide, for convenience.}.
568
569 \subsubsection{HMM header section}
570
571 The header section is parsed line by line in a tag/value format. Each
572 line type is either \textbf{mandatory} or \textbf{optional} as
573 indicated.
574
575 \begin{sreitems}{\emprog{STATS <s1> <s2> <f>}}
576
577 \item [\emprog{HMMER3/f}] Unique identifier for the save file format
578 version; the \prog{/b} means that this is HMMER3 HMM file format
579 version b. When HMMER3 changes its save file format, the revision
580 code advances. This way, parsers may easily remain backwards
581 compatible. The remainder of the line after the \prog{HMMER3/b} tag
582 is free text that is ignored by the parser. HMMER currently writes
583 its version number and release date in brackets here,
584 e.g. \prog{[3.0b2 | June 2009]} in this
585 example. \textbf{Mandatory.}
586
587 \item [\emprog{NAME <s>}] Model name; \prog{<s>} is a single word
588 containing no spaces or tabs. The name is normally picked up from the
589 \verb+#=GF ID+ line from a Stockholm alignment file. If this is not
590 present, the name is created from the name of the alignment file by
591 removing any file type suffix. For example, an otherwise nameless HMM
592 built from the alignment file \prog{rrm.slx} would be named
593 \prog{rrm}. \textbf{Mandatory.}
594
595 \item [\emprog{ACC <s>}] Accession number; \prog{<s>} is a one-word
596 accession number. This is picked up from the \verb+#=GF AC+ line in a
597 Stockholm format alignment. \textbf{Optional.}
598
599 \item [\emprog{DESC <s>}] Description line; \prog{<s>} is a one-line
600 free text description. This is picked up from the \verb+#=GF DE+ line
601 in a Stockholm alignment file. \textbf{Optional.}
602
603 \item [\emprog{LENG <d>}] Model length; \prog{<d>}, a positive nonzero
604 integer, is the number of match states in the model.
605 \textbf{Mandatory.}
606
607 \item [\emprog{ALPH <s>}] Symbol alphabet type. For biosequence
608 analysis models, \prog{<s>} is \prog{amino}, \prog{DNA}, or \prog{RNA}
609 (case insensitive). There are also other accepted alphabets for
610 purposes beyond biosequence analysis, including \prog{coins},
611 \prog{dice}, and \prog{custom}. This determines the symbol alphabet
612 and the size of the symbol emission probability distributions. If
613 \prog{amino}, the alphabet size $K$ is set to 20 and the symbol
614 alphabet to ``ACDEFGHIKLMNPQRSTVWY'' (alphabetic order); if
615 \prog{DNA}, the alphabet size $K$ is set to 4 and the symbol alphabet
616 to ``ACGT''; if \prog{RNA}, the alphabet size $K$ is set to 4 and the
617 symbol alphabet to ``ACGU''. \textbf{Mandatory.}
618
619 \item [\emprog{RF <s>}] Reference annotation flag; \prog{<s>} is
620 either \prog{no} or \prog{yes} (case insensitive). If \prog{yes}, the
621 reference annotation character field for each match state in the main
622 model (see below) is valid; if \prog{no}, these characters are
623 ignored. Reference column annotation is picked up from a Stockholm
624 alignment file's \verb+#=GC RF+ line. It is propagated to alignment
625 outputs, and also may optionally be used to define consensus match
626 columns in profile HMM construction. \textbf{Optional}; assumed to be
627 no if not present.
628
629 \item [\emprog{CONS <s>}] Consensus residue annotation flag;
630 \prog{<s>} is either \prog{no} or \prog{yes} (case insensitive). If
631 \prog{yes}, the consensus residue field for each match state in the
632 main model (see below) is valid. If \prog{no}, these characters are
633 ignored. Consensus residue annotation is determined when models are
634 built. For models of single sequences, the consensus is the same as
635 the query sequence. For models of multiple alignments, the consensus
636 is the maximum likelihood residue at each position. Upper case
637 indicates that the model's emission probability for the consensus
638 residue is $\geq$ an arbitrary threshold (0.5 for protein models,
639 0.9 for DNA/RNA models).
640
641 \item [\emprog{CS <s>}] Consensus structure annotation flag;
642 \prog{<s>} is either \prog{no} or \prog{yes} (case insensitive). If
643 \prog{yes}, the consensus structure character field for each match
644 state in the main model (see below) is valid; if \prog{no} these
645 characters are ignored. Consensus structure annotation is picked up
646 from a Stockholm file's \verb+#=GC SS_cons+ line, and propagated to
647 alignment displays. \textbf{Optional}; assumed to be no if not
648 present.
649
650 \item [\emprog{MAP <s>}] Map annotation flag; \prog{<s>} is either
651 \prog{no} or \prog{yes} (case insensitive). If set to \prog{yes}, the
652 map annotation field in the main model (see below) is valid; if
653 \prog{no}, that field will be ignored. The HMM/alignment map
654 annotates each match state with the index of the alignment column from
655 which it came. It can be used for quickly mapping any subsequent
656 HMM alignment back to the original multiple alignment, via the model.
657 \textbf{Optional}; assumed to be no if not present.
658
659 \item [\emprog{DATE <s>}] Date the model was constructed; \prog{<s>}
660 is a free text date string. This field is only used for logging
661 purposes. \textbf{Optional.}
662
663 \item [\emprog{COM [<n>] <s>}] Command line log; \prog{<n>} counts
664 command line numbers, and \prog{<s>} is a one-line command. There may
665 be more than one \prog{COM} line per save file, each numbered starting
666 from $n=1$. These lines record every HMMER command that modified the
667 save file. This helps us reproducibly and automatically log how Pfam
668 models have been constructed, for example. \textbf{Optional.}
669
670 \item [\emprog{NSEQ <d>}] Sequence number; \prog{<d>} is a nonzero
671 positive integer, the number of sequences that the HMM was trained on.
672 This field is only used for logging purposes.
673 \textbf{Optional.}
674
675 \item [\emprog{EFFN <f>}] Effective sequence number; \prog{<f>} is a
676 nonzero positive real, the effective total number of sequences
677 determined by \prog{hmmbuild} during sequence weighting, for combining
678 observed counts with Dirichlet prior information in parameterizing the
679 model. This field is only used for logging purposes.
680 \textbf{Optional.}
681
682 \item [\emprog{CKSUM <d>}] Training alignment checksum; \prog{<d>} is
683 a nonnegative unsigned 32-bit integer. This number is calculated
684 from the training sequence data, and used in conjunction with the
685 alignment map information to verify that a given alignment is indeed
686 the alignment that the map is for. \textbf{Optional.}
687
688 \item [\emprog{STATS <s1> <s2> <f1> <f2>}] Statistical parameters
689 needed for E-value calculations. \prog{<s1>} is the model's
690 alignment mode configuration: currently only \prog{LOCAL} is
691 recognized. \prog{<s2>} is the name of the score distribution:
692 currently \prog{MSV}, \prog{VITERBI}, and \prog{FORWARD} are
693 recognized. \prog{<f1>} and \prog{<f2>} are two real-valued
694 parameters controlling location and slope of each distribution,
695 respectively; $\mu$ and $\lambda$ for Gumbel distributions for MSV
696 and Viterbi scores, and $\tau$ and $\lambda$ for exponential tails
697 for Forward scores. $\lambda$ values must be positive. All three
698 lines or none of them must be present: when all three are present,
699 the model is considered to be calibrated for E-value
700 statistics. \textbf{Optional.}
701
702 \item [\emprog{HMM }] Flags the start of the main model
703 section. Solely for human readability of the tabular model data, the
704 symbol alphabet is shown on the \prog{HMM} line, aligned to the fields
705 of the match and insert symbol emission distributions in the main
706 model below. The next line is also for human readability, providing
707 column headers for the state transition probability fields in the main
708 model section that follows. Though unparsed after the \prog{HMM} tag,
709 the presence of two header lines is \textbf{mandatory:} the parser
710 always skips the line after the \prog{HMM} tag line.
711
712 \item [\emprog{COMPO <f>*K}] The first line in the main model section
713 may be an optional line starting with \emprog{COMPO}: these are the
714 model's overall average match state emission probabilities, which are
715 used as a background residue composition in the ``filter null''
716 model. The $K$ fields on this line are log probabilities for each
717 residue in the appropriate biosequence alphabet's
718 order. \textbf{Optional.}
719
720 \end{sreitems}
721
722 \subsubsection{HMM main model section}
723
724 All the remaining fields are \textbf{mandatory}.
725
726 The first two lines in the main model section are
727 atypical.\footnote{That is, the first two lines after the optional
728 COMPO line. Don't be confused by the presence of an optional COMPO
729 line here. The COMPO line is placed in the model section, below the
730 residue column headers, because it's an array of numbers much like
731 residue scores, but it's not really part of the model.} They
732 contain information for the core model's BEGIN node. This is stored as
733 model node 0, and match state 0 is treated as the BEGIN state. The
734 begin state is mute, so there are no match emission probabilities. The
735 first line is the insert 0 emissions. The second line contains the
736 transitions from the begin state and insert state 0. These seven
737 numbers are: $B \rightarrow M_1$, $B \rightarrow I_0$, $B \rightarrow
738 D_1$; $I_0 \rightarrow M_1$, $I_0 \rightarrow I_0$; then a 0.0 and a
739 '*', because by convention, nonexistent transitions from the
740 nonexistent delete state 0 are set to $\log 1 = 0$ and $\log 0 =
741 -\infty = $ `*'.
742
743 The remainder of the model has three lines per node, for $M$ nodes
744 (where $M$ is the number of match states, as given by the \prog{LENG}
745 line). These three lines are ($K$ is the alphabet size in residues):
746
747 \begin{sreitems}{\textbf{State transition line}}
748
749 \item [\textbf{Match emission line}] The first field is the node
750 number ($1 \ldots M$). The parser verifies this number as a
751 consistency check (it expects the nodes to come in order). The next
752 $K$ numbers for match emissions, one per symbol, in alphabetic order.
753
754 The next field is the \prog{MAP} annotation for this node. If
755 \prog{MAP} was \prog{yes} in the header, then this is an integer,
756 representing the alignment column index for this match state
757 (1..alen); otherwise, this field is `-'.
758
759 The next field is the \prog{CONS} consensus residue for this node. If
760 \prog{CONS} was \prog{yes} in the header, then this is a single
761 character, representing the consensus residue annotation for this
762 match state; otherwise, this field is `-'.
763
764 The next field is the \prog{RF} annotation for this node. If
765 \prog{RF} was \prog{yes} in the header, then this is a single
766 character, representing the reference annotation for this match state;
767 otherwise, this field is `-'.
768
769 The next field is the \prog{CS} annotation for this node. If
770 \prog{CS} was \prog{yes}, then this is a single character,
771 representing the consensus structure at this match state; otherwise
772 this field is `-'.
773
774 \item [\textbf{Insert emission line}] The $K$ fields on this line are
775 the insert emission scores, one per symbol, in alphabetic order.
776
777 \item [\textbf{State transition line}] The seven fields on this line
778 are the transitions for node $k$, in the order shown by the transition
779 header line: $M_k \rightarrow M_{k+1}, I_{k}, D_{k+1}$; $ I_k
780 \rightarrow M_{k+1}, I_k$; $D_{k} \rightarrow M_{k+1}, D_{k+1}$.
781
782 For transitions from the final node $M$, match state $M+1$ is
783 interpreted as the END state $E$, and there is no delete state $M+1$;
784 therefore the final $M_k \rightarrow D_{k+1}$ and $D_k \rightarrow
785 D_{k+1}$ transitions are always * (zero probability), and the final
786 $D_k \rightarrow M_{k+1}$ transition is always 0.0 (probability 1.0).
787 \end{sreitems}
788
789 Finally, the last line of the format is the ``//'' record separator.
790
791 \subsection{RNA secondary structures: WUSS notation}
792
793 Infernal annotates RNA secondary structures using a linear
794 string representation called ``WUSS notation'' (Washington University
795 Secondary Structure notation).
796
797 The symbology is extended from the common bracket notation for RNA
798 secondary structures, where open- and close-bracket symbols (or
799 parentheses) are used to annotate base pairing partners: for example,
800 \verb+((((...))))+ indicates a four-base stem with a three-base loop.
801 Bracket notation is difficult for humans to interpret, for anything
802 much larger than a simple stem-loop. WUSS notation makes it somewhat
803 easier to interpret the annotation for larger structures.
804
805 The following figure shows an example with the key elements of WUSS
806 notation. At the top left is an example RNA structure. At the top
807 right is the same structure, with different RNA structural elements
808 marked. Below both structure pictures : the WUSS notation string for
809 the structure.
810
811 \begin{center}
812 \includegraphics[scale=0.8]{Figures/rna_elements}
813 \end{center}
814 \begin{center}
815 \begin{BVerbatim}
816 ::((((,<<<___>>>,,,<<-<<____>>-->>,))-))
817 AACGGAACCAACAUGGAUUCAUGCUUCGGCCCUGGUCGCG
818 \end{BVerbatim}
819 \end{center}
820
821 \subsubsection{Full (output) WUSS notation}
822
823 In detail, symbols used by WUSS notation in \emph{output} structure
824 annotation strings are as follows:
825
826 \begin{sreitems}{\textbf{Bulge, interior loops}}
827 \item[\textbf{Base pairs}]
828 Base pairs are annotated by nested matching pairs of symbols
829 \verb+<>+, \verb+()+, \verb+[]+, or \verb+{}+.
830 The different symbols indicate the ``depth'' of the
831 helix in the RNA structure as follows:
832 \verb+<>+ are used for simple terminal stems;
833 \verb+()+ are used for ``internal'' helices enclosing a multifurcation of
834 all terminal stems; \verb+[]+ are used for internal helices
835 enclosing a multifurcation that includes at least one annotated
836 \verb+()+ stem already; and \verb+{}+ are used for all internal
837 helices enclosing deeper multifurcations.
838
839 \item[\textbf{Hairpin loops}]
840 Hairpin loop residues are indicated by underscores, \verb+_+.
841 Simple stem loops stand out as, e.g.\ \verb+<<<<____>>>>+.
842
843 \item[\textbf{Bulge, interior loops}]
844 Bulge and interior loop residues are indicated by dashes, \verb+-+.
845
846 \item[\textbf{Multifurcation loops}]
847 Multifurcation loop residues are indicated by commas, \verb+,+.
848 The mnemonic is ``stem 1, stem2'', e.g.\ \verb+<<<___>>>,,<<<___>>>+.
849
850 \item[\textbf{External residues}]
851 Unstructured single stranded residues completely outside the
852 structure (unenclosed by any base pairs) are annotated by
853 colons, \verb+:+.
854
855 \item[\textbf{Insertions}]
856 Insertions relative to a known structure are indicated by periods,
857 \verb+.+. Regions where local structural alignment was invoked,
858 leaving regions of both target and query sequence unaligned,
859 are indicated by tildes, \verb+~+. These symbols only appear in
860 alignments of a known (query) structure annotation to a target
861 sequence of unknown structure.
862
863 \item[\textbf{Pseudoknots}]
864 WUSS notation allows pseudoknots to be annotated as pairs of
865 upper case/lower case letters: for example,
866 \verb+<<<<_AAAA____>>>>aaaa+ annotates a simple pseudoknot;
867 additional pseudoknotted stems could be annotated by \verb+Bb+,
868 \verb+Cc+, etc. Infernal cannot handle pseudoknots, however;
869 pseudoknot notation never appears in Infernal output; it
870 is accepted in input files, but ignored.
871 \end{sreitems}
872
873 An example of WUSS notation for a complicated structure
874 (\emph{E. coli} RNase P) is shown in Figure~\ref{fig:RNaseP}. An
875 example of WUSS notation for a local Infernal alignment of
876 \emph{B. subtilis} RNase P to \emph{E. coli} RNase P, illustrating the
877 use of local alignment annotation symbols, is in
878 Figure~\ref{fig:bsu-alignment}.
879
880 \begin{figure}[tp]
881 \begin{center}
882 \includegraphics[scale=0.6]{Figures/rnaseP-ecoli}
883 \end{center}
884 \begin{center}
885 {\scriptsize
886 \begin{BVerbatim}
887 {{{{{{{{{{{{{{{{{{,<<<<<<<<<<<<<-<<<<<____>>>>>>>>>->>>>>>>>
888 1 GAAGCUGACCAGACAGUCGCCGCUUCGUCGUCGUCCUCUUCGGGGGAGACGGGCGGAGGG 60
889
890 >,,,,,,,,,,,,,[[[[--------[[[[[<<<<<_____>>>>><<<<____>>>->(
891 61 GAGGAAAGUCCGGGCUCCAUAGGGCAGGGUGCCAGGUAACGCCUGGGGGGGAAACCCACG 120
892
893 (---(((((,,,,,,,,,,,,<<<<<--<<<<<<<<____>>>>>->>>>>>-->>,,,,
894 121 ACCAGUGCAACAGAGAGCAAACCGCCGAUGGCCCGCGCAAGCGGGAUCAGGUAAGGGUGA 180
895
896 ,,,<<<<<<_______>>>>>><<<<<<<<<____>>>->>>>>->,,)))--))))]]]
897 181 AAGGGUGCGGUAAGAGCGCACCGCGCGGCUGGUAACAGUCCGUGGCACGGUAAACUCCAC 240
898
899 ]]]]]],,,<<<<------<<<<<<----<<<<<_____>>>>>>>>>>>----->>>>,
900 241 CCGGAGCAAGGCCAAAUAGGGGUUCAUAAGGUACGGCCCGUACUGAACCCGGGUAGGCUG 300
901
902 ,,,,,<<<<<<<<____>>>>>>>>,,,,,,,,,,}}}}}}}------------------
903 301 CUUGAGCCAGUGAGCGAUUGCUGGCCUAGAUGAAUGACUGUCCACGACAGAACCCGGCUU 360
904
905 -}-}}}}}}}}}}::::
906 361 AUCGGUCAGUUUCACCU 377
907 \end{BVerbatim}
908 }
909 \end{center}
910 \caption{\small \textbf{Example of WUSS notation.} Top: Secondary
911 structure of \emph{E. coli} RNase P, from Jim Brown's RNase P database
912 \citep{Brown99}. Bottom: WUSS notation for the same structure,
913 annotating the \emph{E. coli} RNase P sequence. The P4 and P6
914 pseudoknots are not annotated in this example.}
915 \label{fig:RNaseP}
916 \end{figure}
917
918 \begin{figure}[tp]
919 \begin{center}
920 \includegraphics[scale=0.6]{Figures/rnaseP-bsu-alignment}
921 \end{center}
922 \begin{center}
923 {\scriptsize
924 \begin{BVerbatim}
925 >> M13175.1
926 rank E-value score bias mdl mdl from mdl to seq from seq to acc trunc gc
927 ---- --------- ------ ----- --- -------- -------- ----------- ----------- ---- ----- ----
928 (1) ! 2.2e-20 58.0 0.0 cm 1 367 [] 4 399 + .. 0.77 no 0.49
929
930 v v v vv vvvvv vvvv vv NC
931 {{{{{{{{{{{{{{{{{{,<<<<<<<<<______>>>>>>>>>,,,,,,,,,,,,,[[[[.--------[[[[[~~~~~~<<<<<____>>>>->( CS
932 RNaseP_bact_a 1 cgagccggccgggcggucGCgcccccccuuaaaagggggggcGAGGAAAGUCCGGgCUcC.AcAGGgCAggguG*[15]*cggggGugAccccAgG 104
933 ::CG::CGGG:::UCGC::C:::: U ::::G::GAGGAAAGUCC GCUC AC G GC G:G +++C +
934 M13175.1 4 CUUAACGUUCGGGUAAUCGCUGCAGAUCU---UGAAUCUGUAGAGGAAAGUCCAUGCUCGcACGGUGCU--GAG*[96]*---------UAUCCUU 175
935 **************************974...4579**********************98788777776..555...8...........3444468 PP
936
937 v vv vvvv NC
938 (---(((((,,,,,,,,,,,,<<<<<<<<<<<____>>>>>>>>>-->>,,,,,,~~~~~~,,)))--))))]]]]].]]]],,,<<<<----- CS
939 RNaseP_bact_a 105 GAaAGugCcACAGAAAaaAgACCgCccgccccuuaaggggcggGcAAGGGUGAAA*[43]*uagGcAAaCCCCaccc.GgAGCAAggccAAAUA 234
940 GAAAGU:CCACAG +A A+ :C :::C:: +AA::G::: G:GUG AA GG:AAACC C:C + GAG AA C+AA U
941 M13175.1 176 GAAAGUGCCACAGUGACGAAGUC---UCACUAGAAAUGGUGA-----GAGUGGAA*[ 1]*GCGGUAAACCCCUCGAgCGAGAAACCCAAAUUU 256
942 99*****************8866...4455558888555444.....66999987...6..99********97665577899888765444332 PP
943
944 vvvv NC
945 ~~~~~~>>>>,,,,,,<<<<<<.<<____>>>>>>>>,,,,,,,,,,}}}}}}}---------------........................--- CS
946 RNaseP_bact_a 235 *[39]*ggccGCUuGAGccggc.cgGuAAcggccggCCuAGAugAAUgaccgcccucuuguuaaauuuu........................aAC 338
947 G :::: : C:G AA:G: :::: UAGAU++AUGA:::CC CU + UA + U AAC
948 M13175.1 257 *[32]*----GAG---AGAAGGaCAG-AAUGCUUUCUGUAGAUAGAUGAUUGCCGCCUGAGUACGAGGUgaugagccguuugcaguacgauggAAC 370
949 ...3......222...2222221222.335555566699****************9998888888888899999********************** PP
950
951 v NC
952 -------------}-}}}}}}}}}}:::: CS
953 RNaseP_bact_a 339 AGAAcCCGGCUUAcaggccggcucgucuu 367
954 A AAC GGCUUACAG::CG:: C+
955 M13175.1 371 AAAACAUGGCUUACAGAACGUUAGACCAC 399
956 ***************************** PP
957 \end{BVerbatim}
958 }
959 \end{center}
960 \caption{\small \textbf{Local alignment annotation example.} Top:
961 Secondary structure of \emph{B. subtilis} RNase P, from Jim Brown's
962 RNase P database \citep{Brown99}. Residues in red are those that
963 Infernal aligns to a CM of \emph{E. coli} type RNase P's
964 (the RNase P bacterial type A model built from the Rfam 10.1 RF00010
965 seed alignment using default Infernal 1.1 \prog{cmbuild} and
966 \prog{cmcalibrate}). The local structural alignment is in four pieces;
967 three regions of the structure (96, 1, and 32 nt long) are skipped
968 over (i.e. not aligned to the type A model). One additional stem is
969 treated as a 24 nt insertion. Bottom: the Infernal \prog{cmsearch}
970 output showing the RNase P type A query model, which corresponds
971 closely to the \emph{E. coli} structure, aligned to the
972 \emph{B. subtilis} sequence. The three skipped regions (96, 1, and 32
973 nt long) of the \emph{B. subtilis} structure from the top of the
974 figure are ``local end'' emissions which skip 15, 43, and 39 consensus
975 positions of the type A model, respectively.}
976 \label{fig:bsu-alignment}
977 \end{figure}
978
979 \subsubsection{Shorthand (input) WUSS notation}
980
981 While WUSS notation makes it easier to visually interpret
982 Infernal \emph{output} structural annotation, it would be
983 painful to be required to \emph{input} all structures in full WUSS
984 notation. Therefore when Infernal reads input secondary
985 structure annotation, it uses simpler rules:
986
987 \begin{sreitems}{\textbf{Single stranded residues}}
988 \item [\textbf{Base pairs}]
989 Any matching nested pair of \verb+()+, \verb+()+, \verb+[]+, \verb+{}+
990 symbols indicates a base pair; the exact choice of symbol has no
991 meaning, so long as the left and right partners match up.
992
993 \item [\textbf{Single stranded residues}]
994 All other symbols \verb+_-,:.~+
995 indicate single stranded residues.
996 The choice of symbol has no special meaning.
997 Annotated pseudoknots (nested matched pairs of upper/lower case
998 alphabetic characters) are also interpreted as single
999 stranded residue in Infernal input.
1000 \end{sreitems}
1001
1002 Thus, for instance, \verb+<<<<....>>>>+ and \verb+((((____))))+ and
1003 \verb+<(<(._._)>)>+ all indicate a four base stem with a four base
1004 loop (the last example is legal but weird).
1005
1006 Remember that the key property of canonical (nonpseudoknotted) RNA
1007 secondary structure is that the pairs are \emph{nested}.
1008 \verb+((<<....))>>+ is not a legal annotation string: the pair symbols
1009 don't match up properly. Infernal will reject such an
1010 annotation and report an input format error, suspecting a problem with
1011 your annotation. If you want to annotate pseudoknots, WUSS notation
1012 allows alphabetic symbols Aa, Bb, etc.\, see above; but remember that
1013 Infernal ignores pseudoknotted stems and treats them as
1014 single stranded residues.
1015
1016 Because many other RNA secondary structure analysis programs use a
1017 simple bracket notation for annotating structure,
1018 Infernal's ability to input this format makes it easier to
1019 use data generated by other RNA software packages. Conversely,
1020 converting Infernal output WUSS notation to simple bracket
1021 notation is a matter of a simple Perl or sed script, substituting the
1022 symbols appropriately.
1023
1024 \subsection{Stockholm, the recommended multiple sequence alignment format}
1025
1026 The Rfam and Pfam Consortiums have developed a multiple sequence
1027 alignment format called ``Stockholm format'' that allows rich and
1028 extensible annotation.
1029
1030 Crucially for Infernal, Stockholm alignments support the annotation of
1031 a consensus secondary structure, which is why \prog{cmbuild} requires
1032 its input alignment files to be in Stockholm format. Here is a minimal
1033 Stockholm file with consensus secondary structure annotation in
1034 shorthand WUSS notation (described earlier in this section).
1035
1036 \begin{sreoutput}
1037 # STOCKHOLM 1.0
1038
1039 seq1 ACCGUC...GCAA...GG
1040 seq2 ACCGUC...GCAA...GG
1041 seq3 .CCUUCGUCGGAUGACGA
1042 #=GC SS_cons ...<<<..........>>
1043
1044 seq1 CGAUAC
1045 seq2 CG..AC
1046 seq3 ACAUCC
1047 #=GC SS_cons >.....
1048 //
1049 \end{sreoutput}
1050
1051 The first line in the file must be \verb+# STOCKHOLM 1.x+, where
1052 \verb+x+ is a minor version number for the format specification
1053 (and which currently has no effect on my parsers). This line allows a
1054 parser to instantly identify the file format.
1055
1056 In the alignment, each line contains a name, followed by the aligned
1057 sequence. A dash, period, underscore, or tilde (but not whitespace)
1058 denotes a gap. If the alignment is too long to fit on one line, the
1059 alignment may be split into multiple blocks, with blocks separated by
1060 blank lines, as this example is. The number of sequences, their order,
1061 and their names must be the same in every block. Within a given block,
1062 each (sub)sequence (and any associated \verb+#=GR+ and \verb+#=GC+
1063 markup, such as the \verb+SS_cons+ lines, see below) is of equal
1064 length, called the \textit{block length}. Block lengths may differ
1065 from block to block. The block length must be at least one residue,
1066 and there is no maximum.
1067
1068 Other blank lines are ignored. You can add comments anywhere to the
1069 file (even within a block) on lines starting with a \verb+#+.
1070
1071 The \verb+SS_cons+ line defines the consensus secondary structure in
1072 shorthand WUSS notation, as described earlier in
1073 this section.
1074
1075 All other annotation is added using a tag/value comment style. The
1076 tag/value format is inherently extensible, and readily made
1077 backwards-compatible; unrecognized tags will simply be ignored. Extra
1078 annotation includes individual sequence RNA or protein secondary
1079 structure, sequence weights, a reference coordinate system for the
1080 columns, and database source information including name, accession
1081 number, and coordinates (for subsequences extracted from a longer
1082 source sequence) See below for details.
1083
1084 \subsubsection{syntax of Stockholm markup}
1085
1086 There are four types of Stockholm markup annotation, for per-file,
1087 per-sequence, per-column, and per-residue annotation:
1088
1089 \begin{sreitems}{\emprog{\#=GR <seqname> <tag> <..s..>}}
1090 \item [\emprog{\#=GF <tag> <s>}]
1091 Per-file annotation. \prog{<s>} is a free format text line
1092 of annotation type \prog{<tag>}. For example, \prog{\#=GF DATE
1093 April 1, 2000}. Can occur anywhere in the file, but usually
1094 all the \prog{\#=GF} markups occur in a header.
1095
1096 \item [\emprog{\#=GS <seqname> <tag> <s>}]
1097 Per-sequence annotation. \prog{<s>} is a free format text line
1098 of annotation type \prog{tag} associated with the sequence
1099 named \prog{<seqname>}. For example, \prog{\#=GS seq1
1100 SPECIES\_SOURCE Caenorhabditis elegans}. Can occur anywhere
1101 in the file, but in single-block formats (e.g. the Pfam
1102 distribution) will typically follow on the line after the
1103 sequence itself, and in multi-block formats (e.g. Infernal
1104 output), will typically occur in the header preceding the
1105 alignment but following the \prog{\#=GF} annotation.
1106
1107 \item [\emprog{\#=GC <tag> <..s..>}]
1108 Per-column annotation. \prog{<..s..>} is an aligned text line
1109 of annotation type \prog{<tag>}.
1110 \verb+#=GC+ lines are
1111 associated with a sequence alignment block; \prog{<..s..>}
1112 is aligned to the residues in the alignment block, and has
1113 the same length as the rest of the block.
1114 Typically \verb+#=GC+ lines are placed at the end of each block.
1115
1116 \item [\emprog{\#=GR <seqname> <tag> <..s..>}]
1117 Per-residue annotation. \prog{<..s..>} is an aligned text line
1118 of annotation type \prog{<tag>}, associated with the sequence
1119 named \prog{<seqname>}.
1120 \verb+#=GR+ lines are
1121 associated with one sequence in a sequence alignment block;
1122 \prog{<..s..>}
1123 is aligned to the residues in that sequence, and has
1124 the same length as the rest of the block.
1125 Typically
1126 \verb+#=GR+ lines are placed immediately following the
1127 aligned sequence they annotate.
1128 \end{sreitems}
1129
1130 \subsubsection{semantics of Stockholm markup}
1131
1132 Any Stockholm parser will accept syntactically correct files, but is
1133 not obligated to do anything with the markup lines. It is up to the
1134 application whether it will attempt to interpret the meaning (the
1135 semantics) of the markup in a useful way. At the two extremes are the
1136 Belvu alignment viewer and the Infernal and HMMER
1137 software packages.
1138
1139 Belvu simply reads Stockholm markup and displays it, without trying to
1140 interpret it at all. The tag types (\prog{\#=GF}, etc.) are sufficient
1141 to tell Belvu how to display the markup: whether it is attached to the
1142 whole file, sequences, columns, or residues.
1143
1144 Infernal uses Stockholm markup to pick up a variety of information
1145 from the Rfam multiple alignment database. The Rfam consortium
1146 therefore agrees on additional syntax for certain tag types, so
1147 Infernal can parse some markups for useful information. This
1148 additional syntax is imposed by Rfam, Pfam, Infernal, HMMER, and other
1149 software from our lab, not by Stockholm format per se. You can think
1150 of Stockholm as akin to XML, and what our software reads as akin
1151 to an XML DTD, if you're into that sort of structured data format
1152 lingo.
1153
1154 The Stockholm markup tags that are parsed semantically by Infernal
1155 are as follows:
1156
1157 \subsubsection{recognized \#=GF annotations}
1158 \begin{sreitems}{\emprog{TC <f> <f>}}
1159 \item [\emprog{ID <s>}]
1160 Identifier. \emprog{<s>} is a name for the alignment;
1161 e.g. ``RNaseP''. One word. Unique in file.
1162
1163 \item [\emprog{AC <s>}]
1164 Accession. \emprog{<s>} is a unique accession number for the
1165 alignment; e.g.
1166 ``RF00001''. Used by the Rfam database, for instance.
1167 Often a alphabetical prefix indicating the database
1168 (e.g. ``RF'') followed by a unique numerical accession.
1169 One word. Unique in file.
1170
1171 \item [\emprog{DE <s>}]
1172 Description. \emprog{<s>} is a free format line giving
1173 a description of the alignment; e.g.
1174 ``Ribonuclease P RNA''. One line. Unique in file.
1175
1176 \item [\emprog{AU <s>}]
1177 Author. \emprog{<s>} is a free format line listing the
1178 authors responsible for an alignment; e.g.
1179 ``Bateman A''. One line. Unique in file.
1180
1181 \item [\emprog{GA <f>}]
1182 Gathering threshold. The Infernal bit score cutoff
1183 used in gathering the members of Rfam full alignments.
1184
1185 \item [\emprog{NC <f>}]
1186 Noise cutoff. The Infernal bit score cutoff, set according to
1187 the highest scores seen for nonhomologous sequence hits when
1188 gathering members of Rfam full alignments.
1189
1190 \item [\emprog{TC <f>}]
1191 Trusted cutoff. The Infernal bit score cutoff, set according
1192 to the lowest scores seen for true homologous sequence hits
1193 that were above the GA gathering thresholds, when gathering
1194 members of Rfam full alignments.
1195 \end{sreitems}
1196
1197 \subsubsection{recognized \#=GS annotations}
1198
1199 \begin{sreitems}{\emprog{WT <f>}}
1200 \item [\emprog{WT <f>}]
1201 Weight. \emprog{<f>} is a positive real number giving the
1202 relative weight for a sequence, usually used to compensate
1203 for biased representation by downweighting similar sequences.
1204 Usually the weights average 1.0 (e.g. the weights sum to
1205 the number of sequences in the alignment) but this is not
1206 required. Either every sequence must have a weight annotated,
1207 or none of them can.
1208
1209 \item [\emprog{AC <s>}]
1210 Accession. \emprog{<s>} is a database accession number for
1211 this sequence. (Compare the \prog{\#=GF AC} markup, which gives
1212 an accession for the whole alignment.) One word.
1213
1214 \item [\emprog{DE <s>}]
1215 Description. \emprog{<s>} is one line giving a description for
1216 this sequence. (Compare the \prog{\#=GF DE} markup, which gives
1217 a description for the whole alignment.)
1218 \end{sreitems}
1219
1220
1221 \subsubsection{recognized \#=GC annotations}
1222
1223 \begin{sreitems}{\emprog{SS\_cons}}
1224 \item [\emprog{RF}]
1225 Reference line. Any character is accepted as a markup for a
1226 column. The intent is to allow labeling the columns with some
1227 sort of mark. \prog{cmbuild} uses this annotation to determine
1228 which columns are consensus versus insertion if the
1229 \prog{--hand} option is used; insertion columns are annotated
1230 by a gap symbol, and consensus columns by any non-gap symbol.
1231
1232 \item [\emprog{SS\_cons}]
1233 Secondary structure consensus. When this line is generated by
1234 Infernal, it is generated in full WUSS notation.
1235 When it is read by \prog{cmbuild}, it is interpreted more
1236 loosely, in shorthand (input) WUSS notation: pairs of symbols
1237 \verb+<>+, \verb+()+, \verb+[]+, or \verb+[]+ mark consensus
1238 base pairs, and symbols \verb+:_-,.~+ mark single stranded
1239 columns (see the section on WUSS format above for details).
1240
1241 \end{sreitems}
1242
1243 \subsubsection{recognized \#=GR annotations}
1244 \begin{sreitems}{\emprog{SS}}
1245 \item [\emprog{SS}]
1246 Secondary structure consensus. See \prog{\#=GC SS\_cons}
1247 above.
1248
1249 \item [\emprog{PP}] Posterior probability for an aligned residue. This
1250 represents the probability that this residue is assigned to the CM
1251 state corresponding to this alignment column, as opposed to some
1252 other state. The posterior
1253 probability is encoded as 11 possible characters \verb+0-9*+: $0.0
1254 \leq p < 0.05$ is coded as 0, $0.05 \leq p < 0.15$ is coded as 1,
1255 (... and so on ...), $0.85 \leq p < 0.95$ is coded as 9, and $0.95
1256 \leq p \leq 1.0$ is coded as '*'. Gap characters appear in the PP
1257 line where no residue has been assigned.
1258 \end{sreitems}
1259
1260 \subsection{Sequence files: FASTA format}
1261
1262 FASTA is probably the simplest of formats for unaligned sequences.
1263 FASTA files are easily created in a text editor. Each sequence is
1264 preceded by a line starting with \verb+>+. The first word on this line
1265 is the name of the sequence. The rest of the line is a description of
1266 the sequence (free format). The remaining lines contain the sequence
1267 itself. You can put as many letters on a sequence line as you want.
1268 For example:
1269
1270 \begin{sreoutput}
1271 >seq1 This is the description of my first sequence.
1272 AGTACGTAGTAGCTGCTGCTACGTGCGCTAGCTAGTACGTCA CGACGTAGATGCTAGCTGACTCGATGC
1273 >seq2 This is a description of my second sequence.
1274 CGATCGATCGTACGTCGACTGATCGTAGCTACGTCGTACGTAG CATCGTCAGTTACTGCATGCTCG
1275 CATCAGGCATGCTGCTGACTGATCGTACG
1276 \end{sreoutput}
1277
1278 For better or worse, FASTA is not a documented standard. Minor (and
1279 major) variants are in widespread use in the bioinformatics community,
1280 all of which are called ``FASTA format''. My software attempts to
1281 cater to all of them, and is tolerant of common deviations in FASTA
1282 format. Certainly anything that is accepted by the database formatting
1283 programs in NCBI BLAST or WU-BLAST (e.g. setdb, pressdb, xdformat)
1284 will also be accepted by my software. Blank lines in a FASTA file are
1285 ignored, and so are spaces or other gap symbols (dashes, underscores,
1286 periods) in a sequence. Other non-amino or non-nucleic acid symbols in
1287 the sequence are also silently ignored, mostly because some people
1288 seem to think that ``*'' or ``.'' should be added to protein sequences
1289 to (redundantly) indicate the end of the sequence. The parser will
1290 also accept unlimited line lengths, which allows it to accomodate the
1291 enormous description lines in the NCBI NR databases.
1292
1293 (On the other hand, any FASTA files \emph{generated} by my software
1294 adhere closely to community standards, and should be usable by other
1295 software packages (BLAST, FASTA, etc.) that are more picky about
1296 parsing their input files. That means you can run a sloppy FASTA file
1297 thru the \prog{sreformat} utility program to clean it up.)
1298
1299 Partly because of this tolerance, the software may have a difficult
1300 time dealing with files that are \textit{not} in FASTA format,
1301 especially if you're relying on file format autodetection (the
1302 ``Babelfish''). Some (now mercifully uncommon) file formats are so
1303 similar to FASTA format that they be erroneously called FASTA by the
1304 Babelfish and then quietly and lethally misparsed. An example is the
1305 old NBRF file format. If you're afraid of this, you can use the
1306 \prog{--informat fasta} option to bypass the Babelfish and improve
1307 robustness. However, it is still possible to construct files
1308 perversely similar to FASTA that will still confuse the parser. (The
1309 gist of these caveats applies to all formats, not just FASTA.)
1310
1311 \subsection{Null model file format}
1312
1313 The Infernal source distribution includes an example null model file,
1314 \prog{src/rna.null}. This null model is identical to the hardcoded default
1315 prior used by Infernal, all four RNA nucleotides are equiprobable in
1316 the null, background model.
1317
1318 A null model file must contain exactly four non-comment lines. A
1319 comment line begins with a ``\# ``, that is a \# followed by a single
1320 space. Each of the four non-comment lines must contain a single floating point
1321 number, the four of which sum to 1.0. The first non-comment line is interpreted as
1322 the background probability of an ``A'' residue, the second, third, and
1323 fourth non-comment lines are interpreted as the background
1324 probabilities of a ``C'', ``G'' and ``U'' respectively.
1325
1326 \subsection{Clan input file format for cmscan}
1327
1328 The \ccode{cmscan} program has a \ccode{--clanin <f>} option that
1329 allows the user to supply an input file \ccode{<f>} with information
1330 on clan membership for models in the CM file. This option must be used
1331 in combination with the \ccode{--tblout} and \ccode{--fmt 2}
1332 options. An example clan input file is included with the Infernal
1333 source distribution, \ccode{tutorial/Rfam.12.1.clanin}. This file
1334 specifies the clan membership for the 2474 models in the Rfam 12.1
1335 release, of which 311 models belong to 104 clans. This file should be
1336 used in combination with the Rfam.cm file for Rfam 12.1, available for
1337 download as a gzipped file here:
1338 \url{ftp://ftp.ebi.ac.uk/pub/databases/Rfam/12.1/Rfam.cm.gz}. Note that
1339 many of the Rfam models are not members of a clan; the clan input file does
1340 not need to specify clan membership for all models in the CM file.
1341
1342 A clan input file contains one line per clan. Each line must contain
1343 at least two space-delimited tokens. The first token is the name of
1344 the clan (this name cannot contain spaces). Each token after the first
1345 is the name of a model that is a member of the clan named in the first
1346 token. These tokens must be valid names of models in the file CM file
1347 you are using with \ccode{cmscan}. These tokens cannot be the
1348 accessions of models. Valid model names cannot contain spaces
1349 (enforced by \prog{cmbuild} during model construction). To determine
1350 the names of models in a CM file, use \ccode{cmstat}.
1351
1352 For example, in the file \ccode{tutorial/Rfam.12.1.clanin} the first token
1353 of the first line is ``CL00001'' and tokens two through five are
1354 ``tRNA'', ``cyano\_tmRNA'', ``tRNA-Sec'', ``mt-tmRNA'', indicating
1355 that these four models are members of the CL00001 clan. \ccode{cmscan}
1356 will output the clan name of models in clans in its tabular output
1357 file specified with \ccode{--tblout} when the \ccode{--fmt 2} option
1358 is also used. Furthermore, you can specify
1359 that only overlapping hits between models of the same clan are
1360 annotated (as opposed to all overlapping hits) in the tabular output
1361 file by additionally using the \ccode{--oclan} option. Finally, you
1362 can specify that lower scoring overlaps within clans are not output by
1363 additionally using the \ccode{--oskip} and the \ccode{--oclan}
1364 options.
1365
1366
1367
1368