Example #1
0
def get_ext_modules():
    ext = ".pyx" if HAVE_CYTHON else ".c"
    src_files = glob.glob(
        os.path.join(os.path.dirname(__file__), "pairtools", "lib", "*" + ext)
    )

    ext_modules = []
    for src_file in src_files:
        name = "pairtools.lib." + os.path.splitext(os.path.basename(src_file))[0]
        if not "pysam" in name and not "regions" in name:
            ext_modules.append(Extension(name, [src_file]))
        elif "regions" in name:
            ext_modules.append(Extension(
                name, [src_file],
                language="c++",
            ))
        else:
            import pysam

            ext_modules.append(
                Extension(
                    name,
                    [src_file],
                    extra_link_args=pysam.get_libraries(),
                    include_dirs=pysam.get_include(),
                    define_macros=pysam.get_defines(),
                )
            )

    if HAVE_CYTHON:
        # .pyx to .c
        ext_modules = cythonize(ext_modules)  # , annotate=True

    return ext_modules
Example #2
0
 ),
 Extension(
     "cgat.NCL.cnestedlist",
     ["cgat/NCL/cnestedlist.pyx", "cgat/NCL/intervaldb.c"],
     library_dirs=[],
     libraries=[],
     language="c",
 ),
 Extension(
     "cgat.GeneModelAnalysis",
     ["cgat/GeneModelAnalysis.pyx"],
     include_dirs=conda_includes + pysam.get_include() +
     [numpy.get_include()],
     library_dirs=[],
     libraries=[],
     define_macros=pysam.get_defines(),
     language="c",
 ),
 Extension(
     "cgat.BamTools.bamtools",
     ["cgat/BamTools/bamtools.pyx"],
     include_dirs=conda_includes + pysam.get_include() +
     [numpy.get_include()],
     library_dirs=pysam_libdirs,
     libraries=pysam_libs,
     define_macros=pysam.get_defines(),
     language="c",
     extra_link_args=extra_link_args_pysam,
 ),
 Extension(
     "cgat.BamTools.geneprofile",
Example #3
0
def pysam_incl(cy_ext):
    import pysam
    cy_ext.extend_includes(pysam.get_include())
    cy_ext.extend_macros(pysam.get_defines())
    cy_ext.extend_extra_objects([pysam.libchtslib.__file__])
Example #4
0
        raise Exception('please upgrade pysam first, e.g.: pip install --upgrade pysam')
    from Cython.Distutils import build_ext # Cython should be installed via pysam
except ImportError:
    raise Exception('please install pysam first, e.g.: pip install --upgrade pysam')


try:
    import numpy as np
except ImportError:
    raise Exception('please install numpy first')


extensions = [Extension('SomVarIUS_calling',
                        sources=['SomVarIUS/SomVarIUS_calling.pyx'],
                        include_dirs=[np.get_include()] + pysam.get_include(),
                        define_macros=pysam.get_defines())]
                        
extensions.append(Extension('query_muts',
                        sources=['SomVarIUS/query_muts.pyx'],
                        include_dirs=[np.get_include()] + pysam.get_include(),
                        define_macros=pysam.get_defines()))


setup(
    name='SomVarIUS',
    version='1.2',
    author='Kyle S. Smith',
    author_email='*****@*****.**',
    license="MIT Licenses",
    url='https://github.com/kylessmith/SomVarIUS',
    description='A Python utility for calling somatic mutations from a BAM or SAM file',
Example #5
0
            'please upgrade pysam first, e.g.: pip install --upgrade pysam')
    from Cython.Distutils import build_ext  # Cython should be installed via pysam
except ImportError:
    raise Exception(
        'please install pysam first, e.g.: pip install --upgrade pysam')

try:
    import numpy as np
except ImportError:
    raise Exception('please install numpy first')

extensions = [
    Extension('SomVarIUS_calling',
              sources=['SomVarIUS/SomVarIUS_calling.pyx'],
              include_dirs=[np.get_include()] + pysam.get_include(),
              define_macros=pysam.get_defines())
]

extensions.append(
    Extension('query_muts',
              sources=['SomVarIUS/query_muts.pyx'],
              include_dirs=[np.get_include()] + pysam.get_include(),
              define_macros=pysam.get_defines()))

setup(
    name='SomVarIUS',
    version='1.2',
    author='Kyle S. Smith',
    author_email='*****@*****.**',
    license="MIT Licenses",
    url='https://github.com/kylessmith/SomVarIUS',
Example #6
0
 def __iter__(self):
     import pysam
     return iter(pysam.get_defines())
Example #7
0
 def __iter__(self):
     import pysam
     return iter(pysam.get_defines())