def parse_arguments()

in src/main/python/convert_variant_for_annotation.py [0:0]


def parse_arguments(argv):
	srcfile,outfile,tool,mode = None,None,None,None

	try:
		opts, args = getopt.getopt(argv[1:], "i:o:t:m:", ["input=", "output=", "tool=", "mode="])
	except getopt.GetoptError as err:
		# print help information and exit:
		print str(err)  # will print something like "option -a not recognized"
		usage()

	for opt, arg in opts:
		if opt == '-h':
			usage()

		elif opt in ("-i", "--input"):
			srcfile = arg
			if not os.path.isfile(srcfile):
				raise ArgumentError("Argument Error: Invalid input passed.")
		
		elif opt in ("-o", "--output"):
			outfile = arg
				
		elif opt in ("-t", "--tool"):
			tool = arg
		
		elif opt in ("-m", "--mode"):
			mode = arg
			
		else:
			raise ArgumentError("Bad argument: I don't know what %s is" % arg)

	if srcfile is None or outfile is None or tool is None or mode is None:
		raise ArgumentError("You need to supply an input, a output, a tool and a variant detection mode both!") 
		
    # return argument values
	return srcfile,outfile,tool,mode