logo

Bioinformatics for Cancer Genomics 2016

Lab Module 6 - Pre-processing Bams


Often it is important to pre-process the bams to remove some poor quality reads to help increase the sensitivity of variant calling. Samtools provides functionality for this. For instance, you can remove PCR duplicates:

samtools rmdup in.bam out.bam

Or filter out reads that are not primary alignments (i.e align to multiple locations):

samtools filter -F 256 in.bam > out.bam

Or filter out reads that are not mapped:

samtools filter -F 4 in.bam > out.bam

The 4 and 256 flag is a bitwise flag that can be explained from this website.

View on GitHub