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.
DEF is deprecated in Cython 3, so we revisit the SEEK_* definitions in libchtslib.pyx. In fact pysam should not be defining these at all:
low-level functions directly from HTSlib (such as bgzf_seek()) take the OS's SEEK_SET/etc as defined in libc.stdio / posix.unistd / etc
pysam's exported Python functionality should really take a parameter value that is available to Python programs, namely io.SEEK_SET etc
Hence remove the DEFs and clarify which functions use libc.SEEK* and which use io.SEEK*. Convert between the two where necessary.
While we're here, add an optional whence parameter to HTSFile.seek(). Note that some of the underlying APIs may not accept any value other than SEEK_SET. Fixes #1185.
Also fix buglet in HFile.close(): hclose() reports any error encountered in errno, as there's no longer an hFILE to call herrno() on (moreover here self.fp is already NULL).
DEF
is deprecated in Cython 3, so we revisit theSEEK_*
definitions in libchtslib.pyx. In fact pysam should not be defining these at all:low-level functions directly from HTSlib (such as bgzf_seek()) take the OS's SEEK_SET/etc as defined in libc.stdio / posix.unistd / etc
pysam's exported Python functionality should really take a parameter value that is available to Python programs, namely io.SEEK_SET etc
Hence remove the DEFs and clarify which functions use libc.SEEK* and which use io.SEEK*. Convert between the two where necessary.
While we're here, add an optional
whence
parameter to HTSFile.seek(). Note that some of the underlying APIs may not accept any value other than SEEK_SET. Fixes #1185.Also fix buglet in HFile.close(): hclose() reports any error encountered in errno, as there's no longer an hFILE to call herrno() on (moreover here self.fp is already NULL).