Hi all, I have a bam file that has many supplemental alignments within it (the XA tag). These are single-end reads that were mapped with a bwa all/samse pipeline. I'm trying to convert the bam file to a bed file in which each supplemental mapping is also printed out to the bed file as a unique line. So, for example, I have a file with a entry of:
SEQ_20 0 chr1 184669033 0 16M * 0 0 AAAAAAAAAAAAACAT IIIIIIIIIIIIIIII XT:A:R NM:i:0 X0:i:3274 XM:i:0 XO:i:0 XG:i:0 MD:Z:16 XA:Z:chr3,-59868032
I'm using bedtools bamtobed and get this:
chr1 184669032 184669048 SEQ_20 0 +
But, I'm trying to also have it print out the secondary alignment from the XA tag to get something like:
chr1 184669032 184669048 SEQ_20 0 +
chr3 59868032 59868048 SEQ_20 0 1
I can't seem to find a good way of doing this, and I haven't been able to find a program to do it.
Thanks
Thanks for this. I tried it, but it gives the same output as bedtools bamtobed. I'm going to try playing around with it, see if I can get it to work
I think it's because your bam uses the old XA attribute. (not 'SA')
https://samtools.github.io/hts-specs/SAMtags.pdf
I tried manually changing the XA tag to SA, but still didn't work. I'll try to figure something out manually or remap with another program. Thanks for your help