using pysam with FFI to htslib-based c/cpp tools

3 views
Skip to first unread message

blex-max

unread,
Nov 25, 2025, 8:04:45 AMNov 25
to Pysam User group
Hello,

I have a program written in C/C++ using htslib that generates bam1_t objects. I'd like to make a python interface/bindings for that tool, and rather than reinventing the wheel I'm wondering if I would be able to access the generated bam1_t objects via pysam, since that is the library we usually use on the python side. I could manually assemble alignedsegments from the pointer I imagine, or at worst I could write to an in-memory bam file and then read that, but I imagine there must be an more elegant approach to doing so. Could anyone offer guidance? If it's useful I haven't settled on a particular choice of FFI. I usually use SWIG but I imagine for this project I'll opt for something else, maybe ctypes of pybind11

Many thanks,

Alex
Reply all
Reply to author
Forward
0 new messages