Pysam is a python module for reading and manipulating files in the SAM/BAM format. The SAM/BAM format is a way to store efficiently large numbers of alignments (Li 2009), such as those routinely created by next-generation sequencing methods. Pysam is a lightweight wrapper of the samtools_ C-API. Pysam also includes an interface for tabix. Reference: Li et al. Bioinformatics. 2009 Aug 15;25(16):2078-9. doi: 10.1093/bioinformatics/btp352. The Sequence Alignment/Map format and SAMtools.