I am trying to understand how the MD:Z tag is used. The following is from the SAM Optional Fields Specification, which gives an example but is not thorough.
The MD field aims to achieve SNP/indel calling without looking at the reference. For example, a string ‘10A5^AC6’ means from the leftmost reference base in the alignment, there are 10 matches followed by an A on the reference which is different from the aligned read base; the next 5 reference bases are matches followed by a 2bp deletion from the reference; the deleted sequence is AC; the last 6 bases are matches. The MD field ought to match the CIGAR string.
Suppose I have a read that I want to soft clip at both ends. If the read starts with CIGAR 100M
and MD 50G49
, and I want to change the CIGAR to 7S86M7S
, what should the MD field become?
Is there a more complete explanation of what appears in the MD tag field?