Hello, I am trying to get the check the positions of the mapped reads which are detected as a mismatch by the Bowtie2 aligner. I can separate the reads based on mismatch numbers but could not find any resource on how to find out their positions in the read.
1 answer
The MD tag will have that information in a simple format:
See here:
https://github.com/vsbuffalo/devnotes/wiki/The-MD-Tag-in-BAM-Files
relevant excerpt:
Thus, this information is carried in the MD tag. A SNP looks like:
10A3T0T10Here, there are three SNPs:
11 bases in from the aligned portion of the read, the reference has an A and the read has what ever base is at the 10th > position (excluding softclips).
15 bases in there's a T in the reference.
16 bases in there's a T in the reference. Note that 0s are use used to indicate positions of neighboring SNPs.
note how the MD above tells you what mismatches related to the reference, you'll still need to parse out your read to find what your SNP actually.
Log in to answer this question.
You should be able to parse the CIGAR string included in the alignment.
Thanks.