comparison blast_entry.py @ 1:0c471588f014 draft

Uploaded
author nedias
date Wed, 12 Oct 2016 18:11:55 -0400
parents
children 0145fdbdcf90
comparison
equal deleted inserted replaced
0:45fbe538fa01 1:0c471588f014
1 #!/usr/bin/env python
2 """
3 Python script, served as the entry of BLAST API
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 blast_tool
14
15 # Usage message
16 usage = """Use as follows:
17 $ python blast_entry.py -i input_seq_file -o output_xml -f format -p blast_program -d blast_database
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("-o", "--output", dest="output",
26 default=None,
27 help="Output of Blast result in xml form",
28 metavar="FILE")
29 parser.add_option("-f", "--format", dest="format",
30 default="fasta",
31 help="Set the format of input file")
32 parser.add_option("-p", "--program", dest="program",
33 default="blastp",
34 help="Define which BLAST API is used")
35 parser.add_option("-d", "--database", dest="database",
36 default="nr",
37 help="Define which database to search from")
38
39 options, args = parser.parse_args()
40
41 # Show version data (TODO:consider move to blast_tool.py)
42 if options.version:
43 print("v0.1.0")
44 sys.exit(0)
45
46 # Call actual function
47 else:
48 blast_tool.exec_tool(options)
49
50