Drop low-quality alignments: Each alignment is given a quality score (MAPQ) which is equivalent to Phred scores (with respect to determining relative quality of different alignments). You can screen for low-quality alignments when you convert from SAM to BAM
-q INT Skip alignments with MAPQ smaller than INT [0]
files using samtools view.
上面提到了丢弃低质量的比对,那么什么是低质量的比对,我们应该如何去判断那?
在输出的Sam文件中第五列MAPQ(被称为比对质量的一个值)
Sam所明书上对MAPQ的解释是:
MAPQ: MAPping Quality. It equals -10 log10 Pr{mapping position is wrong}, rounded to the nearest integer. A value 255 indicates that the mapping quality is not available.
那么当我们想把Sam文件中第5列小于2的都丢弃,那么应该怎么做
这里samtools为我们提供了一个方法:
samtools view -bSq 2 file.sam > filtered.bam
-q INT Skip alignments with MAPQ smaller than INT [0]