-
Notifications
You must be signed in to change notification settings - Fork 8
/
run_panda.py
executable file
·64 lines (59 loc) · 1.7 KB
/
run_panda.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
#!/usr/bin/env python
"""Run PANDA algorithm from the command line.
"""
import sys
import getopt
import pypanda
def main(argv):
""" Run pypanda.
-h help
-e (required) expression values
-m (required) pair file of motif edges
-p (required) pair file of PPI edges
-o (required) output file
"""
#create variables
expression_data = None
motif = None
ppi = None
output_file = None
help_text = 'pypanda options:\n\
\t-e (required) <expression_data.txt>\n\
\t-m (required) <motif_data.txt>\n\
\t-p (required) <ppi_data.txt>\n\
\t-o (required) <output_file_name>'
# Get input options
try:
opts, args = getopt.getopt(argv, 'he:m:p:o:', ['help', 'expression=', 'motif=', 'ppi=', 'out='])
except getopt.GetoptError:
print help_text
sys.exit()
for opt, arg in opts:
if opt == '-h':
print help_text
sys.exit()
if opt == '-e':
expression_data = arg
if opt == '-m':
motif = arg
if opt == '-p':
ppi = arg
if opt == '-o':
output_file = arg
#check if required options are given
if expression_data and motif and ppi:
print 'Input data:'
print 'Expression:', expression_data
print 'Motif data:', motif
print 'PPI data:', ppi
else:
print 'Missing input file!'
print help_text
sys.exit()
# Run panda
print 'Start Panda run ...'
p = pypanda.Panda(expression_data, motif, ppi, save_tmp=True)
p.save_panda_results(output_file)
print 'All done!'
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))