PEATSA/Core/ProteinDesignTool.py
def main():
	
	'''Main function for the ProteinDesignTool program.
	
	Parses the command line and starts the jobs requested'''
	
	environment = Environment.Environment()
	
	#Read arguments
	parser = Utilities.CommandLineParser()
	parser.parseCommandLine()
	
	if parser.helpRequested() is True:
		print __doc__
		sys.exit(0)

	if parser.createConfigurationRequested() is True:				
		print 'Creating default configuration file, proteinDesignTool.conf, in the current directory'
		print 'See the programs README file for information on the options'
		Environment.Configuration(searchDefaultLocations=False, writeFile=True)
		sys.exit(0)
	
	#Create the ProteinDesignTool instance
	tool = ProteinDesignTool(parser.configurationFile(), 
			workingDirectory=parser.workingDirectory(),
			pdbFile=parser.pdbFile(), 
			outputDirectory=parser.outputDirectory(),
			dataName=parser.outputName(),
			removeHeterogens=parser.removeHeterogens())
	
	#Check if an initial pKa run requested
	if parser.pKa() is True:	
		tool.runPKACalculation()
		
	#Check if a previously created MutantCollection was specified
	mutantCollection = parser.mutants()
	if mutantCollection is None:	
		environment.output('[PEAT-SA] No mutants available from previous run.\n')
		#Note we use the ProteinDesignTool instances pdbFile attribute.
		#This points to the cleaned pdbFile the tool operates on.
		#Therefore we must use this to generate the mutants.
		mutantCollection = CreateMutants(tool.pdbFile, tool.configuration, parser, environment)	
		
	#Scan 	
	if parser.scan() is True:
		tool.runScan(mutantCollection=mutantCollection, 
				ionisableGroups=parser.ionisableGroups(),
				verbose=parser.verbose())

	#Stability	
	if parser.stability() is True:
		tool.runStabilityCalculation(mutantFiles=mutantCollection.mutantFiles(), 
				verbose=parser.verbose())

	#Binding
	if parser.binding() is True:
		tool.runBindingCalculation(mutantFiles=mutantCollection.mutantFiles(), 
			ligandFile=parser.ligandFile(), 
			verbose=parser.verbose())
			
	if parser.modes():
		doCalculation = True
		if parser.mutationListFile() is not None:
			object = Data.MutationListFile(parser.mutationListFile())
			doCalculation = object.isSinglePointMutationFormat()
				
		if doCalculation:
			mutations = mutantCollection.mutations()
			residueIndexes = []
			for mutation in mutations:
				index = Utilities.ParseResidueCode(mutation.residueCodes()[0])[1]
				residueIndexes.append(index)
			
			residueIndexes.sort()
			import Goodvibes.Main
			environment.output('[MODES] Calculating the effect of %d mutations on modes.\n', len(residueIndexes))
			modeCalculator = Goodvibes.Main.vibration()	
			results = modeCalculator.main('PEAT-SA',tool.pdbFile,residueIndexes=residueIndexes)
			print residueIndexes
		else:
			environment.output('[MODES] Can only perform mode calcualtion for SPMs.\n')

		
	if parser.transitionPath():
		print '[PATH] Transition path calculation not implemented yet - skipping'
	
	tool.cleanUp()
Main function for the ProteinDesignTool program.
	
	Parses the command line and starts the jobs requested
