PEATSA/Core/Programs.py
def run(self, cleanPDB=True):
	
		'''Runs the pKa calculation. This method does not return until the run is finished which may take some time.
		
		Parameters:
			cleanPDB - If True the all waters and ligands are removed from the pdbfile before the run.
				Default is True.'''
	
		#Import these here rather than at the top of the module
		#to avoid the program immediately crahsing if they are not present
		#FIXME: Possibly work around this in top-level ...
		import pKarun.pKarun_base
	
		#Reroute the WHATIF output to the log file
		#The file is called PDBNAME.log
		standardOut = sys.stdout
		scanLogFile = os.path.join(self.outputDirectory, '%s%d.log' % (os.path.split(self.pdbFile)[1], self.environment.rank()))
		#Stream is line buffered
		scanLogStream = open(scanLogFile, 'w', 1)
		sys.stdout = scanLogStream
	
		standardOut.write('[PKA CALC] Setting up pKa calculation for %s\n' % self.pdbFile)
		standardOut.write('[PKA CALC] Calculation log %s\n' % scanLogFile)
	
		#Setup the working directory for a pKa calculation
		self.workingDirectory.setupPKARun()
		#Copy the pdbfile to the directory if its not already there
		if not self.workingDirectory.containsFile(self.pdbFile) and self.environment.isRoot():
			self.pdbFile = self.workingDirectory.copyFileToDirectory(self.pdbFile)
		
		#Clean the pdb file if specified
		if cleanPDB is True:
			standardOut.write('[PKA CALC] Cleaning %s - Removing ligands and water, correcting pdb\n' % self.pdbFile)
			try:
				if self.environment.isRoot():
					Utilities.CleanPDB(self.pdbFile, self.pdbFile)
					
				self.environment.wait()	
				standardOut.write('[PKA CALC] Cleaning done.\n')
			except:
				#Reset streams
				scanLogStream.close()
				sys.stdout = standardOut
				raise
		
		#Get the options for the calculation from the configuration object (if it exists)
		if self.configuration is not None:
			options = []
			#See if any options were specified
			if self.configuration.has_section('PKA RUN'):
				standardOut.write('[PKA CALC] Reading options from configuration\n' % self.pdbFile)
				for option in self.configuration.options('PKA RUN'):
					options.append(option)
					options.append(self.configuration.get('PKA RUN', option))
				standardOut.write('[PKA CALC] Options are %s\n' % " ".join(options))	
			else:
				standardOut.write('[PKA CALC] No options provided. Defaults will be used\n')
			
			options.insert(0, 'pKarun.py')
			options.insert(1, self.pdbFile) 
		
		#Do the calculation
		try: 
			#I think this is just a group of miscellaneous functions
			#wrapped in a class
			functionObject = pKarun.pKarun_base.pKamisc()
			parameters = functionObject.parse_parameterlist(options)
			pKarunInstance = pKarun.pKarun_base.pKarun(os.getcwd(), self.pdbFile, parameters)
							
			standardOut.write('[PKA CALC] Running job in parallel\n')
			pKarunInstance.runseq()
		except:
			#Reset the output streams and reraise
			scanLogStream.close()
			sys.stdout = standardOut
			raise
			
		standardOut.write('[PKA CALC] Done\n')
Runs the pKa calculation. This method does not return until the run is finished which may take some time.
		
		Parameters:
			cleanPDB - If True the all waters and ligands are removed from the pdbfile before the run.
				Default is True.
