# HG changeset patch # User nedias # Date 1476310315 14400 # Node ID 0c471588f01410d988f2223ef6313d3683da425c # Parent 45fbe538fa014b56251ce39e7773e1e514befb84 Uploaded diff -r 45fbe538fa01 -r 0c471588f014 blast_entry.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/blast_entry.py Wed Oct 12 18:11:55 2016 -0400 @@ -0,0 +1,50 @@ +#!/usr/bin/env python +""" + Python script, served as the entry of BLAST API + Separated the API with actual functionality (for Galaxy and future Web API) + + Use -v or --version to get the version, -h or --help for help. + + Author Nedias Sept 2016 + +""" +import sys +from optparse import OptionParser +import blast_tool + +# Usage message +usage = """Use as follows: +$ python blast_entry.py -i input_seq_file -o output_xml -f format -p blast_program -d blast_database +""" + +# User OptionParser to separate all optional arguments of the commandline +parser = OptionParser(usage=usage) +parser.add_option('-i', '--input', dest='input', + default=None, help='Input sequences filename', + metavar="FILE") +parser.add_option("-o", "--output", dest="output", + default=None, + help="Output of Blast result in xml form", + metavar="FILE") +parser.add_option("-f", "--format", dest="format", + default="fasta", + help="Set the format of input file") +parser.add_option("-p", "--program", dest="program", + default="blastp", + help="Define which BLAST API is used") +parser.add_option("-d", "--database", dest="database", + default="nr", + help="Define which database to search from") + +options, args = parser.parse_args() + +# Show version data (TODO:consider move to blast_tool.py) +if options.version: + print("v0.1.0") + sys.exit(0) + +# Call actual function +else: + blast_tool.exec_tool(options) + +