Newer
Older
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/usr/bin/python
__author__ = "Sander Granneman"
__copyright__ = "Copyright 2018"
__version__ = "1.4.0"
__credits__ = ["Sander Granneman","Hywell Dunn Davies"]
__maintainer__ = ["Sander Granneman"]
__email__ = "sgrannem@staffmail.ed.ac.uk"
__status__ = "Production"
import re
import sys
import os
import platform
from os.path import expanduser
home = expanduser("~")
if os.path.exists("%s/bin/" % home):
home += "/bin"
DEFAULT_PATH = "%s/" % home
if sys.version[0:3] >= '3.0':
raw_input = input
OSX = """
#######################################################################
You are about to install the pyCRAC on Mac OSX...
Please make sure you have Xcode and
the Command line tools installed!
Xcode can be obtained from the
Mac App store.
We also recommend installing the
Enthought Canopy Python distribution,
which has most of the dependencies.
This distribution is also free for academics.
#######################################################################
"""
LINUX = """
########################################################################################
You are about to install the pyCRAC on a Linux operating system...
This installer has been tested on:
Linux Mint 16, Ubuntu 13.04 and higher, Debian Wheezy/Sid and Fedora 20
To install certain dependencies (such as the zlib libraries and Python
development tools) you need to have root privileges.
########################################################################################
"""
ROOT_WARNING = """
#################################################################################################################
!!WARNING!! You do not have root privileges on this machine !!WARNING!!
This installation may abort if certain dependencies are not present or can not be installed.
Please contact the administrator if the zlib and Python development tools are missing.
These are essential for pyCRAC to work. Without root privileges you can only install pyCRAC
in a Python installation on your home folder.
We recommend installing the Anaconda Python distribution in your home folder.
#################################################################################################################
"""
DIST_WARNING = """
#####################################################################################
!!WARNING Could not determine what Linux distribution you are running !!WARNING!!
For this installer to run properly, you need to have Python developer tools,
Python setuptools, numpy, pysam and cython installed.
Please e-mail the developer %s (%s)
if you run into any problems.
#####################################################################################
""" % (__author__,__email__)
sys.stdout.write("\nInstalling pyCRAC version %s...\n" % __version__)
supported = False
supported_systems = ["Linux","Darwin"]
if platform.system() == "Darwin": # only works on OS X
sys.stdout.write("%s\n" % OSX)
elif platform.system() == "Linux":
sys.stdout.write("%s\n" % LINUX)
supported_distros = ["debian","ubuntu","mint","linuxmint","redhat","centos","fedora"]
sys.stdout.write("\nChecking distribution...\n\n")
distribution = platform.dist()
flavor = distribution[0].lower()
if flavor and flavor in supported_distros:
supported = True
sys.stdout.write("\tYou are running %s Linux version %s...\n\tInstalling dependencies...\n" % (distribution[0],distribution[1]))
else:
sys.stderr.write("%s\n" % DIST_WARNING)
if os.getuid() == 0:
if supported:
if flavor in supported_distros[0:4]: # distro = 'ubuntu' or 'debian'
sys.stdout.write("\nInstalling python setup and development tools...\n")
os.system("apt-get install python-setuptools")
os.system("apt-get install python-dev")
sys.stdout.write("\nChecking for other dependencies...\n")
sys.stdout.write("zlib library..\n")
os.system("apt-get install zlibc")
os.system("apt-get install zlib1g-dev")
elif flavor in supported_distros[4:]: # distro = 'redhat' or 'centos' or 'fedora'
sys.stdout.write("Checking for gcc and installing python setup and development tools...\n\n")
os.system("yum install gcc")
os.system("yum install python-setuptools")
os.system("yum install python-devel")
sys.stdout.write("Checking for other dependencies...\n")
sys.stdout.write("zlib library..\n")
os.system("yum install zlib-devel")
else:
sys.stderr.write("%s\n" % ROOT_WARNING)
else:
sys.stderr.write("%s\n" % DIST_WARNING)
try:
from setuptools import setup
from setuptools.command import easy_install
sys.stdout.write("Python development and setuptools have been installed...\n")
except:
sys.stderr.write("Python development and setuptools have not been installed on this machine\nPlease contact the admin of this computer to install these modules\n")
exit()
setup(name='pyCRAC',
version='%s' % __version__,
description='Python NextGen sequencing data processing software',
author='Sander Granneman',
author_email='sgrannem@staffmail.ed.ac.uk',
url='http://sandergranneman.bio.ed.ac.uk/Granneman_Lab/pyCRAC_software.html',
packages=['pyCRAC','pyCRAC.Parsers','pyCRAC.Classes','pyCRAC.Methods'],
install_requires=['numpy >= 1.5.1', 'cython >=0.19', 'pysam >= 0.6','six >= 1.9.0'],
scripts=[
'pyCRAC/pyReadAligner.py',
'pyCRAC/pyMotif.py',
'pyCRAC/pyPileup.py',
'pyCRAC/pyBarcodeFilter.py',
'pyCRAC/pyReadCounters.py',
'pyCRAC/pyBinCollector.py',
'pyCRAC/pyCalculateFDRs.py',
'pyCRAC/pyClusterReads.py',
'pyCRAC/pyCalculateMutationFrequencies.py',
'pyCRAC/scripts/pyCalculateChromosomeLengths.py',
'pyCRAC/scripts/pyFastqDuplicateRemover.py',
'pyCRAC/scripts/pyAlignment2Tab.py',
'pyCRAC/scripts/pyGetGTFSources.py',
'pyCRAC/scripts/pySelectMotifsFromGTF.py',
'pyCRAC/scripts/pyFasta2tab.py',
'pyCRAC/scripts/pyFastqJoiner.py',
'pyCRAC/scripts/pyFastqSplitter.py',
'pyCRAC/scripts/pyExtractLinesFromGTF.py',
'pyCRAC/scripts/pyGetGeneNamesFromGTF.py',
'pyCRAC/scripts/pyCheckGTFfile.py',
'pyCRAC/scripts/pybed2GTF.py',
'pyCRAC/scripts/pyGTF2sgr.py',
'pyCRAC/scripts/pyGTF2bed.py',
'pyCRAC/scripts/pyGTF2bedGraph.py',
'pyCRAC/scripts/pyFilterGTF.py',
'pyCRAC/scripts/pyNormalizeIntervalLengths.py',
],
classifiers=[ 'Development Status :: 5 - Production/Stable',
'Environment :: Terminal',
'Intended Audience :: Education',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: Freeware',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Programming Language :: Python :: 2.6',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Software Development :: Libraries :: Application Frameworks'
],
data_files=[ ('%spyCRAC/db/' % DEFAULT_PATH,[
'pyCRAC/db/Saccharomyces_cerevisiae.EF2.59.1.0_chr_lengths.txt',
'pyCRAC/db/Saccharomyces_cerevisiae.EF2.59.1.3.gtf',
'pyCRAC/db/Saccharomyces_cerevisiae.EF2.59.1.0.fa',
'pyCRAC/db/Saccharomyces_cerevisiae.EF2.59.1.0.fa.tab']),
('%spyCRAC/tests/' % DEFAULT_PATH,[
'tests/test.novo',
'tests/test.sh',
'tests/test_coordinates.txt',
'tests/test.gtf',
'tests/test_f.fastq',
'tests/test_f.fastq.gz',
'tests/test_f_dm.fastq',
'tests/test_r.fastq',
'tests/test_r.fastq.gz',
'tests/test_r_dm.fastq',
'tests/indexes.txt',
'tests/barcodes.txt',
'tests/genes.list'])
]
)
checkinstallation = raw_input("\nWould you like to run the pyCRAC test script to check the installation? (Y/n) ")
if not checkinstallation or re.search("Y",checkinstallation,re.I):
sys.stdout.write("\nChecking pyCRAC installation...\n")
startdir = os.getcwd()
newdir = "%spyCRAC/tests/" % DEFAULT_PATH
os.chdir(newdir)
test = "sh test.sh"
os.system(test)
os.chdir(startdir)
sys.stdout.write("\nOutput files are stored in the %spyCRAC/tests folder\npyCRAC installation finished...\n " % DEFAULT_PATH)
else:
sys.stdout.write("\npyCRAC installation finished...\n")