view entry.py @ 3:0095bf758b19 draft

Uploaded
author nedias
date Wed, 12 Oct 2016 00:03:53 -0400
parents 3814470e221a
children
line wrap: on
line source

#!/usr/bin/env python
"""
 Python script, served as the entry of open reading frame searching tool
 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 orf_tool

# Usage message
usage = """Use as follows:
$ python entry.py -i input_seq_file -l length_of_designated_match
"""

# 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("-l", "--length", dest="length",
                  default=100,
                  help="Set the length of designated match, length is the percentage of the longest match")
parser.add_option("-f", "--format", dest="format",
                  default="fasta",
                  help="Set the format of input file")
parser.add_option("-v", "--version", dest="version",
                  default=False, action="store_true",
                  help="Show version and quit")
parser.add_option("-a", "--outputall", dest="outputa",
                  default=None,
                  help="Output of all matches",
		  metavar="FILE")
parser.add_option("-d", "--outputdest", dest="outputd",
                  default=None,
                  help="Output of designated matches",
                  metavar="FILE")

options, args = parser.parse_args()

# Show version data (TODO:consider move to orf_tool.py)
if options.version:
    print("v0.1.0")
    sys.exit(0)

# Call actual function
else:
    orf_tool.exec_tool(options)