Mercurial > repos > nedias > blast_tool
changeset 1:0c471588f014 draft
Uploaded
author | nedias |
---|---|
date | Wed, 12 Oct 2016 18:11:55 -0400 |
parents | 45fbe538fa01 |
children | c68c3bb9cd57 |
files | blast_entry.py |
diffstat | 1 files changed, 50 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /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) + +