text: user549: As I read the SAM spec, the "X" CIGAR operator represents a mismatch. This seems useful as we can know where are the mismatches without looking at the reference genome. However, many popular aligners such as BWA do not output "X". Why do they omit "X"?
  
  user134: The SAM format originally had only M, I, D, N, S, H, and P CIGAR operators.  See the original SAM specification (if you can view Apple Pages documents) and Table 1 in The Sequence Alignment/Map format and SAMtools (Li et al, 2009).  This was in line with previous tools using CIGAR strings, notably exonerate which introduced them with just the M, I, and D operators.
  BWA-backtrack was written contemporaneously with the SAM format in 2008 and 2009 (and published in May 2009).  Its ChangeLog shows that it was outputting mismatch information in an MD tag from January 2009 and that MD was defined in the SAM specification of the time (and that the tag value's syntax was somewhat in flux in February 2009).  The MD tag is also described in that early v1.0 Pages-formatted SAM specification.
  The = and X CIGAR operators were introduced later in SAM v1.3 as a result of this lengthy samtools-devel mailing list thread.  The characters used for the operators and the initial implementations were essentially in place by November 2009.
  Since then, the =/X operators have not really taken over from M, as you've seen.  There's probably a number of factors contributing to this:
  
  Their later introduction, long after the basic M/I/D operators and MD tag were well-established;
  Conceivably their being specific to SAM and unavailable in other CIGAR flavours;
  The MD tag still provides more information — X doesn't tell you what the mismatched reference bases were.
  
  
original_text: 549: <p>As I read the SAM spec, the "X" CIGAR operator represents a mismatch. This seems useful as we can know where are the mismatches without looking at the reference genome. However, many popular aligners such as BWA do not output "X". Why do they omit "X"?</p>
   134: <p>The SAM format originally had only <strong>M</strong>, <strong>I</strong>, <strong>D</strong>, <strong>N</strong>, <strong>S</strong>, <strong>H</strong>, and <strong>P</strong> CIGAR operators.  See the <a href="https://github.com/samtools/hts-specs/tree/a9b16d4c54d8b2bf900b210b8319474163d7ce2a" rel="nofollow noreferrer">original SAM specification</a> (if you can view Apple Pages documents) and Table 1 in <a href="https://www.ncbi.nlm.nih.gov/pubmed/19505943" rel="nofollow noreferrer"><em>The Sequence Alignment/Map format and SAMtools</em></a> (Li <em>et al</em>, 2009).  This was in line with previous tools using CIGAR strings, notably <a href="http://www.ebi.ac.uk/about/vertebrate-genomics/software/exonerate" rel="nofollow noreferrer"><em>exonerate</em></a> which introduced them with just the <strong>M</strong>, <strong>I</strong>, and <strong>D</strong> operators.</p>
  
  <p>BWA-backtrack was written contemporaneously with the SAM format in 2008 and 2009 (and <a href="https://www.ncbi.nlm.nih.gov/pubmed/19451168" rel="nofollow noreferrer">published in May 2009</a>).  Its <em>ChangeLog</em> shows that it was outputting mismatch information in an <strong>MD</strong> tag from January 2009 and that <strong>MD</strong> was defined in the SAM specification of the time (and that the tag value's syntax was somewhat in flux in February 2009).  The <strong>MD</strong> tag is also described in that early v1.0 Pages-formatted SAM specification.</p>
  
  <p>The <strong>=</strong> and <strong>X</strong> CIGAR operators were introduced later in <a href="https://github.com/samtools/hts-specs/commit/07dc1c67a717a6c5cc9d65eeb8b3c99612744cde" rel="nofollow noreferrer">SAM v1.3</a> as a result of <a href="https://sourceforge.net/p/samtools/mailman/samtools-devel/thread/ee957a250907301016y22c96c5x2907a33c2e719da2%40mail.gmail.com/" rel="nofollow noreferrer">this lengthy samtools-devel mailing list thread</a>.  The characters used for the operators and the initial implementations were essentially in place by November 2009.</p>
  
  <p>Since then, the <strong>=</strong>/<strong>X</strong> operators have not really taken over from <strong>M</strong>, as you've seen.  There's probably a number of factors contributing to this:</p>
  
  <ul>
  <li>Their later introduction, long after the basic <strong>M</strong>/<strong>I</strong>/<strong>D</strong> operators and <strong>MD</strong> tag were well-established;</li>
  <li>Conceivably their being specific to SAM and unavailable in other CIGAR flavours;</li>
  <li>The <strong>MD</strong> tag still provides more information — <strong>X</strong> doesn't tell you what the mismatched reference bases were.</li>
  </ul>
  