1
|
1 #!/usr/bin/env python
|
|
2 """
|
|
3 Python script, served as the entry of open reading frame searching tool
|
|
4 Separated the API with actual functionality (for Galaxy and future Web API)
|
|
5
|
|
6 Use -v or --version to get the version, -h or --help for help.
|
|
7
|
|
8 Author Nedias Sept 2016
|
|
9
|
|
10 """
|
|
11 import sys
|
|
12 from optparse import OptionParser
|
|
13 import orf_tool
|
|
14
|
|
15 # Usage message
|
|
16 usage = """Use as follows:
|
|
17 $ python entry.py -i input_seq_file -l length_of_designated_match
|
|
18 """
|
|
19
|
|
20 # User OptionParser to separate all optional arguments of the commandline
|
|
21 parser = OptionParser(usage=usage)
|
|
22 parser.add_option('-i', '--input', dest='input',
|
|
23 default=None, help='Input sequences filename',
|
|
24 metavar="FILE")
|
|
25 parser.add_option("-l", "--length", dest="length",
|
|
26 default=100,
|
|
27 help="Set the length of designated match, length is the percentage of the longest match")
|
|
28 parser.add_option("-f", "--format", dest="format",
|
|
29 default="fasta",
|
|
30 help="Set the format of input file")
|
|
31 parser.add_option("-v", "--version", dest="version",
|
|
32 default=False, action="store_true",
|
|
33 help="Show version and quit")
|
|
34 parser.add_option("-a", "--outputall", dest="outputa",
|
|
35 default=None,
|
|
36 help="Output of all matches",
|
|
37 metavar="FILE")
|
|
38 parser.add_option("-d", "--outputdest", dest="outputd",
|
|
39 default=None,
|
|
40 help="Output of designated matches",
|
|
41 metavar="FILE")
|
|
42
|
|
43 options, args = parser.parse_args()
|
|
44
|
|
45 # Show version data (TODO:consider move to orf_tool.py)
|
|
46 if options.version:
|
|
47 print("v0.1.0")
|
|
48 sys.exit(0)
|
|
49
|
|
50 # Call actual function
|
|
51 else:
|
|
52 orf_tool.exec_tool(options)
|
|
53
|
|
54
|