Debian Codegraph @

easel/documentation/format_a2m.tex

raw
1 Easel and Easel-based tools like HMMER and Infernal are capable of
2 writing alignments in UC Santa Cruz ``A2M'' (alignment to model)
3 format, the native input format for the UCSC SAM profile HMM software
4 package.
5
6 To select A2M format, use the format code \ccode{a2m}: for example,
7 to reformat a Stockholm alignment to A2M:
8
9 \user{esl-reformat a2m myali.sto}.
10
11 Easel currently does not read A2M format, and it currently only writes
12 in what UCSC calls ``dotless'' A2M format.
13
14 The most official documentation for A2M format appears to be at
15 \url{http://compbio.soe.ucsc.edu/a2m-desc.html}. You may refer to that
16 document if anything in the brief description below is unclear.
17
18 \subsubsection{An example A2M file}
19
20 This alignment:
21
22 \begin{cchunk}
23 seq1 ACDEF...GHIKLMNPQTVWY
24 seq2 ACDEF...GHIKLMNPQTVWY
25 seq3 ---EFmnrGHIKLMNPQT---
26 \end{cchunk}
27
28 \noindent
29 is encoded in A2M format as:
30
31 \begin{cchunk}
32 >seq1 Sequence 1 description
33 ACDEFGHIKLMNPQTVWY
34 >seq2 Sequence 2 description
35 ACDEFGHIKLMNPQTVWY
36 >seq3 Sequence 3 description
37 ---EFmnrGHIKLMNPQT---
38 \end{cchunk}
39
40 A2M format looks a lot like aligned FASTA format. A crucial difference
41 is that the aligned sequences in a ``dotless'' A2M file do not
42 necessarily all have the same number of characters. The format
43 distinguishes between ``consensus columns'' (where residues are in
44 upper case and gaps are a dash, `-') and ``insert columns'' (where
45 residues are in lower case and gaps are dots, `.', that aren't
46 explicitly shown in the format -- hence ``dotless'' A2M). The position
47 and number of gaps in insert columns (dots) is implicit in this
48 representation. An advantage of this format is its compactness.
49
50 This representation only works if all insertions relative to consensus
51 are considered to be unaligned characters. That is how insertions are
52 handled by profile HMM implementations like SAM and HMMER, and profile
53 SCFG implementations like Infernal.
54
55 Thus every sequence must have the same number of consensus columns
56 (upper case letters plus `-' characters), and may have additional lower
57 case letters for insertions.
58
59 \subsection{Legal characters}
60
61 A2M (and SAM) do not support some special characters such as the `*'
62 (not-a-residue) or `\verb+~+' (missing data) characters. Easel outputs these
63 characters as gaps: either `-' in a consensus column, or nothing in an
64 insert column.
65
66 The SAM software parses only a subset of legal ambiguity codes for
67 amino acids and nucleotides. For amino acids, it only reads \{BXZ\} in
68 addition to the 20 standard one-letter codes. For nucleotides, it only
69 reads \{NRY\} in addition to \{ACGTU\}. With one crucial exception, it
70 treats all other letters as X or N.
71
72 The crucial exception is `O'. SAM reads an `O' as the position of a
73 ``free insertion module'' (FIM), a concept specific to SAM-style
74 profile HMMs. This has no impact on nucleic acid sequences, where `O'
75 is not a legal character. But in amino acid sequences, `O' means
76 pyrrolysine, one of the unusual genetically-encoded amino acids. This
77 means that A2M format alignments must not contain pyrrolysine
78 residues, lest they be read as FIMs. For this reason, Easel converts
79 `O' residues to `X' when it writes an amino acid alignment in A2M
80 format.
81
82 \subsection{Determining consensus columns}
83
84 Writing A2M format requires knowing which alignment columns are
85 supposed to be considered consensus and which are considered
86 inserts. If the alignment was produced by HMMER or Infernal, then the
87 alignment has so-called ``reference annotation'' (what appears as a
88 \verb+#=GC RF+ line in Stockholm format) marking the consensus
89 columns.
90
91 Often, an alignment has no reference annotation; for example, if it
92 has been read from an alignment format that has no reference
93 annotation line (only Stockholm and SELEX formats support reference
94 annotation). In this case, Easel internally generates a ``reasonable''
95 guess at consensus columns, using essentially the same procedure that
96 HMMER's \prog{hmmbuild} program uses by default: sequence fragments
97 (sequences $<$50\% of the mean sequence length in the alignment
98 overall) are ignored, and for the remaining sequences, any column
99 containing $\geq$ 50\% residues is considered to be a consensus
100 column.
101
102
103
104
105
106
107
108
109
110