Pysam is a Python package for reading, manipulating, and writing genomics data such as SAM/BAM/CRAM and VCF/BCF files. It's a lightweight wrapper of the HTSlib API, the same one that powers samtools, bcftools, and tabix.
According to the v0.22.1 docs, you can iterate over data in a SAM file using the pileup method, which should return an IteratorColumn PileupColumn. However, it instead returns an Iterator AlignedSegment. This is due to a missing import for the PileupColumn and an incorrect iter call.
According to the v0.22.1 docs, you can iterate over data in a SAM file using the pileup method, which should return an IteratorColumn PileupColumn. However, it instead returns an Iterator AlignedSegment. This is due to a missing import for the PileupColumn and an incorrect iter call.