Multimapped and unique mapped for BAM file of RRBS data
1
0
Entering edit mode
12 weeks ago
sata72 • 0

Hi all,

I have a BAM files from RRBS data, and, I want to have number of all reads, number of multimapped and number of unique mapped. I think it can be done with samtools, and, with this we can have all reads.

Thanks in advance.

 samtools view -c sample.bam
Multimapped BAM RRBS • 293 views
ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode

The exact definition of what is "unique" depends on the aligner. Typically, one sets a MAPQ threshold, for example 20, and everything below is ignored during analysis because mapping quality is too low. You could simply count reads with MAPQ > 20 (samtools view -q 20) and compare to all reads.

ADD REPLY
0
Entering edit mode
12 weeks ago

This command is not enough to do all you want. As far as I know 0x100 is that reads that are marked as multimapped. So the following commands will give you everything you need: All reads :

samtools view -c input.bam

Multimapped:

samtools view -F 0x4 -f 0x100 input.bam | wc -l

unique map reads;

bedtools bamtobed -i input.bam > output.bed
sort -k 4,4 output.bed | uniq -f 3 -u | wc -l

Then you can merge all the information into one.

ADD COMMENT

Login before adding your answer.

Traffic: 1532 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