Repository 'blast_tool'
hg clone https://toolshed.g2.bx.psu.edu/repos/nedias/blast_tool

Changeset 1:0c471588f014 (2016-10-12)
Previous changeset 0:45fbe538fa01 (2016-10-12) Next changeset 2:c68c3bb9cd57 (2016-10-12)
Commit message:
Uploaded
added:
blast_entry.py
b
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
b
@@ -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)
+
+