Debian Codegraph @

easel/documentation/format_stockholm.tex

raw
1
2 Stockholm format was developed by the Pfam Consortium to support
3 extensible markup and annotation of multiple sequence alignments.
4
5 Why yet another alignment file format? Most importantly, the existing
6 formats of popular multiple alignment software (e.g. CLUSTAL, GCG MSF,
7 PHYLIP) do not support rich documentation and markup of the
8 alignment. And since there is not yet a standard accepted format for
9 multiple sequence alignment files, we don't feel too guilty about
10 inventing a new one.
11
12 \subsection{A minimal Stockholm file}
13 \begin{cchunk}
14 # STOCKHOLM 1.0
15
16 seq1 ACDEF...GHIKL
17 seq2 ACDEF...GHIKL
18 seq3 ...EFMNRGHIKL
19
20 seq1 MNPQTVWY
21 seq2 MNPQTVWY
22 seq3 MNPQT...
23 //
24 \end{cchunk}
25
26 The first line in the file must be \ccode{\# STOCKHOLM x.y}, where
27 \ccode{x.y} is a major/minor version number for the format
28 specification. This line allows a parser to instantly identify the
29 file format. There is currently only one version of Stockholm format,
30 \ccode{1.0}.
31
32 In the alignment, each line contains a name followed by the aligned
33 sequence. Neither the name nor the aligned sequence may contain
34 whitespace characters. Stockholm does not enforce any other character
35 conventions on the name or the aligned sequence. Typically, gaps
36 (indels) are indicated in an aligned sequence by a dash or period, but
37 Stockholm format does not require this.
38
39 If the alignment is too long to fit on one line, the alignment may be
40 split into multiple blocks, with blocks separated by blank lines. The
41 number of sequences, their order, and their names must be the same in
42 every block. Within a given block, each (sub)sequence (and any
43 associated \ccode{\#=GR} and \ccode{\#=GC} markup, see below) is of
44 equal length, called the \emph{block length}. Block lengths may differ
45 from block to block; the block length must be at least one residue,
46 and there is no maximum.
47
48 Any line starting with a \ccode{\#} is considered to be a comment, and
49 is ignored.
50
51 Other blank lines in the file are ignored.
52
53 All other annotation is added using a tag/value comment style. The
54 tag/value format is inherently extensible, and readily made
55 backwards-compatible; unrecognized tags will simply be ignored. Extra
56 annotation includes consensus and individual RNA or protein secondary
57 structure, sequence weights, a reference coordinate system for the
58 columns, and database source information including name, accession
59 number, and coordinates (for subsequences extracted from a longer
60 source sequence) See below for details.
61
62 It is usually easy to convert other alignment formats into a least
63 common denominator Stockholm format. For instance, SELEX, GCG's MSF
64 format, and the output of the CLUSTALW multiple alignment program are
65 all closely related interleaved formats.
66
67
68
69 \subsection{Syntax of Stockholm markup}
70
71 There are four types of Stockholm markup annotation, for per-file,
72 per-sequence, per-column, and per-residue annotation:
73
74 \begin{sreitems}{\emcode{\#=GR <seqname> <tag> <.....s.....>}}
75 \item [\emcode{\#=GF <tag> <s>}]
76 Per-file annotation. \ccode{<s>} is a free format text line
77 of annotation type \ccode{<tag>}. For example, \ccode{\#=GF DATE
78 April 1, 2000}. Can occur anywhere in the file, but usually
79 all the \ccode{\#=GF} markups occur in a header.
80
81 \item [\emcode{\#=GS <seqname> <tag> <s>}]
82 Per-sequence annotation. \ccode{<s>} is a free format text line
83 of annotation type \ccode{<tag>} associated with the sequence
84 named \ccode{<seqname>}. For example, \ccode{\#=GS seq1
85 SPECIES\_SOURCE Caenorhabditis elegans}. Can occur anywhere
86 in the file, but in single-block formats (e.g. the Pfam
87 distribution) will typically follow on the line after the
88 sequence itself, and in multi-block formats (e.g. HMMER
89 output), will typically occur in the header preceding the
90 alignment but following the \ccode{\#=GF} annotation.
91
92 \item [\emcode{\#=GC <tag> <..s..>}]
93 Per-column annotation. \ccode{<..s..>} is an aligned text line
94 of annotation type \ccode{<tag>}.
95 \ccode{\#=GC} lines are
96 associated with a sequence alignment block; \ccode{<..s..>}
97 is aligned to the residues in the alignment block, and has
98 the same length as the rest of the block.
99 Typically \ccode{\#=GC} lines are placed at the end of each block.
100
101 \item [\emcode{\#=GR <seqname> <tag> <..s..>}]
102 Per-residue annotation. \ccode{<..s..>} is an aligned text line
103 of annotation type \ccode{<tag>}, associated with the sequence
104 named \ccode{<seqname>}.
105 \ccode{\#=GR} lines are
106 associated with one sequence in a sequence alignment block;
107 \ccode{<..s..>}
108 is aligned to the residues in that sequence, and has
109 the same length as the rest of the block.
110 Typically
111 \ccode{\#=GR} lines are placed immediately following the
112 aligned sequence they annotate.
113 \end{sreitems}
114
115 \subsection{Semantics of Stockholm markup}
116
117 Any Stockholm parser will accept syntactically correct files, but is
118 not obligated to do anything with the markup lines. It is up to the
119 application whether it will attempt to interpret the meaning (the
120 semantics) of the markup in a useful way. At the two extremes are the
121 Belvu alignment viewer and the HMMER profile hidden Markov model
122 software package.
123
124 Belvu simply reads Stockholm markup and displays it, without trying to
125 interpret it at all. The tag types (\ccode{\#=GF}, etc.) are sufficient
126 to tell Belvu how to display the markup: whether it is attached to the
127 whole file, sequences, columns, or residues.
128
129 HMMER uses Stockholm markup to pick up a variety of information from
130 the Pfam multiple alignment database. The Pfam consortium therefore
131 agrees on additional syntax for certain tag types, so HMMER can parse
132 some markups for useful information. This additional syntax is imposed
133 by Pfam, HMMER, and other software of mine, not by Stockholm format
134 per se. You can think of Stockholm as akin to XML, and what my
135 software reads as akin to an XML DTD, if you're into that sort of
136 structured data format lingo.
137
138 The Stockholm markup tags that are parsed semantically by my software
139 are as follows:
140
141 \subsubsection{Recognized \#=GF annotations}
142 \begin{sreitems}{\emcode{TC <f> <f>}}
143 \item [\emcode{ID <s>}]
144 Identifier. \ccode{<s>} is a name for the alignment;
145 e.g. ``rrm''. One word. Unique in file.
146
147 \item [\emcode{AC <s>}]
148 Accession. \ccode{<s>} is a unique accession number for the
149 alignment; e.g.
150 ``PF00001''. Used by the Pfam database, for instance.
151 Often a alphabetical prefix indicating the database
152 (e.g. ``PF'') followed by a unique numerical accession.
153 One word. Unique in file.
154
155 \item [\emcode{DE <s>}]
156 Description. \ccode{<s>} is a free format line giving
157 a description of the alignment; e.g.
158 ``RNA recognition motif proteins''. One line. Unique in file.
159
160 \item [\emcode{AU <s>}]
161 Author. \emcode{<s>} is a free format line listing the
162 authors responsible for an alignment; e.g.
163 ``Bateman A''. One line. Unique in file.
164
165 \item [\emcode{GA <f> <f>}]
166 Gathering thresholds. Two real numbers giving HMMER bit score
167 per-sequence and per-domain cutoffs used in gathering the
168 members of Pfam full alignments. See Pfam and HMMER
169 documentation for more detail.
170
171 \item [\emcode{NC <f> <f>}]
172 Noise cutoffs. Two real numbers giving HMMER bit score
173 per-sequence and per-domain cutoffs, set according to the
174 highest scores seen for unrelated sequences when gathering
175 members of Pfam full alignments. See Pfam and HMMER
176 documentation for more detail.
177
178 \item [\emcode{TC <f> <f>}]
179 Trusted cutoffs. Two real numbers giving HMMER bit score
180 per-sequence and per-domain cutoffs, set according to the
181 lowest scores seen for true homologous sequences that
182 were above the GA gathering thresholds, when gathering
183 members of Pfam full alignments. See Pfam and HMMER
184 documentation for more detail.
185 \end{sreitems}
186
187 \subsection{Recognized \#=GS annotations}
188
189 \begin{sreitems}{\emcode{WT <f>}}
190 \item [\emcode{WT <f>}]
191 Weight. \ccode{<f>} is a nonnegative real number giving the
192 relative weight for a sequence, usually used to compensate
193 for biased representation by downweighting similar sequences.
194 Usually the weights average 1.0 (e.g. the weights sum to
195 the number of sequences in the alignment) but this is not
196 required. Either every sequence must have a weight annotated,
197 or none of them can.
198
199 \item [\emcode{AC <s>}]
200 Accession. \ccode{<s>} is a database accession number for
201 this sequence. (Contrast to \ccode{\#=GF AC} markup, which gives
202 an accession for the whole alignment.) One word.
203
204 \item [\emcode{DE <s>}]
205 Description. \ccode{<s>} is one line giving a description for
206 this sequence. (Contrast to \ccode{\#=GF DE} markup, which gives
207 a description for the whole alignment.)
208 \end{sreitems}
209
210
211 \subsection{Recognized \#=GC annotations}
212
213 \begin{sreitems}{\emcode{SA\_cons}}
214 \item [\emcode{RF}]
215 Reference line. Any character is accepted as a markup for a
216 column. The intent is to allow labeling the columns with some
217 sort of mark.
218
219 \item [\emcode{SS\_cons}]
220 Secondary structure consensus. For protein
221 alignments, DSSP codes or gaps are accepted as markup:
222 \ccode{[HGIEBTSCX.-\_]}, where H is alpha helix, G is
223 3/10-helix, I is p-helix, E is extended strand, B is a residue
224 in an isolated b-bridge, T is a turn, S is a bend, C is a
225 random coil or loop, and X is unknown (for instance, a residue
226 that was not resolved in a crystal structure). For RNA
227 alignments, the annotation is in WUSS format. Minimally, the
228 symbols \ccode{<} and \ccode{>} indicate a base pair,
229 \ccode{.} indicate single-stranded positions, and RNA
230 pseudoknots are represented by alphabetic characters, with
231 upper case letters representing the 5' side of the helix and
232 lower case letters representing the 3' side. Note that this
233 limits the annotation to a maximum of 26 pseudoknots per
234 sequence.
235
236 \item [\emcode{SA\_cons}]
237 Surface accessibility consensus. 0-9, gap symbols, or X are
238 accepted as markup. 0 means $<$10\% accessible residue surface
239 area, 1 means $<$20\%, 9 means $<$100\%, etc. X means unknown
240 structure.
241 \end{sreitems}
242
243 \subsection{Recognized \#=GR annotations}
244
245 \begin{sreitems}{\emcode{SA}}
246 \item [\emcode{SS}]
247 Secondary structure consensus. See \ccode{\#=GC SS\_cons} above.
248 \item [\emcode{SA}]
249 Surface accessibility consensus. See \ccode{\#=GC SA\_cons} above.
250 \end{sreitems}
251
252