Runs the pKa calculation. This method does not return until the run is finished which may take some time.
Parameters:
cleanPDB - If True the all waters and ligands are removed from the pdbfile before the run.
Default is True.
Runs the pKa calculation . This method does not return until the run is finished which may take some time . Parameters : cleanPDB - If True the all waters and ligands are removed from the pdbfile before the run . Default is True .
def run(self, cleanPDB=True):
		import pKarun.pKarun_base
		standardOut = sys.stdout
		scanLogFile = os.path.join(self.outputDirectory, '%s%d.log' % (os.path.split(self.pdbFile)[1], self.environment.rank()))
		scanLogStream = open(scanLogFile, 'w', 1)
		sys.stdout = scanLogStream
		standardOut.write('[PKA CALC] Setting up pKa calculation for %s\n' % self.pdbFile)
		standardOut.write('[PKA CALC] Calculation log %s\n' % scanLogFile)
		self.workingDirectory.setupPKARun()
		if not self.workingDirectory.containsFile(self.pdbFile) and self.environment.isRoot():
			self.pdbFile = self.workingDirectory.copyFileToDirectory(self.pdbFile)
		if cleanPDB is True:
			standardOut.write('[PKA CALC] Cleaning %s - Removing ligands and water, correcting pdb\n' % self.pdbFile)
			try:
				if self.environment.isRoot():
					Utilities.CleanPDB(self.pdbFile, self.pdbFile)
				self.environment.wait()	
				standardOut.write('[PKA CALC] Cleaning done.\n')
			except:
				scanLogStream.close()
				sys.stdout = standardOut
				raise
		if self.configuration is not None:
			options = []
			if self.configuration.has_section('PKA RUN'):
				standardOut.write('[PKA CALC] Reading options from configuration\n' % self.pdbFile)
				for option in self.configuration.options('PKA RUN'):
					options.append(option)
					options.append(self.configuration.get('PKA RUN', option))
				standardOut.write('[PKA CALC] Options are %s\n' % " ".join(options))	
			else:
				standardOut.write('[PKA CALC] No options provided. Defaults will be used\n')
			options.insert(0, 'pKarun.py')
			options.insert(1, self.pdbFile) 
		try: 
			functionObject = pKarun.pKarun_base.pKamisc()
			parameters = functionObject.parse_parameterlist(options)
			pKarunInstance = pKarun.pKarun_base.pKarun(os.getcwd(), self.pdbFile, parameters)
			standardOut.write('[PKA CALC] Running job in parallel\n')
			pKarunInstance.runseq()
		except:
			scanLogStream.close()
			sys.stdout = standardOut
			raise
		standardOut.write('[PKA CALC] Done\n')
def run ( self , cleanPDB = True ) : import pKarun . pKarun_base standardOut = sys . stdout scanLogFile = os . path . join ( self . outputDirectory , '%s%d.log' % ( os . path . split ( self . pdbFile ) [ 1 ] , self . environment . rank ( ) ) ) scanLogStream = open ( scanLogFile , 'w' , 1 ) sys . stdout = scanLogStream standardOut . write ( '[PKA CALC] Setting up pKa calculation for %s\n' % self . pdbFile ) standardOut . write ( '[PKA CALC] Calculation log %s\n' % scanLogFile ) self . workingDirectory . setupPKARun ( ) if not self . workingDirectory . containsFile ( self . pdbFile ) and self . environment . isRoot ( ) : self . pdbFile = self . workingDirectory . copyFileToDirectory ( self . pdbFile ) if cleanPDB is True : standardOut . write ( '[PKA CALC] Cleaning %s - Removing ligands and water, correcting pdb\n' % self . pdbFile ) try : if self . environment . isRoot ( ) : Utilities . CleanPDB ( self . pdbFile , self . pdbFile ) self . environment . wait ( ) standardOut . write ( '[PKA CALC] Cleaning done.\n' ) except : scanLogStream . close ( ) sys . stdout = standardOut raise if self . configuration is not None : options = [ ] if self . configuration . has_section ( 'PKA RUN' ) : standardOut . write ( '[PKA CALC] Reading options from configuration\n' % self . pdbFile ) for option in self . configuration . options ( 'PKA RUN' ) : options . append ( option ) options . append ( self . configuration . get ( 'PKA RUN' , option ) ) standardOut . write ( '[PKA CALC] Options are %s\n' % " " . join ( options ) ) else : standardOut . write ( '[PKA CALC] No options provided. Defaults will be used\n' ) options . insert ( 0 , 'pKarun.py' ) options . insert ( 1 , self . pdbFile ) try : functionObject = pKarun . pKarun_base . pKamisc ( ) parameters = functionObject . parse_parameterlist ( options ) pKarunInstance = pKarun . pKarun_base . pKarun ( os . getcwd ( ) , self . pdbFile , parameters ) standardOut . write ( '[PKA CALC] Running job in parallel\n' ) pKarunInstance . runseq ( ) except : scanLogStream . close ( ) sys . stdout = standardOut raise standardOut . write ( '[PKA CALC] Done\n' )
Runs the pKa calculation.
Runs the pKa calculation .
'''Runs the pKa calculation. This method does not return until the run is finished which may take some time.
		
		Parameters:
			cleanPDB - If True the all waters and ligands are removed from the pdbfile before the run.
				Default is True.''' #Import these here rather than at the top of the module #to avoid the program immediately crahsing if they are not present #FIXME: Possibly work around this in top-level ... #Reroute the WHATIF output to the log file #The file is called PDBNAME.log #Stream is line buffered #Setup the working directory for a pKa calculation #Copy the pdbfile to the directory if its not already there #Clean the pdb file if specified #Reset streams #Get the options for the calculation from the configuration object (if it exists) #See if any options were specified #Do the calculation #I think this is just a group of miscellaneous functions #wrapped in a class #Reset the output streams and reraise
self
cleanPDB