Why does BWA sometimes omit X0 and X1 tags?
1
0
Entering edit mode
4.4 years ago
b10hazard ▴ 30

Hi there,

I'm using BWA Version: 0.7.17 (which I cannot change) and I don't understand why BWA will sometimes not give me X0 and X1 tags and instead it will give me an XA tag. For example, this read lacks an X0 and X1 tag, but I do get an XA tag...

Reference span = chr17:16,068,356-16,068,404 (+) = 49bp
Cigar = 49M
Clipping = None
----------------------
Mate is mapped = yes
Mate start = chr17:16068427 (-)
Insert size = 121
Second in pair
Pair orientation = F2R1
----------------------
XA = chr7,-57669687,49M,3;chr20,-25733270,49M,3;
XG = 0
AM = 29
NM = 4
SM = 29
XM = 4
XO = 0
XT = M

However, sometimes I will get and X0, X1 AND an XA tag. Like with this read...

Reference span = chr17:16,068,394-16,068,442 (-) = 49bp
Cigar = 49M
Clipping = None
----------------------
Mate is mapped = yes
Mate start = chr17:16068300 (+)
Insert size = -142
Second in pair
Pair orientation = F1R2
----------------------
X0 = 2
X1 = 1
XA = chr17,+21544447,49M,2;chr7,+57669649,49M,3;
XG = 0
AM = 0
NM = 2
SM = 0
XM = 2
XO = 0
XT = R

Does anyone know why BWA does this?

bwa burrows-wheeler aligner alignment DNA-seq • 2.3k views
ADD COMMENT
0
Entering edit mode

XA is the old version of the 'SA' tag (supplementary alignments); but what are X0 and X1 ?

ADD REPLY
1
Entering edit mode

X0 and X1 are the number of hits and suboptimal hits respectively.

ADD REPLY
0
Entering edit mode

Could you show the whole bwa command? Are you using bwa mem or other algorithm? I suspect it is bwa aln, as I believe X0 / X1 tags were dropped for bwa mem.

Are you sure the first read lacks the X0 / X1 tags? This output seems a copy / paste from IGV mouse head-over, so there may be a bug there.

ADD REPLY
0
Entering edit mode

Yes, it is bwa-aln. I am forced to use this build/version of BWA. Yes this is a copy/paste from IGV but I am 100% positive reads have no X0 or X1 tag, I have verified this using samtools view and pysam. For example this command

$ samtools view /path/to/bam "chr17:16068386-16068406" | wc -l
998
$ samtools view /path/to/bam "chr17:16068386-16068406" | grep -v X1 | wc -l
67
$ samtools view /path/to/bam "chr17:16068386-16068406" | grep X1 | wc -l
931

Using X0 gives the same result, about 5% of the reads in this region have no X0 or X1 tags.

ADD REPLY
3
Entering edit mode
4.4 years ago
h.mon 35k

By the end of the thread [Bio-bwa-help] Meaning of the XT tag?, there is a short answer from Heng Li that explains why your first read doesn't have X0 and X1 tags:

N if there is at least one ambiguous reference base in the alignment. R if X0 is not 1. X0/X1 is calculated based on single-end alignment. XT:M reads, which are mapped Smith-Waterman, do not have these tags.

However, this answer alone doesn't fully explain what is happening. What I suspect is XT:R reads have multiple paired mapping locations, but XT:M reads have only one paired mapping location, so its "true" mapping location is rescued and X0 / X1 are deemed unnecessary.

ADD COMMENT
0
Entering edit mode

Ooooo! I think you are correct. I grepped for XT:M reads and none of them had X0 or X1 tags! You said that this answer doesn't fully explain what is happening though. Do you mean there might be some other error mode that results in no X0/X1 tags?

ADD REPLY
0
Entering edit mode

Do you mean there might be some other error mode that results in no X0/X1 tags?

No, I mean now the issue is why some reads are tagged as XT:M, and others, as XT:R.

ADD REPLY
0
Entering edit mode

I think I may have stumbled onto another explaination. In this thread Heng says...

> Let say if I have X0:i:<n> and X1:i:<m> then:
> 
> * if <n> = 1 and <m> = 0 => unique read
> * if <n> + <m> >1 => multi hits
> * if there is no X0/X1 tag as well as XA tag => unique read again?

The third case: it is anchored by its mate. Bwa cannot align it as a single-end read. It unable to find alternative hits for this read.

So maybe the X0/X1 tags will be omitted if it cannot find alternative hits. So if there is no X0/X1 tags and there is an XA tag I would probably want to avoid the read.

ADD REPLY

Login before adding your answer.

Traffic: 1767 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6