Question: How to get an exact match from the bam alignment file
0
gravatar for xiaoguang
12 months ago by
xiaoguang20
xiaoguang20 wrote:

How to get an exact match from the bam comparison file, it is well known that M in the cigar character is completely consistent or there is mismatch, but how do I get a completely consistent sequence?

bwa samtools bam • 355 views
ADD COMMENTlink modified 11 months ago by yasokannan9320 • written 12 months ago by xiaoguang20
0
gravatar for yasokannan93
11 months ago by
yasokannan9320
yasokannan9320 wrote:

You can use a combination of read length and the cigar character M from the alignment file. For example, if the read length is 100, you can try extracting reads with cigar score of 100M. This would mean the read is completely consistent or it is an exact match.

ADD COMMENTlink written 11 months ago by yasokannan9320
1

That is not true, a M can also be a mismatch as xiaoguang correctly says. M only says that these was neither insertion nor deletion but a single base found at that position. A possible strategy could be no check the MD tag which should contain the position of mismatches. If it is 0 there should not be one, check the SAM documentation and other threads to confirm this https://samtools.github.io/hts-specs/SAMtags.pdf

ADD REPLYlink modified 11 months ago • written 11 months ago by ATpoint36k

Thanks for the clarification. So for the example, we should expect it as MD:Z:100 ?

https://samtools.github.io/hts-specs/SAMtags.pdf says

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.

ADD REPLYlink modified 11 months ago • written 11 months ago by yasokannan9320
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1298 users visited in the last hour