This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Why the file unmapped.bam, from tophat has all reads with mapq =/> 30?

Used the samstat tool (http://samstat.sourceforge.net/) for seeing the mapq scores of my alignment;

First, I used with the accepted_hits.bam, and found some reads classified as unmapped. And, I thought strange. Shouldn't the accepted hits contain only mapped reads?

Second, When I use the samstat against unmapped reads.bam, all reads are 30 + mapq scored.

Can someone explain this to me?

samstat tophat mapq

Can you post the output of

samtools view unmapped.bam | cut -f5 | sort | uniq -c
[tiagocastro@tucunare test]$ samtools view unmapped.bam | cut -f5 | sort | uniq -c
756288 255

I found strange that my accepted_hits has unmapped reads. Also, The unmapped.bam has 30+ mapq.

image: screenshot

1 answer

As the following command gave you 756288 255, this indicates all the reads in unmapped.bam have mapping quality of 255, which indicates that the mapping quality could not be assigned to them, hence they are all can be considered as unmapped. If you run the same command on accepted_hits.bam, you should see MAPQ of 0,1,3,50.

samtools view unmapped.bam | cut -f5 | sort | uniq -c

You can also run the following command and see if all the reads have reference name as *. This also indicates the reads mapped to no chromosomes.

samtools view unmapped.bam | cut -f3 | sort | uniq -c

No need to sort in the second command.

Can you tell me how can be possible that, all MAPQ in all bases of all reads be the same? like this plot on the samstat are saying?

Saw here that "The counts and proportions should be almost invariant across read positions"

More one thing, shouldn't the accepted_hits.bam have 0 unmapped reads? Must have something wrong with my alignment. as you can see here:

There are 0.5% unmapped reads on the accepted_hits.bam: http://s28.postimg.org/wunusnl71/Untitled.png)

It should have 0 unmapped reads. If you run the command mentioned:

samtools view accepted_hits.bam | cut -f5 | sort | uniq -c

you should not see any reads with MAPQ 255. I never used any software for these calculations. I use only samtools with various flags.

MAPQ is not for all bases. its for read. All unmapped reads in tophat output will have MAPQ of 255, which indicates that the MAPQ can not be calculated for them.

Log in to answer this question.