Skip to content

Commit 7f4af4b

Browse files
committed
Copy the tag type text from SAM spec to SAMtags (PR #804)
SAM section 1.5 clearly defines the standard SAM tag types along with the expanded codes used in the B byte-array type. This text has been copied into the SAMtags document to remove a rather woolly definition there. The text describing lower-case tags has been removed, because this was already discussed in further detail at the end of the SAMtags document (and is itself somewhat woolly when it comes to half-upper half-lower combinations due to the addition of draft tags). Fixes #798
1 parent 836fb61 commit 7f4af4b

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

SAMtags.tex

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,41 @@
4242

4343
\section{Standard tags}
4444

45+
All optional fields follow the {\tt TAG:TYPE:VALUE} format
46+
where {\tt TAG} is a two-character string that matches {\tt /[A-Za-z][A-Za-z0-9]/}.
47+
In an optional field, {\tt TYPE} is a single case-sensitive letter which
48+
defines the format of {\tt VALUE}:
49+
\begin{center}\small
50+
\begin{tabular}{cll}
51+
\hline
52+
{\bf Type} & {\bf Regexp matching {\tt VALUE}} & {\bf Description} \\
53+
\hline
54+
A & {\tt [!-\char126]} & Printable character \\
55+
i & {\tt [-+]?[0-9]+} & Signed integer\footnotemark\\
56+
f & {\tt [-+]?[0-9]*\char92.?[0-9]+([eE][-+]?[0-9]+)?} & Single-precision floating number \\
57+
Z & {\tt [\,\,\,!-\char126]*} & Printable string, including space\\
58+
H & {\tt ([0-9A-F][0-9A-F])*} & Byte array in the Hex format\footnotemark\\
59+
B & {\tt [cCsSiIf](,[-+]?[0-9]*\char92.?[0-9]+([eE][-+]?[0-9]+)?)*} & Integer or numeric array\\
60+
\hline
61+
\end{tabular}
62+
\addtocounter{footnote}{-1}
63+
\footnotetext{The number of digits in an integer optional field is not
64+
explicitly limited in SAM. However, BAM can represent values in the
65+
range~$[-2^{31},2^{32})$, so in practice this is the realistic range
66+
of values for SAM's `{\tt i}' as well.}
67+
\stepcounter{footnote}
68+
\footnotetext{For example, the six-character Hex string `{\tt 1AE301}' represents the byte array $[{\tt 0x1a},{\tt 0xe3},{\tt 0x1}]$.}
69+
\end{center}
70+
For an integer or numeric array (type `{\tt B}'), the first letter indicates the type of numbers
71+
in the following comma separated array. The letter can be one of `{\tt cCsSiIf}', corresponding to
72+
{\tt int8\_t} (signed 8-bit integer), {\tt uint8\_t} (unsigned 8-bit integer), {\tt int16\_t}, {\tt uint16\_t}, {\tt int32\_t}, {\tt uint32\_t}
73+
and {\tt float}, respectively.\footnotemark\@ During import/export, the element type
74+
may be changed if the new type is also compatible with the array.
75+
\footnotetext{Explicit typing eases format parsing and helps to reduce the file size when SAM is converted to BAM.}
76+
77+
\vspace*{1em}
4578
Predefined standard tags are listed in the following table and described
4679
in greater detail in later subsections.
47-
Optional fields are usually displayed as {\tt TAG:TYPE:VALUE}; the {\it type\/}
48-
may be one of
49-
{\tt A} (character),
50-
{\tt B} (general array),
51-
{\tt f} (real number),
52-
{\tt H} (hexadecimal array),
53-
{\tt i} (integer),
54-
or
55-
{\tt Z} (string).
5680

5781
\begin{center}\small
5882
% This table is sorted alphabetically

0 commit comments

Comments
 (0)