PEATSA/Core/Programs.py
def solvationEnergy(self, pdbFile, ligandFile, protonationStates={}, verbose=True):
	
		'''Returns the electrostatic solvation energies for the protein ligand complex
		
		Params:
			ligandFile: A ligand in mol2 format
			pdbFile: A pdb the ligand binds to
		
		Returns:
			A list of energies. The elements of the list are
			(Desolvation, Interaction, Protein Solvation, Water Solvation)
			The Protein and Water solvation energies have been scaled by 0.5 ala Born'''
		
		try:	
			import pdb2pqr.pdb2pka.pka
		except ImportError, data:
			raise Exceptions.EnvironmentError, 'Unable to compute solvation energies - %s' % data
		
		dir = self._getNewSID('PB')
		dir = os.path.abspath(dir)
		try:
			os.mkdir(dir)
			os.chdir(dir)
		except OSError, data:
			print data
			dir = self._getNewSID('PB')
			dir = os.path.abspath(dir)
			os.mkdir(dir)
			os.chdir(dir)
		
		#Replace PEAT mutation codes with pdb2pqr mutation codes
		if protonationStates is not None and len(protonationStates.keys()) != 0:
			protonationStates = self._convertProtonationData(protonationStates)

		#Copy the ligand and pdb files to the working dir since
		#the pdb2pka function will modify them
		try:
			if verbose is False:
				stdout = sys.stdout
				newout = open('PB.out', 'a+')
				sys.stdout = newout
				stderr = sys.stderr
				newerr = open('PB.err', 'a+')
				sys.stderr = stderr
		
			pdbCopy = os.path.join(dir, os.path.basename(pdbFile))
			shutil.copyfile(pdbFile, pdbCopy)
			
			if ligandFile is not None:
				ligandCopy = os.path.join(dir, os.path.basename(ligandFile))
				shutil.copyfile(ligandFile, ligandCopy)
							
				result = pdb2pqr.pdb2pka.pka.get_res_energies(pdbCopy, 
						ligandCopy ,
						'L:0001:LIG',
						 fix_states=protonationStates)
			else:
				result = pdb2pqr.pdb2pka.pka.get_res_energies(pdbCopy, 
						None,
						None,
						 fix_states=protonationStates)
				
						 			 
		except Exception, data:
			print 'Encountered an exception with file %s' % pdbFile 
			print data	
			raise		 
		finally:
			if verbose is False:
				newout.close()
				sys.stdout = stdout
				newerr.close()
				sys.stderr = stderr

			os.chdir('..')
			#shutil.rmtree(dir)
			#if os.path.isdir('phidir'):
			#	shutil.rmtree('phidir')

		#Convert the result to kjoule per mol  (its in kT) - assume 300K - 2.494
		result = map(lambda x: x*2.494, result)
	
		result = list(result)
		result.reverse()	
		return result
Returns the electrostatic solvation energies for the protein ligand complex
		
		Params:
			ligandFile: A ligand in mol2 format
			pdbFile: A pdb the ligand binds to
		
		Returns:
			A list of energies. The elements of the list are
			(Desolvation, Interaction, Protein Solvation, Water Solvation)
			The Protein and Water solvation energies have been scaled by 0.5 ala Born
Returns the electrostatic solvation energies for the protein ligand complex
Returns the electrostatic solvation energies for the protein ligand complex
def solvationEnergy(self, pdbFile, ligandFile, protonationStates={}, verbose=True):
		try:	
			import pdb2pqr.pdb2pka.pka
		except ImportError, data:
			raise Exceptions.EnvironmentError, 'Unable to compute solvation energies - %s' % data
		dir = self._getNewSID('PB')
		dir = os.path.abspath(dir)
		try:
			os.mkdir(dir)
			os.chdir(dir)
		except OSError, data:
			print data
			dir = self._getNewSID('PB')
			dir = os.path.abspath(dir)
			os.mkdir(dir)
			os.chdir(dir)
		if protonationStates is not None and len(protonationStates.keys()) != 0:
			protonationStates = self._convertProtonationData(protonationStates)
		try:
			if verbose is False:
				stdout = sys.stdout
				newout = open('PB.out', 'a+')
				sys.stdout = newout
				stderr = sys.stderr
				newerr = open('PB.err', 'a+')
				sys.stderr = stderr
			pdbCopy = os.path.join(dir, os.path.basename(pdbFile))
			shutil.copyfile(pdbFile, pdbCopy)
			if ligandFile is not None:
				ligandCopy = os.path.join(dir, os.path.basename(ligandFile))
				shutil.copyfile(ligandFile, ligandCopy)
				result = pdb2pqr.pdb2pka.pka.get_res_energies(pdbCopy, 
						ligandCopy ,
						'L:0001:LIG',
						 fix_states=protonationStates)
			else:
				result = pdb2pqr.pdb2pka.pka.get_res_energies(pdbCopy, 
						None,
						None,
						 fix_states=protonationStates)
		except Exception, data:
			print 'Encountered an exception with file %s' % pdbFile 
			print data	
			raise		 
		finally:
			if verbose is False:
				newout.close()
				sys.stdout = stdout
				newerr.close()
				sys.stderr = stderr
			os.chdir('..')
		result = map(lambda x: x*2.494, result)
		result = list(result)
		result.reverse()	
		return result
