forked from prashnts/metaRNA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
101 lines (89 loc) · 2.77 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#.--. .-. ... .... -. - ... .-.-.- .. -.
import sys
import os
import platform
from setuptools import setup, Extension
def check_rna_lib_installed(**kwa):
"Check Vienna RNA Packages"
return all([os.path.exists(*v) for k, v in kwa.items()])
def get_rna_lib_intallation_path():
"Attempts to get the RNAlib Path"
return {
'include_dirs': [
os.environ.get('VIENNARNAINCLUDE', '/usr/local/include/ViennaRNA'),
],
'library_dirs': [
os.environ.get('VIENNARNALIB', '/usr/local/lib')
]
}
def check_sanity():
"""
Check Sanity of the System. Since metaRNA core depends on C extension,
only posix systems are supported at the moment.
"""
if not os.name == 'posix':
print("metaRNA is currently not tested on non-posix systems.")
if sys.version_info[:2] not in [(2, 7), (3, 3), (3, 4), (3, 5)]:
print("metaRNA is only supported on Python 2.7, 3.3, 3.4, 3.5.")
return False
if not check_rna_lib_installed(**get_rna_lib_intallation_path()):
print(
"metaRNA requires Vienna RNA package. Please read the docs "
"for installation instructions.\n"
"If you have Vienna Package, then perhaps the installer is "
"unable to find the location. The location may be set by "
"setting the `VIENNARNAINCLUDE` and `VIENNARNALIB` environment "
"variables."
)
return False
return True
if not check_sanity():
sys.exit(1)
def extension_args():
args = get_rna_lib_intallation_path()
args['depends'] = [
'metarna/pymiranda/miranda.h',
]
args['sources'] = [
'metarna/pymiranda/pymiranda.c',
'metarna/pymiranda/scan.c',
'metarna/pymiranda/swat.c',
'metarna/pymiranda/thermo.c',
'metarna/pymiranda/utils.c',
'metarna/pymiranda/output.c',
'metarna/pymiranda/ExpString.c',
]
args['libraries'] = [
'RNA',
'm'
]
if not platform.system() == 'Darwin':
args['extra_compile_args'] = ['-fopenmp']
args['extra_link_args'] = ['-lgomp']
return args
setup_args = {
'name': 'metarna',
'version': '4.0.4',
'author': 'Prashant Sinha',
'author_email': '[email protected]',
'url': 'https://github.com/prashnts/metarna',
'license': 'GPLv3',
'description': 'Finds target sites for the miRNAs in genomic sequences.',
'packages': ['metarna'],
'ext_modules': [
Extension('metarna.pymiranda', **extension_args()),
],
'classifiers': [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Bio-Informatics',
]
}
setup(**setup_args)