Main function for the ProteinDesignTool program.
Parses the command line and starts the jobs requested
Main function for the ProteinDesignTool program . Parses the command line and starts the jobs requested
def main():
	environment = Environment.Environment()
	parser = Utilities.CommandLineParser()
	parser.parseCommandLine()
	if parser.helpRequested() is True:
		print __doc__
		sys.exit(0)
	if parser.createConfigurationRequested() is True:				
		print 'Creating default configuration file, proteinDesignTool.conf, in the current directory'
		print 'See the programs README file for information on the options'
		Environment.Configuration(searchDefaultLocations=False, writeFile=True)
		sys.exit(0)
	tool = ProteinDesignTool(parser.configurationFile(), 
			workingDirectory=parser.workingDirectory(),
			pdbFile=parser.pdbFile(), 
			outputDirectory=parser.outputDirectory(),
			dataName=parser.outputName(),
			removeHeterogens=parser.removeHeterogens())
	if parser.pKa() is True:	
		tool.runPKACalculation()
	mutantCollection = parser.mutants()
	if mutantCollection is None:	
		environment.output('[PEAT-SA] No mutants available from previous run.\n')
		mutantCollection = CreateMutants(tool.pdbFile, tool.configuration, parser, environment)	
	if parser.scan() is True:
		tool.runScan(mutantCollection=mutantCollection, 
				ionisableGroups=parser.ionisableGroups(),
				verbose=parser.verbose())
	if parser.stability() is True:
		tool.runStabilityCalculation(mutantFiles=mutantCollection.mutantFiles(), 
				verbose=parser.verbose())
	if parser.binding() is True:
		tool.runBindingCalculation(mutantFiles=mutantCollection.mutantFiles(), 
			ligandFile=parser.ligandFile(), 
			verbose=parser.verbose())
	if parser.modes():
		doCalculation = True
		if parser.mutationListFile() is not None:
			object = Data.MutationListFile(parser.mutationListFile())
			doCalculation = object.isSinglePointMutationFormat()
		if doCalculation:
			mutations = mutantCollection.mutations()
			residueIndexes = []
			for mutation in mutations:
				index = Utilities.ParseResidueCode(mutation.residueCodes()[0])[1]
				residueIndexes.append(index)
			residueIndexes.sort()
			import Goodvibes.Main
			environment.output('[MODES] Calculating the effect of %d mutations on modes.\n', len(residueIndexes))
			modeCalculator = Goodvibes.Main.vibration()	
			results = modeCalculator.main('PEAT-SA',tool.pdbFile,residueIndexes=residueIndexes)
			print residueIndexes
		else:
			environment.output('[MODES] Can only perform mode calcualtion for SPMs.\n')
	if parser.transitionPath():
		print '[PATH] Transition path calculation not implemented yet - skipping'
	tool.cleanUp()
def main ( ) : environment = Environment . Environment ( ) parser = Utilities . CommandLineParser ( ) parser . parseCommandLine ( ) if parser . helpRequested ( ) is True : print __doc__ sys . exit ( 0 ) if parser . createConfigurationRequested ( ) is True : print 'Creating default configuration file, proteinDesignTool.conf, in the current directory' print 'See the programs README file for information on the options' Environment . Configuration ( searchDefaultLocations = False , writeFile = True ) sys . exit ( 0 ) tool = ProteinDesignTool ( parser . configurationFile ( ) , workingDirectory = parser . workingDirectory ( ) , pdbFile = parser . pdbFile ( ) , outputDirectory = parser . outputDirectory ( ) , dataName = parser . outputName ( ) , removeHeterogens = parser . removeHeterogens ( ) ) if parser . pKa ( ) is True : tool . runPKACalculation ( ) mutantCollection = parser . mutants ( ) if mutantCollection is None : environment . output ( '[PEAT-SA] No mutants available from previous run.\n' ) mutantCollection = CreateMutants ( tool . pdbFile , tool . configuration , parser , environment ) if parser . scan ( ) is True : tool . runScan ( mutantCollection = mutantCollection , ionisableGroups = parser . ionisableGroups ( ) , verbose = parser . verbose ( ) ) if parser . stability ( ) is True : tool . runStabilityCalculation ( mutantFiles = mutantCollection . mutantFiles ( ) , verbose = parser . verbose ( ) ) if parser . binding ( ) is True : tool . runBindingCalculation ( mutantFiles = mutantCollection . mutantFiles ( ) , ligandFile = parser . ligandFile ( ) , verbose = parser . verbose ( ) ) if parser . modes ( ) : doCalculation = True if parser . mutationListFile ( ) is not None : object = Data . MutationListFile ( parser . mutationListFile ( ) ) doCalculation = object . isSinglePointMutationFormat ( ) if doCalculation : mutations = mutantCollection . mutations ( ) residueIndexes = [ ] for mutation in mutations : index = Utilities . ParseResidueCode ( mutation . residueCodes ( ) [ 0 ] ) [ 1 ] residueIndexes . append ( index ) residueIndexes . sort ( ) import Goodvibes . Main environment . output ( '[MODES] Calculating the effect of %d mutations on modes.\n' , len ( residueIndexes ) ) modeCalculator = Goodvibes . Main . vibration ( ) results = modeCalculator . main ( 'PEAT-SA' , tool . pdbFile , residueIndexes = residueIndexes ) print residueIndexes else : environment . output ( '[MODES] Can only perform mode calcualtion for SPMs.\n' ) if parser . transitionPath ( ) : print '[PATH] Transition path calculation not implemented yet - skipping' tool . cleanUp ( )
Main function for the ProteinDesignTool program.
Main function for the ProteinDesignTool program .
'''Main function for the ProteinDesignTool program.
	
	Parses the command line and starts the jobs requested''' #Read arguments #Create the ProteinDesignTool instance #Check if an initial pKa run requested #Check if a previously created MutantCollection was specified #Note we use the ProteinDesignTool instances pdbFile attribute. #This points to the cleaned pdbFile the tool operates on. #Therefore we must use this to generate the mutants. #Scan 	 #Stability	 #Binding