Question: BWA: Read flagged as unmapped, but mate says mate is mapped.
gravatar for i.sudbery
10 months ago by
Sheffield, UK
i.sudbery5.2k wrote:

I have mapped a paired end file against a list of elements I'd like to filter out of my reads using BWA, and then tried to extract the unmapped reads using samtools view -f12 my_bam.bam | samtools fastq -1 reads1.fastq -2 reads2.fastq

However I'm getting different numbers of reads in the two files. Looking at what was present in one, but not the other, I come accross this pair:

ST-E00192:703:HMV2VCCXY:4:2208:20202:1362 77 ENSG00000207113|ENST00000384385 114 37 9M1I8M = 114 0 TTTTAAAAGATGGGGTCT AAFFFJJJJJJJJJJAJJ XT:A:U NM:i:2 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:1XO:i:1 XG:i:1 MD:Z:13C3
ST-E00192:703:HMV2VCCXY:4:2208:20202:1362 133 ENSG00000207113|ENST00000384385 114 0 * = 114 0 NGACCCCATCTTTTAAAA #A<AAA<J7FJFJJAJJJ

The flag for the first read (77) is read_paired, read_unmapped, mate_unmapped, first_in_pair.

The flag for the second read is read_paired, read_unmapped, second_in_pair.

Note that "mate_unmapped" is missing for the second read, dispite the fact is has no mate information, while the first read says it is unmapped, despite have a location, only 2 mismatches and not mapping anywhere else.

Any ideas?

bwa • 435 views
ADD COMMENTlink modified 10 months ago by t.kuilman750 • written 10 months ago by i.sudbery5.2k
gravatar for swbarnes2
10 months ago by
United States
swbarnes26.2k wrote:

Bwa will count a read as 'unmapped' if it hangs off of one reference sequence onto another. Check to see if that's what's happening.

ADD COMMENTlink written 10 months ago by swbarnes26.2k

So this is what is happening, the first read extends off the end of a contig. But how come the flags for the second read says that the first read is mapped?

ADD REPLYlink written 10 months ago by i.sudbery5.2k

Well, it pretty much is mapped. It has a mapping location, after all.

ADD REPLYlink written 10 months ago by swbarnes26.2k

But I would expect the flags on the two reads to match. In anycase, any ideas how I extract unmapped pairs of reads from the BAM file?

ADD REPLYlink written 10 months ago by i.sudbery5.2k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 562 users visited in the last hour