This is a test version of Biostars. For the public version, visit https://www.biostars.org.
qualimap2 mean mapping quality

I’ve done a contrast experiment to see the difference between the bam with BQSR and the bam without BQSR. I use qualimap to evaluate both bams. This is the confusing part. Using hap.py and the giab na12878 truth vcf, shows the bam with BQSR is better than the one without BQSR, but the mean mapping quality with bqsr is only 5.86. The mean mapping quality without bqsr is 27.47. I calculate use the bam: samtools view aln.bam | \ awk '{sum+=$5} END { print "Mean MAPQ =",sum/NR}': the result is around 56. I wonder what is the algorithm theory of the qualimap used to cauculate the mean mapping quality.

alignment

I have the same question. The sam bam file but different mean MAPQ value.

qualimap2 mean mapping quality: 46.05

samtools view aln.bam | \ awk '{sum+=$5} END { print "Mean MAPQ =",sum/NR}': 54.8837

my code (pysam): 56.31

import pysam
def read_Bam(bam_file):
    bam = pysam.AlignmentFile(bam_file,'rb')
    return bam
def get_bam_MAPQ(bam):
    MAPQ_list=[]
    for read in bam.fetch():
        MAPQ_list.append(read.mapping_quality)
    return MAPQ_list
bam=read_Bam(bam_file)
MAPQ=get_bam_MAPQ(bam)
mean_MAPQ=float(sum(MAQP))/float(len(MAPQ))

0 answers

No answers yet.

Log in to answer this question.