PEATSA/WebApp/WebScript.py
def parseCommandLine(self):

		'''Parses the command line
		
		Execeptions:
			Raises Core.Exceptions.ArgumentError if there was a problem with the arguments supplied'''
	
		try:
			self.opt = getopt.getopt(sys.argv[1:], 
					"vw:p:o:j:h", 
					["pKa", "scan", "path", "modes", "stability", 
					"mutationList=", "ionisableGroups=","mutation=", "mutants=", 
					"ligand=", "configurationFile=", "mutationQuality=", "create-configuration"])
			self.opt = dict(self.opt[0])
		except getopt.GetoptError, data:
			raise Core.Exceptions.ArgumentError, data
		
		#Create configuration instance 
		#This is needed for reading the default data and output directories
		if self.opt.has_key("--configurationFile"):
			configurationFile = self.opt["--configurationFile"]
		else:
			#Use default configuration for the web application
			configurationFile = os.path.join(UtilityFunctions.ResourceDirectory(), "webApplication.conf") 
			self.opt["--configurationFile"] = configurationFile

		configuration = Core.Environment.Configuration(filename=configurationFile)

		#
		#Check required args
		#

		if not self.opt.has_key("-w") and not self.createConfigurationRequested():
			raise Core.Exceptions.ArgumentError, "Working directory (-w) must be specified"
		
		if not self.opt.has_key("-p") and not self.createConfigurationRequested():	
			raise Core.Exceptions.ArgumentError, "PDB (-p) must be specified"
		
		if not self.opt.has_key("-j"):
			raise Core.Exceptions.ArgumentError, "A job id must be specified"
		
		if not self.opt.has_key("-o"):
			try:
				 self.opt["-o"] = os.path.join(os.getcwd(), self.opt["-j"])
				 self.environment.output('[PEAT-SA] No output directory specified - Defaulting to %s' % self.opt["-o"])
			except:
				Core.Exceptions.ArgumentError, "Output directory (-w) not specified and default value not available in configuration file"
		else:
			self.environment.output('[PEAT-SA] Output directory is %s' % self.opt["-o"])

		#
		#Check if any of the optional flags were specified	
		#
			
		counts = [self.opt.keys().count(option) for option in self.optionalArguments]
		value = reduce(lambda x,y: x+y, counts)
		if value == 0 and  not self.createConfigurationRequested():
			self.environment.output('[PEAT-SA] Performing pka scan, stability analysis, ENM analysis and transition path finding')
			#Add the options arguments
			for option in self.optionalArguments:
				if option != '--mutationList':
					self.opt[option] = ""	

		#Make any supplied paths absolute
		self.__fixPaths__()
Parses the command line
		
		Execeptions:
			Raises Core.Exceptions.ArgumentError if there was a problem with the arguments supplied
Parses the command line
Execeptions:
Raises Core.Exceptions.ArgumentError if there was a problem with the arguments supplied
Parses the command line Execeptions : Raises Core . Exceptions . ArgumentError if there was a problem with the arguments supplied
def parseCommandLine(self):
		try:
			self.opt = getopt.getopt(sys.argv[1:], 
					"vw:p:o:j:h", 
					["pKa", "scan", "path", "modes", "stability", 
					"mutationList=", "ionisableGroups=","mutation=", "mutants=", 
					"ligand=", "configurationFile=", "mutationQuality=", "create-configuration"])
			self.opt = dict(self.opt[0])
		except getopt.GetoptError, data:
			raise Core.Exceptions.ArgumentError, data
		if self.opt.has_key("--configurationFile"):
			configurationFile = self.opt["--configurationFile"]
		else:
			configurationFile = os.path.join(UtilityFunctions.ResourceDirectory(), "webApplication.conf") 
			self.opt["--configurationFile"] = configurationFile
		configuration = Core.Environment.Configuration(filename=configurationFile)
		Check required args
		if not self.opt.has_key("-w") and not self.createConfigurationRequested():
			raise Core.Exceptions.ArgumentError, "Working directory (-w) must be specified"
		if not self.opt.has_key("-p") and not self.createConfigurationRequested():	
			raise Core.Exceptions.ArgumentError, "PDB (-p) must be specified"
		if not self.opt.has_key("-j"):
			raise Core.Exceptions.ArgumentError, "A job id must be specified"
		if not self.opt.has_key("-o"):
			try:
				 self.opt["-o"] = os.path.join(os.getcwd(), self.opt["-j"])
				 self.environment.output('[PEAT-SA] No output directory specified - Defaulting to %s' % self.opt["-o"])
			except:
				Core.Exceptions.ArgumentError, "Output directory (-w) not specified and default value not available in configuration file"
		else:
			self.environment.output('[PEAT-SA] Output directory is %s' % self.opt["-o"])
		Check if any of the optional flags were specified	
		counts = [self.opt.keys().count(option) for option in self.optionalArguments]
		value = reduce(lambda x,y: x+y, counts)
		if value == 0 and  not self.createConfigurationRequested():
			self.environment.output('[PEAT-SA] Performing pka scan, stability analysis, ENM analysis and transition path finding')
			Add the options arguments
			for option in self.optionalArguments:
				if option != '--mutationList':
					self.opt[option] = ""	
		Make any supplied paths absolute
		self.__fixPaths__()