def solvationEnergy ( self , pdbFile , ligandFile , protonationStates = { } , verbose = True ) : try : import pdb2pqr . pdb2pka . pka except ImportError , data : raise Exceptions . EnvironmentError , 'Unable to compute solvation energies - %s' % data dir = self . _getNewSID ( 'PB' ) dir = os . path . abspath ( dir ) try : os . mkdir ( dir ) os . chdir ( dir ) except OSError , data : print data dir = self . _getNewSID ( 'PB' ) dir = os . path . abspath ( dir ) os . mkdir ( dir ) os . chdir ( dir ) if protonationStates is not None and len ( protonationStates . keys ( ) ) != 0 : protonationStates = self . _convertProtonationData ( protonationStates ) try : if verbose is False : stdout = sys . stdout newout = open ( 'PB.out' , 'a+' ) sys . stdout = newout stderr = sys . stderr newerr = open ( 'PB.err' , 'a+' ) sys . stderr = stderr pdbCopy = os . path . join ( dir , os . path . basename ( pdbFile ) ) shutil . copyfile ( pdbFile , pdbCopy ) if ligandFile is not None : ligandCopy = os . path . join ( dir , os . path . basename ( ligandFile ) ) shutil . copyfile ( ligandFile , ligandCopy ) result = pdb2pqr . pdb2pka . pka . get_res_energies ( pdbCopy , ligandCopy , 'L:0001:LIG' , fix_states = protonationStates ) else : result = pdb2pqr . pdb2pka . pka . get_res_energies ( pdbCopy , None , None , fix_states = protonationStates ) except Exception , data : print 'Encountered an exception with file %s' % pdbFile print data raise finally : if verbose is False : newout . close ( ) sys . stdout = stdout newerr . close ( ) sys . stderr = stderr os . chdir ( '..' ) result = map ( lambda x : x * 2.494 , result ) result = list ( result ) result . reverse ( ) return result
Returns the electrostatic solvation energies for the protein ligand complex
Returns the electrostatic solvation energies for the protein ligand complex
'''Returns the electrostatic solvation energies for the protein ligand complex
		
		Params:
			ligandFile: A ligand in mol2 format
			pdbFile: A pdb the ligand binds to
		
		Returns:
			A list of energies. The elements of the list are
			(Desolvation, Interaction, Protein Solvation, Water Solvation)
			The Protein and Water solvation energies have been scaled by 0.5 ala Born''' #Replace PEAT mutation codes with pdb2pqr mutation codes #Copy the ligand and pdb files to the working dir since #the pdb2pka function will modify them #shutil.rmtree(dir) #if os.path.isdir('phidir'): #	shutil.rmtree('phidir') #Convert the result to kjoule per mol  (its in kT) - assume 300K - 2.494
A list of energies. The elements of the list are
(Desolvation, Interaction, Protein Solvation, Water Solvation)
The Protein and Water solvation energies have been scaled by 0.5 ala Born
A list of energies . The elements of the list are ( Desolvation Interaction Protein Solvation Water Solvation ) The Protein and Water solvation energies have been scaled by 0 . 5 ala Born
self
pdbFile
A pdb the ligand binds to
A pdb the ligand binds to
ligandFile
A ligand in mol2 format
A ligand in mol2 format
protonationStates
verbose