def parse_arguments()

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


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

	try:
		opts, args = getopt.getopt(argv[1:], "i:o:t:a:", ["input=", "output=", "tool=","annotation="])
	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 ("-a", "--annotation"):
			annosaf = arg
			if not os.path.isfile(annosaf):
				raise ArgumentError("Argument Error: Invalid annotation file passed.")
				
		elif opt in ("-o", "--output"):
			outfile = arg
				
		elif opt in ("-t", "--tool"):
			tool = 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 annosaf is None:
		raise ArgumentError("You need to supply an input, an output, an annotation file and an expression estimation tool both!") 
		
    # return argument values
	return srcfile,outfile,tool,annosaf