annotate entry.py @ 6:c2096761a8c3 draft

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