<p>Hi, I have one BAM file which contains all alignments (include those not used in variant calling, such as non-PF, non-mapping and duplicate reads) generated for an assembly. How to filter these useless mapping? I know that Picard MarkDuplicates can be used to remove duplicates.Thank you.</p>

<p>The <a href="https://github.com/pezmaster31/bamtools">bamtools</a> package offers a wide range of filters, including user-definable filters defined in <a href="http://json.org">JSON</a> notation. It includes filters for reads failing vendor QC, unmapped reads and pre-marked duplicates.</p>