-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
187 lines (159 loc) · 7.79 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
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
import os
import subprocess
import sys
answer = False
print '\n##############################################################'
print '\n SVenX setup'
print '\n##############################################################'
print ('\nFollow the instructions in this setup script and answer the questions when needed.')
# GENERAL
# Nextflow
print ('Parts of SVenX is written in Nextflow, in order to run it nextflow needs to be installed.')
print 'Is nextflow installed? yes/no'
while answer is False:
selection=raw_input()
if selection == 'NO' or selection == 'no':
print('Please install nextflow and then run setup.py once again')
sys.exit()
if selection == 'YES' or selection == 'yes':
answer = True
else:
print'Invalid syntax, please enter yes or no'
# Uppmax or not, important when installing modules or programs.
print 'Do you plan to run SVenX on UPPMAX? yes/no'
answer = False
while answer is False:
selection=raw_input()
if selection == 'NO' or selection == 'no':
uppmax = False
answer = True
if selection == 'YES' or selection == 'yes':
uppmax = True
answer = True
else:
print 'Invalid syntax, please enter yes or no'
if not uppmax:
print 'Longranger needs to be installed before running SVenX. Information about how to install it can be found at https://support.10xgenomics.com.'
print 'Is longranger installed? yes/no'
answer = False
while answer is False:
selection=raw_input()
if selection == 'NO' or selection == 'no':
print('Please install Longranger and then run setup.py once again')
sys.exit()
if selection == 'YES' or selection == 'yes':
answer = True
else:
print 'Invalid syntax, please enter yes or no'
#SVenXDirectory = os
SVenXDirectory = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(SVenXDirectory,"template/SVenX_template.config"), 'r') as myfile:
template=myfile.read()
print 'General information needed in order to run Longranger.'
# Output_directory
selection = os.path.join(SVenXDirectory,"SVenX_outs")
template=template.replace("{working_dir}", "\'{}\'".format(selection) )
print "Set the path to the reference genome hg 19"
selection=raw_input()
template=template.replace("{ref_genome}", "\'{}\'".format(selection) )
# VEP
print "Do you want to run VEP? yes/no"
selection = raw_input()
if selection == "yes" or selection == "YES":
answer = False
if uppmax:
print 'The module will be loaded on UPPMAX'
answer = True
if not uppmax:
print 'In order to run VEP it has to be installed. Information about how to install it can be found at VEP ENSMBLE website.'
print 'Is VEP installed? yes/no'
while answer is False:
selection=raw_input()
if selection == 'NO' or selection == 'no':
print('\nPlease install VEP and then run setup.py once again')
sys.exit()
if selection == 'YES' or selection == 'yes':
answer = True
else:
print 'Invalid syntax, please enter yes or no'
# TIDDIT
print "Do you want to run TIDDIT? yes/no"
selection = raw_input()
if selection == "yes" or selection == "YES":
print "TIDDIT needs to be installed in order to run it. If you have already installed TIDDIT, please answer no."
print "Do you want to install TIDDIT? yes/no"
selection = raw_input()
if selection == 'yes' or selection == 'YES':
print "installing and setting up TIDDIT"
subprocess.call('chmod +x installation_scripts/install_TIDDIT.sh', shell=True)
command=["{} {}".format(os.path.join(SVenXDirectory,"installation_scripts/install_TIDDIT.sh"),SVenXDirectory)]
tmp=subprocess.check_output(command,shell = True)
template=template.replace("{TIDDIT_path}", "\'{}\'".format(os.path.join(SVenXDirectory,"TIDDIT/bin/TIDDIT")) )
if selection == 'no' or selection == 'NO':
print 'Add path to TIDDIT. The path is set to current working directory TIDDIT/bin/TIDDIT/ if left blank'
selection = raw_input()
if selection == "":
selection = os.path.join(SVenXDirectory,"TIDDIT/bin/TIDDIT")
template=template.replace("{TIDDIT_path}", "\'{}\'".format(selection))
# SV - CNVnator
print "Do you want to run CNVnator? yes/no"
selection = raw_input()
if selection == "yes" or selection == "YES":
answer = False
if uppmax:
print 'The module will be loaded on UPPMAX'
answer = True
if not uppmax:
print 'In order to run CNVnator it has to be installed. Information about how to install it can be found at https://github.com/abyzovlab/CNVnatorat .'
print 'Is CNVnator installed? yes/no'
while answer is False:
selection=raw_input()
if selection == 'NO' or selection == 'no':
print('Please install CNVnator and then run setup.py once again')
sys.exit()
if selection == 'YES' or selection == 'yes':
answer = True
else:
print 'Invalid syntax, please enter yes or no'
if answer:
print "Enter path to CNVnator, the path is set to cnvnator if left blank"
selection=raw_input()
if selection == "":
selection = "cnvnator"
template=template.replace("{CNVnator_path}", "\'{}\'".format(selection) )
print "Enter the cnvnator2VCF.pl script path, the path is set to cnvnator2VCF.pl if left blank"
selection=raw_input()
if selection == "":
selection = "cnvnator2VCF.pl"
template=template.replace("{CNVnator2vcf_path}", "\'{}\'".format(selection) )
print "if the ROOTSYS variable is not set, add the path to the thisroot.sh script inside the root bin folder, leave blank otherwise(open another terminal and print echo $ROOTSYS to check)"
selection=raw_input()
template=template.replace("{thisroot_path}", "\'{}\'".format(selection) )
thisroot=selection
print "Add the path to the directory containing reference files for CNVnator"
selection=raw_input()
template=template.replace("{CNVnator_reference_dir_path}", "\'{}\'".format(selection) )
print "If you are going to run TIDDIT or CNVnator, the vcf-files generated needs to be merged. In order to do so, SVDB needs to be installed. If you have already installed SVDB please answer no"
print "Do you want to install SVDB? yes/no"
selection = raw_input()
if selection == 'yes' or selection == 'YES':
print "SVDB requires sciKit-learn v0.15.2 as well as numpy, if these have not been installed yet, please answer no and do so before starting over again"
print "Have sciKit-learn v0.15.2 and numpy correctly been installed?"
selection = raw_input()
if selection == 'no' or selection == 'NO':
print('\nPlease make sure sciKit-learn v0.15.2 and numpy is installed and then run setup.py once again')
sys.exit()
print "installing and setting up SVDB"
subprocess.call('chmod +x installation_scripts/install_SVDB.sh', shell=True)
command=["{} {}".format(os.path.join(SVenXDirectory,"installation_scripts/install_SVDB.sh"),SVenXDirectory)]
tmp=subprocess.check_output(command,shell = True)
template=template.replace("{SVDB_script_path}", "\'{}\'".format(os.path.join(SVenXDirectory,"SVDB/SVDB.py")) )
print "In order to run SVDB query, please add the path to query database. See https://github.com/J35P312/SVDB for more information"
selection=raw_input()
template=template.replace("{SVDB_database}", "\'{}\'".format(selection) )
f= open('SVenX.conf', "w")
f.write(template)
f.close()
# Make the launching-script executable
subprocess.call('chmod +x ./SVenX.sh', shell=True)
print 'Setup is completed'