BWA alignment score calculation
I'm trying to understand how the alignment score (AS) is calculated by BWA MEM. I'm running BWA MEM (0.7.17-r1188) on single ended reads with default parameters. The command line interface detail how the score is calculated. It indicates a match is 1, a mismatch is -4, a gap opening is -6, and a gap extension is -1. However, this doesn't seem to be the case. Below are two mappings which both have 150 matches (CIGAR = 150M) and 1 mismatch (NM:i:1), but the first mappings has an AS of 149 and the second a AS of 145.
Anyone have any insight into why this might be the case?
Q1 16 Ref1 5022 4 150M * 0 0 NM:i:1 MD:Z:0G149 AS:i:149 XS:i:145
Q1 256 Ref1 2599 0 150M 0 0 * NM:i:1 MD:Z:56A93 AS:i:145
• 12 views