예제 #1
0
	def parseParams(self):
		'''
		Use OptionParser to get parameters
		'''
		global check_interval
		if len(sys.argv) == 1 and self.is_win32:
			try:
				from optparse_gui import OptionParser
				use_gui = True
			except:
				raw_input('Need opparse_gui to enter options on Windows')
				sys.exit()
		else:
			from optparse import OptionParser
			use_gui = False

		parser = OptionParser()

		# options
		parser.add_option("--method", dest="method",
			help="method to transfer, e.g. --method=mv", type="choice", choices=['mv','rsync'], default='rsync' if sys.platform != 'win32' else "mv")
		parser.add_option("--source_path", dest="source_path",
			help="Mounted parent path to transfer, e.g. --source_path=/mnt/ddframes", metavar="PATH")
		parser.add_option("--camera_host", dest="camera_host",
			help="Camera computer hostname in leginondb, e.g. --camera_host=gatank2")
		parser.add_option("--destination_head", dest="dest_path_head",
			help="Specific head destination frame path to transfer if multiple frame transfer is run for one source to frame paths not all mounted on the same computer, e.g. --destination_head=/data1", metavar="PATH", default='')
		parser.add_option("--check_interval", dest="check_interval", help="Seconds between checking for new frames", type="int", default=check_interval)

		# parsing options
		(options, optargs) = parser.parse_args(sys.argv[1:])
		if len(optargs) > 0:
			print "Unknown commandline options: "+str(optargs)
		if not use_gui and len(sys.argv) < 2:
			parser.print_help()
			sys.exit()
		params = {}
		for i in parser.option_list:
			if isinstance(i.dest, str):
				params[i.dest] = getattr(options, i.dest)
		self.checkOptionConflicts(params)
		# set global variable check_interval
		check_interval = options.check_interval
		return params
예제 #2
0
from collections import defaultdict

from version import VERSION

VERSION = '%s' % (VERSION, )

from os.path import join, dirname, realpath, split
try:
    scriptdir = dirname(realpath(__file__))
except NameError:
    scriptdir = dirname(realpath(sys.argv[0]))
sys.path.append(join(scriptdir, '..', '..', 'common', 'src'))

from optparse_gui import OptionParser, OptionGroup, ProgressText

parser = OptionParser(version=VERSION)
regexs = OptionGroup(parser, "Filename Matching")

parser.add_option("--counts",
                  type="file",
                  dest="counts",
                  default=None,
                  help="Output file from readCounts. Required.",
                  notNone=True,
                  filetypes=[("readCount Output", "*.tsv")])
parser.add_option("--cosmic",
                  type="file",
                  dest="cosmic",
                  default=None,
                  help="COSMIC Mutants.",
                  filetypes=[("COSMIC Annotations", "*.tsv;*.tsv.gz")])