-
Notifications
You must be signed in to change notification settings - Fork 22
/
setup.py
101 lines (86 loc) · 4.98 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 python3
"""
This is the Badread installation script. Assuming you're in the same directory, it can be run like
this: `python3 setup.py install`, or (probably better) like this: `pip3 install .`
Copyright 2018 Ryan Wick ([email protected])
https://github.com/rrwick/Badread
This file is part of Badread. Badread is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version. Badread is distributed
in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along with Badread.
If not, see <http://www.gnu.org/licenses/>.
"""
import os
import shutil
import sys
from setuptools import setup
from setuptools.command.install import install
def readme():
with open('README.md', encoding='utf-8') as f:
return f.read()
# Get the program version from another file.
__version__ = '0.0.0'
exec(open('badread/version.py').read())
class BadreadInstall(install):
"""
The install process copies necessary files (like pre-built models) to the install location.
"""
if __name__ == '__main__':
def run(self):
# Make sure we have permission to write the files.
if os.path.isdir(self.install_lib) and not os.access(self.install_lib, os.W_OK):
sys.exit('Error: no write permission for ' + self.install_lib + ' ' +
'Perhaps you need to use sudo?')
if os.path.isdir(self.install_scripts) and not os.access(self.install_scripts, os.W_OK):
sys.exit('Error: no write permission for ' + self.install_scripts + ' ' +
'Perhaps you need to use sudo?')
install.run(self)
# Copy error models to installation directory.
error_models_source_dir = os.path.join('badread', 'error_models')
error_models_dest_dir = os.path.join(self.install_lib, 'badread', 'error_models')
if not os.path.exists(error_models_dest_dir):
os.makedirs(error_models_dest_dir)
shutil.copyfile(os.path.join(error_models_source_dir, 'nanopore2018.gz'),
os.path.join(error_models_dest_dir, 'nanopore2018.gz'))
shutil.copyfile(os.path.join(error_models_source_dir, 'nanopore2020.gz'),
os.path.join(error_models_dest_dir, 'nanopore2020.gz'))
shutil.copyfile(os.path.join(error_models_source_dir, 'nanopore2023.gz'),
os.path.join(error_models_dest_dir, 'nanopore2023.gz'))
shutil.copyfile(os.path.join(error_models_source_dir, 'pacbio2016.gz'),
os.path.join(error_models_dest_dir, 'pacbio2016.gz'))
shutil.copyfile(os.path.join(error_models_source_dir, 'pacbio2021.gz'),
os.path.join(error_models_dest_dir, 'pacbio2021.gz'))
# Copy qscore models to installation directory.
qscore_models_source_dir = os.path.join('badread', 'qscore_models')
qscore_models_dest_dir = os.path.join(self.install_lib, 'badread', 'qscore_models')
if not os.path.exists(qscore_models_dest_dir):
os.makedirs(qscore_models_dest_dir)
shutil.copyfile(os.path.join(qscore_models_source_dir, 'nanopore2018.gz'),
os.path.join(qscore_models_dest_dir, 'nanopore2018.gz'))
shutil.copyfile(os.path.join(qscore_models_source_dir, 'nanopore2020.gz'),
os.path.join(qscore_models_dest_dir, 'nanopore2020.gz'))
shutil.copyfile(os.path.join(qscore_models_source_dir, 'nanopore2023.gz'),
os.path.join(qscore_models_dest_dir, 'nanopore2023.gz'))
shutil.copyfile(os.path.join(qscore_models_source_dir, 'pacbio2016.gz'),
os.path.join(qscore_models_dest_dir, 'pacbio2016.gz'))
shutil.copyfile(os.path.join(qscore_models_source_dir, 'pacbio2021.gz'),
os.path.join(qscore_models_dest_dir, 'pacbio2021.gz'))
setup(name='Badread',
version=__version__,
description='Badread: a long read simulator that can mimic various kinds of read problems',
long_description=readme(),
long_description_content_type='text/markdown',
url='https://github.com/rrwick/Badread',
author='Ryan Wick',
author_email='[email protected]',
license='GPLv3',
packages=['badread'],
install_requires=['edlib', 'numpy', 'scipy'],
extras_require={'plot': ['matplotlib']},
entry_points={"console_scripts": ['badread = badread.__main__:main']},
include_package_data=True,
zip_safe=False,
python_requires='>=3.6',
cmdclass={'install': BadreadInstall})