def parseCommandLine ( self ) : try : self . opt = getopt . getopt ( sys . argv [ 1 : ] , "vw:p:o:j:h" , [ "pKa" , "scan" , "path" , "modes" , "stability" , "mutationList=" , "ionisableGroups=" , "mutation=" , "mutants=" , "ligand=" , "configurationFile=" , "mutationQuality=" , "create-configuration" ] ) self . opt = dict ( self . opt [ 0 ] ) except getopt . GetoptError , data : raise Core . Exceptions . ArgumentError , data if self . opt . has_key ( "--configurationFile" ) : configurationFile = self . opt [ "--configurationFile" ] else : configurationFile = os . path . join ( UtilityFunctions . ResourceDirectory ( ) , "webApplication.conf" ) self . opt [ "--configurationFile" ] = configurationFile configuration = Core . Environment . Configuration ( filename = configurationFile ) if not self . opt . has_key ( "-w" ) and not self . createConfigurationRequested ( ) : raise Core . Exceptions . ArgumentError , "Working directory (-w) must be specified" if not self . opt . has_key ( "-p" ) and not self . createConfigurationRequested ( ) : raise Core . Exceptions . ArgumentError , "PDB (-p) must be specified" if not self . opt . has_key ( "-j" ) : raise Core . Exceptions . ArgumentError , "A job id must be specified" if not self . opt . has_key ( "-o" ) : try : self . opt [ "-o" ] = os . path . join ( os . getcwd ( ) , self . opt [ "-j" ] ) self . environment . output ( '[PEAT-SA] No output directory specified - Defaulting to %s' % self . opt [ "-o" ] ) except : Core . Exceptions . ArgumentError , "Output directory (-w) not specified and default value not available in configuration file" else : self . environment . output ( '[PEAT-SA] Output directory is %s' % self . opt [ "-o" ] ) counts = [ self . opt . keys ( ) . count ( option ) for option in self . optionalArguments ] value = reduce ( lambda x , y : x + y , counts ) if value == 0 and not self . createConfigurationRequested ( ) : self . environment . output ( '[PEAT-SA] Performing pka scan, stability analysis, ENM analysis and transition path finding' ) for option in self . optionalArguments : if option != '--mutationList' : self . opt [ option ] = "" self . __fixPaths__ ( )
Parses the command line
Execeptions:
Raises Core.Exceptions.ArgumentError if there was a problem with the arguments supplied
Parses the command line Execeptions : Raises Core . Exceptions . ArgumentError if there was a problem with the arguments supplied
'''Parses the command line
		
		Execeptions:
			Raises Core.Exceptions.ArgumentError if there was a problem with the arguments supplied''' #Create configuration instance  #This is needed for reading the default data and output directories #Use default configuration for the web application # #Check required args # # #Check if any of the optional flags were specified	 # #Add the options arguments #Make any supplied paths absolute
self