-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
78 lines (65 loc) · 2.92 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import os
from ast import literal_eval
import numpy as np
def get_version(source='vcfnp.pyx'):
with open(source) as f:
for line in f:
if line.startswith('__version__'):
return literal_eval(line.partition('=')[2].lstrip())
raise ValueError("__version__ not found")
vcflib_dir = os.path.join(os.getcwd(), 'vcflib')
smithwaterman_dir = os.path.join(vcflib_dir, 'smithwaterman')
tabixpp_dir = os.path.join(vcflib_dir, 'tabixpp')
vcflib_sources = ('Variant.cpp', 'ssw.c', 'ssw_cpp.cpp', 'split.cpp')
smithwaterman_sources = ('BandedSmithWaterman.cpp',
'SmithWatermanGotoh.cpp',
'Repeats.cpp',
'disorder.c',
'LeftAlign.cpp',
'IndelAllele.cpp')
tabixpp_sources = ('bedidx.c', 'bgzf.c', 'index.c', 'knetfile.c', 'kstring.c',
'tabix.cpp')
def get_vcflib_sources():
sources = list()
sources += [os.path.join(vcflib_dir, s) for s in vcflib_sources]
sources += [os.path.join(smithwaterman_dir, s) for s in smithwaterman_sources]
sources += [os.path.join(tabixpp_dir, s) for s in tabixpp_sources]
return sources
vcflib_extension = Extension('vcflib',
sources=['vcflib.pyx'] + get_vcflib_sources(),
language='c++',
include_dirs=[np.get_include(), vcflib_dir,
smithwaterman_dir, tabixpp_dir,
'.'],
libraries=['m', 'z'],
extra_compile_args=['-O3'],
)
vcfnp_extension = Extension('vcfnp',
sources=['vcfnp.pyx'] + get_vcflib_sources(),
language='c++',
include_dirs=[np.get_include(), vcflib_dir,
smithwaterman_dir,
tabixpp_dir, '.'],
libraries=['m', 'z'],
extra_compile_args=['-O3'],
)
setup(
name='vcfnp',
version=get_version(),
author='Alistair Miles',
author_email='alimanfoo@googlemail.com',
url='https://github.com/alimanfoo/vcfnp',
license='MIT License',
description='Load numpy arrays from a VCF (variant call file).',
long_description=open('README.rst').read(),
classifiers=['Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules'
],
cmdclass={'build_ext': build_ext},
ext_modules=[vcflib_extension, vcfnp_extension],
)