PEATSA/Core/Programs.py
def _runBindingCalculation(self, pdbName, ligandName, executable, outputStream):
	
		'''Runs a binding calculation for ligandName to pdbName 
		
		Note: This is a private method - runBindingCalculation() should be used by external callers
		
		The method writes a Uffbaps run file for calcualting the binding energy of ligandName to pdbName.
		It then runs Uffbaps and waits for it to finish.
		Finally it reads the last line output, extracts the information from it, and returns the results.
		
		Parameters:
			pdbName - Name of a pdb file in the directory where Uffbaps is being run
			
			ligandName - Name of a ligand file in the directory where Uffbaps is being run
			
			exectutable - Path to Uffbaps executable
			
			outputStream - Where the output should be written.
			Note this is empty on return.
			
		Return:
			Returns a list of the components of the binding energy and the total value.
			The order of the elements in the list correpsonds to the order of elements
			in bindingResultsHeaders'''
		
		runFile = os.path.join(self.directoryPath, "run%d.txt" % self.environment.rank())	
					
		#Create the run file 
		self._writeBindingRunFile(pdbName, ligandName, runFile)

		#Run
		process = subprocess.Popen([executable, runFile], cwd=self.directoryPath, stdout=outputStream)
		process.wait()
		
		#Get the results
		outputStream.seek(0)
		
		lines = outputStream.readlines()
		result = lines[-1:]
		try:
			components = self._chopLigandResultLine(result[0])
		except BaseException:
			self.environment.output(
				'[STABILITY] Unable to parse unexpected UFFBAPS output\n%s\n' % lines, 
				rootOnly=False,
				stream=sys.stderr)
			self.environment.output(
				'[STABILITY] Skipping mutant %s\n' % os.path.split(pdbName)[1], 
				rootOnly=False,
				stream=sys.stderr)
			components = None	
			
		#Reset the stream
		outputStream.seek(0)
		outputStream.truncate()									
		
		return components
Runs a binding calculation for ligandName to pdbName 
		
		Note: This is a private method - runBindingCalculation() should be used by external callers
		
		The method writes a Uffbaps run file for calcualting the binding energy of ligandName to pdbName.
		It then runs Uffbaps and waits for it to finish.
		Finally it reads the last line output, extracts the information from it, and returns the results.
		
		Parameters:
			pdbName - Name of a pdb file in the directory where Uffbaps is being run
			
			ligandName - Name of a ligand file in the directory where Uffbaps is being run
			
			exectutable - Path to Uffbaps executable
			
			outputStream - Where the output should be written.
			Note this is empty on return.
			
		Return:
			Returns a list of the components of the binding energy and the total value.
			The order of the elements in the list correpsonds to the order of elements
			in bindingResultsHeaders
Runs a binding calculation for ligandName to pdbName
Note: This is a private method - runBindingCalculation() should be used by external callers

The method writes a Uffbaps run file for calcualting the binding energy of ligandName to pdbName.
It then runs Uffbaps and waits for it to finish.
Finally it reads the last line output, extracts the information from it, and returns the results.

Name of a pdb file in the directory where Uffbaps is being run

Name of a ligand file in the directory where Uffbaps is being run

Path to Uffbaps executable



Returns a list of the components of the binding energy and the total value.
The order of the elements in the list correpsonds to the order of elements
in bindingResultsHeaders
Runs a binding calculation for ligandName to pdbName Note : This is a private method - runBindingCalculation () should be used by external callers The method writes a Uffbaps run file for calcualting the binding energy of ligandName to pdbName . It then runs Uffbaps and waits for it to finish . Finally it reads the last line output extracts the information from it and returns the results . Name of a pdb file in the directory where Uffbaps is being run Name of a ligand file in the directory where Uffbaps is being run Path to Uffbaps executable Returns a list of the components of the binding energy and the total value . The order of the elements in the list correpsonds to the order of elements in bindingResultsHeaders
def _runBindingCalculation(self, pdbName, ligandName, executable, outputStream):
		runFile = os.path.join(self.directoryPath, "run%d.txt" % self.environment.rank())	
		self._writeBindingRunFile(pdbName, ligandName, runFile)
		process = subprocess.Popen([executable, runFile], cwd=self.directoryPath, stdout=outputStream)
		process.wait()
		outputStream.seek(0)
		lines = outputStream.readlines()
		result = lines[-1:]
		try:
			components = self._chopLigandResultLine(result[0])
		except BaseException:
			self.environment.output(
				'[STABILITY] Unable to parse unexpected UFFBAPS output\n%s\n' % lines, 
				rootOnly=False,
				stream=sys.stderr)
			self.environment.output(
				'[STABILITY] Skipping mutant %s\n' % os.path.split(pdbName)[1], 
				rootOnly=False,
				stream=sys.stderr)
			components = None	
		outputStream.seek(0)
		outputStream.truncate()									
		return components
def _runBindingCalculation ( self , pdbName , ligandName , executable , outputStream ) : runFile = os . path . join ( self . directoryPath , "run%d.txt" % self . environment . rank ( ) ) self . _writeBindingRunFile ( pdbName , ligandName , runFile ) process = subprocess . Popen ( [ executable , runFile ] , cwd = self . directoryPath , stdout = outputStream ) process . wait ( ) outputStream . seek ( 0 ) lines = outputStream . readlines ( ) result = lines [ - 1 : ] try : components = self . _chopLigandResultLine ( result [ 0 ] ) except BaseException : self . environment . output ( '[STABILITY] Unable to parse unexpected UFFBAPS output\n%s\n' % lines , rootOnly = False , stream = sys . stderr ) self . environment . output ( '[STABILITY] Skipping mutant %s\n' % os . path . split ( pdbName ) [ 1 ] , rootOnly = False , stream = sys . stderr ) components = None outputStream . seek ( 0 ) outputStream . truncate ( ) return components
Runs a binding calculation for ligandName to pdbName
Note: This is a private method - runBindingCalculation() should be used by external callers
Runs a binding calculation for ligandName to pdbName Note : This is a private method - runBindingCalculation () should be used by external callers
'''Runs a binding calculation for ligandName to pdbName 
		
		Note: This is a private method - runBindingCalculation() should be used by external callers
		
		The method writes a Uffbaps run file for calcualting the binding energy of ligandName to pdbName.
		It then runs Uffbaps and waits for it to finish.
		Finally it reads the last line output, extracts the information from it, and returns the results.
		
		Parameters:
			pdbName - Name of a pdb file in the directory where Uffbaps is being run
			
			ligandName - Name of a ligand file in the directory where Uffbaps is being run
			
			exectutable - Path to Uffbaps executable
			
			outputStream - Where the output should be written.
			Note this is empty on return.
			
		Return:
			Returns a list of the components of the binding energy and the total value.
			The order of the elements in the list correpsonds to the order of elements
			in bindingResultsHeaders''' #Create the run file  #Run #Get the results #Reset the stream
self
pdbName
ligandName
executable
outputStream