This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Meaning Of Hits As It Relates To The X0 Tag And Bwa

For the bwa aligner, the X0 tag is used to report the number of 'best hits'. Does ' best hits' mean the number of unique locations to which a read aligns? Or, does it mean the number of ways in which any alignment can be attained?

What I mean is this. Suppose I can get an alignment to position chr1 10000 by a deletion in my read in two different places. Is this counted as two different hits or is it counted as one hit since it only maps to that one position?

bwa alignment

1 answer

As the man page for bwa states, X0 is meant to report the number of best hits ... not just any old hit.

I believe this number is easier to interpret on a single read basis (ie, not for paired end reads or a "read fragment").

I'm not sure what you mean by "the number of unique locations aligned" -- because if there is a unique location, then the value of X0 would always be 1, right?

Anyway, this is the way in which I understand it (and this is only reads mapped with samse):

If two different deletions in your read cause it to align to the same place, I suspect that bwa would not call it as aligning to two different places, ie. the value of X0 would not be incremented. If, however, a single deletion aligns the read uniquely to chr 1000 and separate deletion elsewhere in the read would align it to chr12 1000, assuming these are the best alignments (ie. there is no perfect alignment to somewhere else), then the value of X0 in this case would be 2.

Of course Heng is the best person to answer. He sometimes haunts these forums, so hopefully he will clarify any misunderstanding we may have.

"If two different deletions in your read cause it to align to the same place, I suspect that bwa would not call it as aligning to two different places". Yes, this is what I am asking. Is this situation counted as one or two hits. Thanks for clarifying.

I suspect this would only be counted as one "hit," only because I am having a hard time imagining why somebody would want to count it as two different hits. I actually do not know the answer for certain. You could either (1) read the source to find out; or (2) look for such events across a variety of BAM files you have lying around.

Do you see any reads with X0=2 and an XA tag that says it aligns to the exact same place as the mapped read is?

That is a bug. X0 is supposed to give the number of distinct best alignments.

Is there an actual bug? I mean, does this hypothetical situation currently result in an X0 tag set to 2?

Log in to answer this question.