-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbat_optparse.py
More file actions
60 lines (48 loc) · 1.38 KB
/
bat_optparse.py
File metadata and controls
60 lines (48 loc) · 1.38 KB
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
# Module that provides the input menu
# for BAT
#
#
# Joe Bemister
#
# 03/31/2015
#
#
# modified:
#
#
#
import optparse
import sys
import os
#Initialize
parser = optparse.OptionParser()
#log = os.path.join(os.getcwd(), 'log.txt')
#align = os.path.join(os.getcwd(), 'bat.csv')
#Feed options
parser.add_option("-t", help="Location of the target pdb file", dest="target", action="store", metavar="<file>")
parser.add_option("-q", help="Location of the pdb file to align to target", dest="query", action="store", metavar="<file>")
parser.add_option("-a", help="Location of the file with the desired alignment", dest="align", action="store", metavar="<file>")
#Tell optparse to parse arguments
#opts contains all values received via command line
#every other arguments that are not recognized by our parser
(opts, args) = parser.parse_args()
#checking for mandatory options (based on Sebastian Raschka's HETHER)
if opts.target is None:
print("\n\nERROR: target file is missing\n\n")
parser.print_help()
print("\n\n")
sys.exit()
elif opts.query is None:
print("\n\nERROR: query file is missing\n\n")
parser.print_help()
print("\n\n")
sys.exit()
elif opts.align is None:
print("\n\nERROR: alignment file is missing\n\n")
parser.print_help()
print("\n\n")
sys.exit()
#access variables by opts.<dest>
starget = opts.target
squery = opts.query
salign = opts.align