Hi, I'm using bowtie2 to map my fastq files in order to find SNPs in my data. After mapping my reads, I want to filter them according to the amount of substitutions and indels. I want to count each stretch of deletions or insertions as 1, regardless of it's length. The NM tag represents the edit distance. So for example if I have an 8 bases deletion in my read: NM would be 8 while X0 will be 1. This is why I want to use X0 and XM tags and not NM.
The tag XM contains the amount of substitutions in my read, and X0 contains the amount of gaps (insertions and deletions). I would like to first summarize these two tags and later filter according to the new tag using bamtools filter. How can I summarize two existing tags in a bam file? Thank you. Hadar