Is it possible to discard alignment with mismatches from a bam file ? and to specify the maximum allowed mismatches ?
Mismatch allowances should really have been done during the mapping step. I would recommend you to remap the reads.
If you can't remap it, you can parse your file to remove alignments by looking at a couple of things. This can all be found in the SAM file specifications (http://samtools.sourceforge.net/SAM1.pdf):
-If your mapper outputs the optional MD tag in one of the last fields, that will tell you the positions of the mismatches
-The CIGAR string could potentially tell you the number of mismatches, however not all mappers fully use the CIGAR characters.
Also make sure the alignment entry is mapped in the first place by checking if the 0x4 bit of the flag is not set.
Yes, I think I will remap my reads. I wondered just if a tool that parse a bam file to discard mismatched reads existed
Login before adding your answer.
Use of this site constitutes acceptance of our User Agreement and Privacy