consisting of a header section, which is optional but strongly encouraged to include, and an
alignment section. The header lines start with “@,” while alignment lines do not.
Each alignment line has 11 mandatory fields for essential alignment information such as
mapping position, and also has variable number of optional fields for flexible or aligner
specific information [3] (Fig. 7.3, Table 7.2).
In the alignment section of a SAM file, CIGAR (Concise Idiosyncratic Gapped Alignment Report) is one of the 11 mandatory fields of each alignment line. The CIGAR string is
a sequence of base lengths and associated operations. CIGAR string is used to indicate
whether there is a match or mismatch between the bases of read and the reference sequence.
It is quite useful for detecting insertions or deletions (Indels). The CIGAR string is read
based and there are two different versions. In the following example POS5 indicates the
starting position of read alignment to the reference.
Example:
RefPos:
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15 16 17
Reference: C C A T A C T
G A A C T G A C T A
Read:
A C T A G A A
T G G C T
POS: 5: Indicating the starting position of read alignment on the reference.
Version 1
The CIGAR string of this version does not distinguish between a match and a mismatch
(see Position 14 in the example above). Consequently, to calculate the number of errors for
an alignment, the CIGAR string and the MD-TAG (Optional field) are mandatory.
Note: A MD-TAG String encodes mismatched and deleted bases and is reference-based.
The MD-TAG string MD : Z: 7^C5 means from the leftmost reference base in the
Fig. 7.3 SAM format specification of a 50 bp single-end sequencing approach
84
M. Kappelmann-Fenzl
alignment section. The header lines start with “@,” while alignment lines do not.
Each alignment line has 11 mandatory fields for essential alignment information such as
mapping position, and also has variable number of optional fields for flexible or aligner
specific information [3] (Fig. 7.3, Table 7.2).
In the alignment section of a SAM file, CIGAR (Concise Idiosyncratic Gapped Alignment Report) is one of the 11 mandatory fields of each alignment line. The CIGAR string is
a sequence of base lengths and associated operations. CIGAR string is used to indicate
whether there is a match or mismatch between the bases of read and the reference sequence.
It is quite useful for detecting insertions or deletions (Indels). The CIGAR string is read
based and there are two different versions. In the following example POS5 indicates the
starting position of read alignment to the reference.
Example:
RefPos:
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15 16 17
Reference: C C A T A C T
G A A C T G A C T A
Read:
A C T A G A A
T G G C T
POS: 5: Indicating the starting position of read alignment on the reference.
Version 1
The CIGAR string of this version does not distinguish between a match and a mismatch
(see Position 14 in the example above). Consequently, to calculate the number of errors for
an alignment, the CIGAR string and the MD-TAG (Optional field) are mandatory.
Note: A MD-TAG String encodes mismatched and deleted bases and is reference-based.
The MD-TAG string MD : Z: 7^C5 means from the leftmost reference base in the
Fig. 7.3 SAM format specification of a 50 bp single-end sequencing approach
84
M. Kappelmann-Fenzl
