Skip to content

Instantly share code, notes, and snippets.

@brentp
Created April 24, 2019 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentp/ea00e51b9811f2d01d5535945331fbf7 to your computer and use it in GitHub Desktop.
Save brentp/ea00e51b9811f2d01d5535945331fbf7 to your computer and use it in GitHub Desktop.
how to access pysam internals from external cython project
from pysam.libcalignmentfile cimport AlignmentFile
cdef AlignmentFile samfile = AlignmentFile("../normal.bam", "rb")
print samfile.reference_filename
print samfile.b == NULL
from distutils.core import setup
from distutils.extension import Extension
import Cython
from Cython.Build import cythonize
setup(
cmdclass={'build_ext': Cython.Build.build_ext},
ext_modules = [Extension("ex",
["ex.pyx"],
language='c',
libraries=["z", "hts"],
include_dirs=["/home/brentp/src/pysam/pysam",
"/usr/include"],
)]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment