-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathphylobarcode.py
executable file
·63 lines (49 loc) · 1.29 KB
/
phylobarcode.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
#!/usr/bin/python
import sys
import os
def main():
params = parseArgs()
#Object to parse command-line arguments
class parseArgs():
def __init__(self):
#Define options
try:
options, remainder = getopt.getopt(sys.argv[1:], 'h', \
["help"])
except getopt.GetoptError as err:
print(err)
self.display_help("\nExiting because getopt returned non-zero exit status.")
#Default values for params
#Input params
#First pass to see if help menu was called
for o, a in options:
if o in ("-h", "-help", "--help"):
self.display_help("Exiting because help menu was called.")
#Second pass to set all args.
for opt, arg_raw in options:
arg = arg_raw.replace(" ","")
arg = arg.strip()
opt = opt.replace("-","")
#print(opt,arg)
if opt == "h" or opt == "help":
continue
else:
assert False, "Unhandled option %r"%opt
#Check manditory options are set
if not self.files:
self.display_help("No files provided.")
def display_help(self, message=None):
if message is not None:
print()
print (message)
print ("\n<template.py>\n")
print("Author: Tyler K Chafin, University of Arkansas")
print ("Contact: [email protected]")
print ("Description: ")
print("""
""")
print()
sys.exit()
#Call main function
if __name__ == '__main__':
main()